Skip to content

aya: fix wrong BPF_LINK_TYPE in TryFrom<FdLink>#1532

Merged
tamird merged 1 commit into
aya-rs:mainfrom
swananan:fix/fdlink-link-type
Apr 14, 2026
Merged

aya: fix wrong BPF_LINK_TYPE in TryFrom<FdLink>#1532
tamird merged 1 commit into
aya-rs:mainfrom
swananan:fix/fdlink-link-type

Conversation

@swananan
Copy link
Copy Markdown
Contributor

@swananan swananan commented Apr 14, 2026

Context

UProbe, KProbe, and TracePoint all checked the wrong bpf_link_type when converting from FdLink. All three use perf_attach, which produces BPF_LINK_TYPE_PERF_EVENT links, but the checks matched BPF_LINK_TYPE_TRACING (UProbe, TracePoint) and
BPF_LINK_TYPE_KPROBE_MULTI (KProbe).

Strengthen pin_lifecycle tests to verify the FdLink to link conversion, covering this previously untested path.

Found while working on #1417.

Added/updated tests?

We strongly encourage you to add a test for your changes.

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Checklist

  • Rust code has been formatted with cargo +nightly fmt.
  • All clippy lints have been fixed.
    You can find failing lints with cargo xtask clippy.
  • Unit tests are passing locally with cargo test.
  • The Integration tests are passing locally.
  • I have blessed any API changes with cargo xtask public-api --bless.

(Optional) What GIF best describes this PR or how it makes you feel?


This change is Reviewable

@swananan swananan requested a review from a team as a code owner April 14, 2026 13:59
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 14, 2026

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 76fa6cb
🔍 Latest deploy log https://app.netlify.com/projects/aya-rs-docs/deploys/69de608a223e2c00086226c0
😎 Deploy Preview https://deploy-preview-1532--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.

Copy link
Copy Markdown
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.

Nice. Now that we have 4 identical implementations (there is 1 before this change) could we consolidate them to reduce repetition?

@tamird reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on swananan).

@swananan swananan force-pushed the fix/fdlink-link-type branch from 1ae88d8 to 210ece0 Compare April 14, 2026 15:21
@swananan
Copy link
Copy Markdown
Contributor Author

Nice. Now that we have 4 identical implementations (there is 1 before this change) could we consolidate them to reduce repetition?

@tamird reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on swananan).

Done, realized these can be consolidated into a macro. And also adjusted the commit message.

Fix wrong bpf_link_type checks in TryFrom<FdLink> for UProbeLink,
KProbeLink and TracePointLink. Consolidate all TryFrom<FdLink>
implementations into an impl_try_from_fdlink! macro.

Strengthen pin_lifecycle tests to verify the FdLink to link
conversion, covering this previously untested path.

Found while working on aya-rs#1417.
@swananan swananan force-pushed the fix/fdlink-link-type branch from 210ece0 to 76fa6cb Compare April 14, 2026 15:27
Copy link
Copy Markdown
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.

:lgtm:

@tamird reviewed 9 files and all commit messages, and made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on swananan).

@tamird tamird enabled auto-merge (rebase) April 14, 2026 15:27
@tamird tamird merged commit 85246f0 into aya-rs:main Apr 14, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants