Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On RHEL kernels where ebpf has been back-ported but
FMODE_CREATEDdoes not yet exist, usefsnotify_createas an indication of file creation. This requires a new probe onfsnotifyto set a thread local map entry, which the currentdo_filp_openexit probe can then test for.Since the
fsnotifyprobe can be noisy and the parameters have changed over time, onlyenable that probe when necessary. Ideally, we would test for the existence of
FMODE_CREATED, but as far as I'm aware, there's not a way to detect#defines. There's another commit (torvalds/linux@44907d7) relatedto the addition of
FMODE_CREATEDwhich is detectable by testing the parameter count of theatomic_openfunction pointer withinstruct inode_operations.A new function was added to use btf for detecting the parameter change, and is used to conditionally apply the
fnsotifyprobe. Hopefully, the parameter count toatomic_openwill not change back to 6.Also, re-enabled file testing for the appropriate kernels.
Thanks @haesbaert for the feedback/review. I incorporated and squashed this and this.