-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update: add open_by_handle_at syscall #148
update: add open_by_handle_at syscall #148
Conversation
Hi @Andreagit97. Thanks for your PR. I'm waiting for a falcosecurity member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Left a couple of comments.
/ok-to-test |
8d22d5c
to
36a4f35
Compare
Signed-off-by: Andrea Terzolo <[email protected]> Co-authored-by: Jason Dellaluce <[email protected]>
Signed-off-by: Andrea Terzolo <[email protected]> Co-authored-by: Jason Dellaluce <[email protected]>
Signed-off-by: Andrea Terzolo <[email protected]>
Signed-off-by: Andrea Terzolo <[email protected]>
Signed-off-by: Andrea Terzolo <[email protected]> Co-authored-by: Jason Dellaluce <[email protected]>
Old kernels (like 4.14) have too strict limits on the bpf program length to support 32 path components. For the moment we decrease the limit to 16. Signed-off-by: Andrea Terzolo <[email protected]>
c6d3627
to
27b8295
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
LGTM label has been added. Git tree hash: 4deec2c4aac411d09ff71f3647d52fcb6a8a423c
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Andreagit97, leogr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
Any specific area of the project related to this PR?
/area driver-kmod
/area driver-ebpf
/area libscap
/area libsinsp
What this PR does / why we need it:
This adds support to the
open_by_handle_at
syscall. This has been reported as a high priority missing syscall in the "umbrella issue" 👇falcosecurity/falco#676
Which issue(s) this PR fixes:
Special notes for your reviewer:
The following sample program has been used for testing:
main.c.txt
main.c
:Create the file to open where you want.
Run
main
passing as argument the absolute file path or the path relative to the current working directory of the calling process:Open_by_hanlde_at path extraction
We have chosen to extract the absolute path of the opened file from the file descriptor returned by the syscall. In case of error, the file descriptor is not valid so unfortunately, we cannot extract the file path. The file descriptor seems the smartest way to extract information about the path, given the little information provided by the syscall.
Bpf testing
I have tested the new bpf features on the following vagrant images:
Old kernels verifiers (like 4.14) allow reading only file paths consisting of at most 16 components. With more than 16 components the verifier complains about the excessive bpf program length due to the loop unrolling approach used in the new
bpf_get_path
function. The functionbpf_get_path
added in this pull request, is an attempt to collect the file path from the file descriptor. Kernel 5.10 introduced a new bpf_helper calledbpf_d_path
which however cannot be used byBPF_PROG_TYPE_RAW_TRACEPOINT
programs. Unfortunately, in our case, libscap loads all bpf programs asBPF_PROG_TYPE_RAW_TRACEPOINT
.Does this PR introduce a user-facing change?: