-
Notifications
You must be signed in to change notification settings - Fork 169
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
fix(driver): take the unix path directly from the kernel #2215
fix(driver): take the unix path directly from the kernel #2215
Conversation
@@ -606,8 +606,7 @@ static __always_inline int unix_socket_path(char *dest, const char *user_ptr, si | |||
* specified length of the address structure. | |||
*/ | |||
if(res == 1) { | |||
dest[0] = '@'; | |||
res = bpf_probe_read_kernel_str(dest + 1, | |||
res = bpf_probe_read_kernel_str(dest, |
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.
in the modern we don't prepend the @
so it's probably better to be uniform between drivers, we can add it in the modern if we want but not sure what is the value of having the initial @
Perf diff from master - unit tests
Heap diff from master - unit tests
Heap diff from master - scap file
Benchmarks diff from master
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2215 +/- ##
==========================================
+ Coverage 75.38% 75.44% +0.06%
==========================================
Files 264 265 +1
Lines 34014 34057 +43
Branches 5805 5800 -5
==========================================
+ Hits 25642 25696 +54
+ Misses 8372 8361 -11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
2bc1408
to
847cdaa
Compare
size = 1 + 8 + 8; | ||
|
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.
to simplify the verification we remove the fallback to the userspace struct like we do in the modern, we keep it only in the kernel module
LGTM label has been added. Git tree hash: 49e6580a392193473af5bc03412d6d621c0b45ea
|
847cdaa
to
5803382
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: 1c40a3184dc2040f536c16855695b14b89349013
|
For some reason, e2e tests are failing :/ |
Signed-off-by: Andrea Terzolo <[email protected]>
5803382
to
bf16be2
Compare
// `us_name` should contain the socket path extracted from the kernel if we cannot retrieve | ||
// it we can fallback to the user-provided address | ||
// Note that we check the second byte of `us_name`, see `sock_getname` for more details. | ||
// Some times `usrsockaddr` is provided as a NULL pointer, checking `use_userdata` should be |
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.
This is why e2e tests were failing we were dereferencing usrsockaddr
without checking it was != NULL
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
Thanks andre!
LGTM label has been added. Git tree hash: d3a29d5a1a33113e71cc949e693132e9403b4ad8
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Andreagit97, FedeDP 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 |
I ran kernel-testing matrix against this PR and it works fine 🚀 |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area driver-kmod
/area driver-bpf
/area driver-modern-bpf
Does this PR require a change in the driver versions?
No
What this PR does / why we need it:
Today in the modern ebpf we extract the UNIX path directly from the kernel socket. This means that symlink are automatically solved. In the legacy ebpf and kmod we take the path from the syscall sockaddr param. This PR adapts the old driver behaviors to the modern one
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?: