fix(libsinsp/modern_bpf): ancillary data improvements#2336
fix(libsinsp/modern_bpf): ancillary data improvements#2336poiana merged 4 commits intofalcosecurity:masterfrom
Conversation
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
userspace/libsinsp/parsers.cpp
Outdated
| cmsg = PPM_CMSG_NXTHDR(msg_ctrl, msg_ctrllen, cmsg)) { | ||
| // Check for malformed control message buffer: | ||
| if(reinterpret_cast<const char *>(cmsg) < msg_ctrl || | ||
| reinterpret_cast<const char *>(cmsg) > msg_ctrl + msg_ctrllen) { |
There was a problem hiding this comment.
Shouldn't the second part be reinterpret_cast<const char *>(cmsg) >= msg_ctrl + msg_ctrllen) ?
There was a problem hiding this comment.
I don't think so.
Consider the case where msg_ctrl = 0x1000, msg_ctrllen = 64.
If cmsg = 0x1064 then even if the read length is 1 byte, it's still reading past the end of the buffer (valid range is 0x1000 - 0x1063).
Maybe I'm missing something, but I believe this logic is correct.
There was a problem hiding this comment.
Mhh, If i have a buffer msg_ctrl = 1000, with msg_ctrllen = 64, I can read from 1000 up to 1063 (both included).
There was a problem hiding this comment.
Sorry for the confusion, I should stop leaving code review comments in a hurry
userspace/libsinsp/parsers.cpp
Outdated
| cmsg = PPM_CMSG_NXTHDR(msg_ctrl, msg_ctrllen, cmsg)) { | ||
| // Check for malformed control message buffer: | ||
| if(reinterpret_cast<const char *>(cmsg) < msg_ctrl || | ||
| reinterpret_cast<const char *>(cmsg) > msg_ctrl + msg_ctrllen) { |
There was a problem hiding this comment.
I don't think so.
Consider the case where msg_ctrl = 0x1000, msg_ctrllen = 64.
If cmsg = 0x1064 then even if the read length is 1 byte, it's still reading past the end of the buffer (valid range is 0x1000 - 0x1063).
Maybe I'm missing something, but I believe this logic is correct.
|
@nathan-b: changing LGTM is restricted to collaborators DetailsIn response to this: 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-sigs/prow repository. |
Signed-off-by: Wiktor Gołgowski <wiktor.golgowski@sysdig.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2336 +/- ##
==========================================
- Coverage 77.18% 77.17% -0.02%
==========================================
Files 227 227
Lines 30192 30199 +7
Branches 4611 4614 +3
==========================================
+ Hits 23304 23306 +2
- Misses 6888 6893 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
LGTM label has been added. DetailsGit tree hash: dd24f914dfce16b3179f00410665a25ac05eea96 |
Perf diff from master - unit testsHeap diff from master - unit testsHeap diff from master - scap fileBenchmarks diff from master |
|
/milestone 0.21.0 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: FedeDP, Molter73, wigol The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area driver-modern-bpf
/area libsinsp
Does this PR require a change in the driver versions?
What this PR does / why we need it:
This change brings improvements in handling ancillary data retrieved by
recvmsgandrecvmmsg:Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: