Skip to content

Keep open flags for kretprobes - #495

Draft
nicholasberlin wants to merge 1 commit into
nberlin/fa2-09-matching-testsfrom
nberlin/fa2-10-kprobe-flags
Draft

nicholasberlin wants to merge 1 commit into
nberlin/fa2-09-matching-testsfrom
nberlin/fa2-10-kprobe-flags

Conversation

@nicholasberlin

@nicholasberlin nicholasberlin commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A kretprobe cannot read the open function arguments at return. This PR adds an entry kprobe that saves the open_flags pointer. The return probe uses that pointer and removes the saved state. The loader supports both do_filp_open() and do_file_open() and loads the entry probe only for QQ_FILE_ACCESS.

If entry state is unavailable, the probe uses file flags. Those flags can lack O_CREAT, O_EXCL, O_NOCTTY and O_TRUNC; the manual states this limit. The live tests now require creation and truncation flags in kprobe mode. The saved state contains only the argument that this feature uses.

Validation

  • At commit 5d2fe18dbb85, the source audit passed. Compared with ba7b1bc1041b, changes are limited to the approved comments. Executable C tokens are unchanged.
  • The new full build and VM run was cancelled for these comment-only changes. The earlier complete results below apply to ba7b1bc1041b.

Earlier results, before these comment changes:

  • Rebased on main at 1e0279c0da62.
  • At commit ba7b1bc1041b, the C and BPF build passed with -Werror and WITH_BTFHUB=y, including Go programs.
  • At commit ba7b1bc1041b, the full eBPF suite passed in the krun test image on Ubuntu 26.04 kernel 7.0.0-42-generic with fentry and with -K, and on kernel 5.15.0-139-generic.
  • At commit ba7b1bc1041b, the guests used 512 MiB of RAM and KVM.
  • At commit ba7b1bc1041b, the VM runs required the filesystem fixture with QUARK_TEST_FS_REQUIRED=1.

Earlier results, before this rebase:

  • At commit a61bf7f3e005, the C and BPF build passed with -Werror.
  • At commit a61bf7f3e005, the full eBPF suite passed with krun on Ubuntu 26.04 kernel 7.0.0-42-generic with fentry and with -K, and on kernel 5.15.0-139-generic.
  • The VM runs at a61bf7f3e005 required the filesystem fixture with QUARK_TEST_FS_REQUIRED=1.
  • At previous commit 612adc228941, mandoc -Tlint -Wall passed for the changed pages. All quark manual references exist at that commit.

Stack

part 10 of 19

Depends on #494 (part 9).

Derived from original #477 and the loader changes in original #478.

@nicholasberlin
nicholasberlin added this pull request to stack #504 October 29, 2026 13:49
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch from 612adc2 to a61bf7f Compare October 29, 2026 21:34
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch from a61bf7f to bf52652 Compare October 30, 2026 00:28
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch from bf52652 to 35b34ac Compare October 30, 2026 01:31
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch 2 times, most recently from 6d75686 to eab18b8 Compare October 30, 2026 02:16
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch from eab18b8 to 2047b6e Compare October 30, 2026 13:04
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch 2 times, most recently from ba7b1bc to 5d2fe18 Compare November 2, 2026 19:17
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch from 5d2fe18 to 9de3471 Compare November 2, 2026 20:28
@nicholasberlin
nicholasberlin force-pushed the nberlin/fa2-10-kprobe-flags branch from 9de3471 to 03cda09 Compare November 2, 2026 20:52

This branch has not been deployed

No deployments
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