Skip to content

Add support for tracing multi link - #2078

Open
olsajiri wants to merge 10 commits into
cilium:mainfrom
olsajiri:tracing_multi
Open

olsajiri wants to merge 10 commits into
cilium:mainfrom
olsajiri:tracing_multi

Conversation

@olsajiri

Copy link
Copy Markdown
Contributor

wip

@olsajiri olsajiri changed the title Tracing multi Add support for tracing multi link Aug 12, 2026
@olsajiri
olsajiri force-pushed the tracing_multi branch 3 times, most recently from 44c45c3 to 495a3d9 Compare August 13, 2026 14:21
@ti-mo

ti-mo commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@olsajiri #2116 introduces 7.2 (and 7.3 when new verifier log parser lands) to CI. Please also take a look if the tracing_multi_* tests can be fixed. I'm not sure how they're supposed to work after you've introduced skeletons to the selftests. Perhaps these just need to be cleaned up after linking, not sure.

@olsajiri

olsajiri commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@olsajiri #2116 introduces 7.2 (and 7.3 when new verifier log parser lands) to CI.

awesome! thanks

Please also take a look if the tracing_multi_* tests can be fixed. I'm not sure how they're supposed to work after you've introduced skeletons to the selftests. Perhaps these just need to be cleaned up after linking, not sure.

ok, will check

@olsajiri
olsajiri marked this pull request as ready for review October 10, 2026 12:54
@olsajiri
olsajiri requested review from a team, mmat11, rgo3 and ti-mo as code owners October 10, 2026 12:54
@ti-mo

ti-mo commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Thanks! I'll request a Copilot review since I'm going on PTO tonight, won't get to this in time. @rgo3 @mmat11 PTAL

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Program FD lifetime is unsafe during attachment, and type-specific tracing-multi link metadata is inaccessible.

2 open findings
What changed in this PR

Adds Linux 7.2 tracing-multi link support for attaching tracing programs to multiple kernel functions.

Changes:

  • Adds tracing-multi attach types, syscall plumbing, link wrapping, and feature detection.
  • Adds attachment/input tests and ELF section mappings.
  • Documents new section names.

AIL: 4

File Description
types.go Exposes tracing-multi attach types.
link/​tracing_multi.go Implements tracing-multi attachment.
link/​tracing_multi_test.go Tests attachment and validation.
link/​link_other.go Recognizes tracing-multi links.
internal/​sys/​tracing_multi.go Defines link-create syscall attributes.
internal/​kfunc/​kfunc.go Resolves kernel function BTF IDs.
features/​link.go Adds kernel feature detection.
features/​link_test.go Tests feature detection.
elf_reader_test.go Tests tracing-multi ELF sections.
docs/​ebpf/​concepts/​section-naming.md Documents section names.
attachtype_string.go Adds attach-type string mappings.
Files not reviewed (1)
  • attachtype_string.go: Generated file

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread link/tracing_multi.go
attr.Cookies = sys.SlicePointer(opts.Cookies)
}

fd, err := sys.LinkCreateTracingMulti(attr)
Comment thread link/tracing_multi.go
Comment on lines +93 to +95
type tracingMulti struct {
RawLink
}
@olsajiri
olsajiri marked this pull request as draft October 15, 2026 12:51
@olsajiri
olsajiri force-pushed the tracing_multi branch 4 times, most recently from d67f162 to 4a19e18 Compare October 15, 2026 19:27
Making sure it gets tested as other section types.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding the syscall types needed to read tracing_multi link info.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Exposesing attach types through the public ebpf API.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Add a feature probe for tracing_multi link support.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding tests for both kfunc lookup modes.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Implementing the link.AttachTracingMulti for attaching tracing
program to multiple kernel functions via tracing_multi link.

Adding support for FEntry, FExit, and FSession multi-attach modes
and attachment cookies.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding support for retrieving tracing_multi link data through
link.Info() as a TracingMultiInfo object.

TracingMultiInfo.Targets() returns each target’s BTF ID, address
and cookie.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding tests for tracing_multi link attachment.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Adding test for retrieving tracing_multi link targets.

AIL: 2

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
@olsajiri
olsajiri marked this pull request as ready for review October 20, 2026 14:19
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.

3 participants