Skip to content

Conversation

@cppcoffee
Copy link
Contributor

@cppcoffee cppcoffee commented Aug 23, 2025

Fixed #1087


This change is Reviewable

@netlify
Copy link

netlify bot commented Aug 23, 2025

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit ae41f97
🔍 Latest deploy log https://app.netlify.com/projects/aya-rs-docs/deploys/68bd8a9117bc480008ae26fd
😎 Deploy Preview https://deploy-preview-1326--aya-rs-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mergify mergify bot added the aya-bpf This is about aya-bpf (kernel) label Aug 23, 2025
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
@mergify mergify bot added the test A PR that improves test cases or CI label Aug 24, 2025
Copy link
Member

@tamird tamird left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a test.

@cppcoffee
Copy link
Contributor Author

I use fentry/vfs_open as the mount point, but during compilation, I get the error: "helper call is not allowed in probe".

How should I test this?

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
@mergify
Copy link

mergify bot commented Sep 7, 2025

@cppcoffee, this pull request is now in conflict and requires a rebase.

@mergify mergify bot added the needs-rebase label Sep 7, 2025
@mergify mergify bot removed the needs-rebase label Sep 7, 2025
@tamird tamird requested a review from Copilot September 7, 2025 15:04
@tamird
Copy link
Member

tamird commented Sep 7, 2025

@codex review

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the bpf_d_path helper function to aya-ebpf, enabling BPF programs to convert kernel path structures to human-readable path strings. This addresses issue #1087 by providing a way to extract filesystem paths from kernel data structures.

  • Added bpf_d_path helper function implementation
  • Created comprehensive integration tests for the new helper
  • Updated public API to expose the path bindings and helper function

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
xtask/public-api/aya-ebpf.txt Updates public API exports to include path bindings and bpf_d_path function
test/integration-test/src/tests/bpf_d_path.rs Integration test verifying bpf_d_path functionality with /dev/null
test/integration-test/src/tests.rs Adds bpf_d_path module to test suite
test/integration-test/src/lib.rs Registers BPF_D_PATH test binary
test/integration-ebpf/src/bpf_d_path.rs BPF program implementation using bpf_d_path in fentry context
test/integration-ebpf/Cargo.toml Adds bpf_d_path binary configuration
test/integration-common/src/lib.rs Defines shared TestResult struct and constants
ebpf/aya-ebpf/src/helpers.rs Implements bpf_d_path helper function wrapper

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

)
};

result.len = dest.len();
Copy link

Copilot AI Sep 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be result.len = data.len(); instead of dest.len(). The current code sets the length to the buffer size rather than the actual path length returned by bpf_d_path.

Suggested change
result.len = dest.len();
result.len = data.len();

Copilot uses AI. Check for mistakes.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +38 to +47
unsafe {
memcpy(
result.buf.as_mut_ptr(),
data.as_ptr() as *mut u8,
data.len(),
)
};

result.len = dest.len();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Report actual bytes returned by bpf_d_path

result.len is populated with dest.len() rather than the number of bytes copied from bpf_d_path. When the helper returns a shorter path than the buffer, the length published to user space is still PATH_BUF_LEN, so the integration test will happily read uninitialized/truncated bytes and cannot detect if the helper returned an empty or partial path. Replace the assignment with the length of data so the test exercises the real path size.

Useful? React with 👍 / 👎.

@anfedotoff
Copy link

I use fentry/vfs_open as the mount point, but during compilation, I get the error: "helper call is not allowed in probe".

How should I test this?

Hi, this helper works from LSM programs, you can take a look here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aya-bpf This is about aya-bpf (kernel) test A PR that improves test cases or CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support for bpf_d_path helper

3 participants