-
Notifications
You must be signed in to change notification settings - Fork 182
new(driver,userspace/libsinsp): added support for state modifying epoll_create and epoll_create1.
#596
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
Merged
Merged
new(driver,userspace/libsinsp): added support for state modifying epoll_create and epoll_create1.
#596
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
bb6a072
new(driver,userspace/libsinsp): added support for state modifying `ep…
FedeDP 3398760
chore(userspace/libsinsp): added unit test for epoll_create and epoll…
FedeDP 627c93a
new(driver,test,userspace/libpman): added support for epoll_create fa…
FedeDP 7dc2cc3
fix(test): fixed epoll_create tests. epoll_create1 are still failing.
FedeDP f57d58e
fix(driver): fixed epoll_create1 tests.
FedeDP 4c4a81a
fix(driver/modern_bpf): properly conver epoll_create1 flags to scap f…
FedeDP 46b861e
cleanup(driver/bpf): removed unused vars.
FedeDP 71ae124
chore: cleaned up remaining conflicts.
FedeDP 2e241ee
chore(driver,userspace): fixed epoll_create1 flags terminator value.
FedeDP 51ec22b
fix(driver): add back cut line.
FedeDP 5e057d3
fix(userspace/libsinsp): fixed ppm_sc_set tests.
FedeDP 2a0dcdb
update(driver): bump schema version minor.
FedeDP bb06017
chore(driver, test): address review comments.
FedeDP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 2.1.0 | ||
| 2.2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/epoll_create.bpf.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright (C) 2022 The Falco Authors. | ||
| * | ||
| * This file is dual licensed under either the MIT or GPL 2. See MIT.txt | ||
| * or GPL2.txt for full copies of the license. | ||
| */ | ||
|
|
||
| #include <helpers/interfaces/fixed_size_event.h> | ||
|
|
||
| /*=============================== ENTER EVENT ===========================*/ | ||
|
|
||
| SEC("tp_btf/sys_enter") | ||
| int BPF_PROG(epoll_create_e, | ||
| struct pt_regs *regs, | ||
| long id) | ||
| { | ||
| struct ringbuf_struct ringbuf; | ||
| if(!ringbuf__reserve_space(&ringbuf, EPOLL_CREATE_E_SIZE)) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| ringbuf__store_event_header(&ringbuf, PPME_SYSCALL_EPOLL_CREATE_E, EPOLL_CREATE_E_SIZE); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| /* Parameter 1: size (type: PT_INT32) */ | ||
| s32 size = (s32)extract__syscall_argument(regs, 0); | ||
| ringbuf__store_s32(&ringbuf, size); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| ringbuf__submit_event(&ringbuf); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| /*=============================== ENTER EVENT ===========================*/ | ||
|
|
||
| /*=============================== EXIT EVENT ===========================*/ | ||
|
|
||
| SEC("tp_btf/sys_exit") | ||
| int BPF_PROG(epoll_create_x, | ||
| struct pt_regs *regs, | ||
| long ret) | ||
| { | ||
| struct ringbuf_struct ringbuf; | ||
| if(!ringbuf__reserve_space(&ringbuf, EPOLL_CREATE_X_SIZE)) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| ringbuf__store_event_header(&ringbuf, PPME_SYSCALL_EPOLL_CREATE_X, EPOLL_CREATE_X_SIZE); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| /* Parameter 1: res (type: PT_ERRNO)*/ | ||
FedeDP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ringbuf__store_s64(&ringbuf, ret); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| ringbuf__submit_event(&ringbuf); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| /*=============================== EXIT EVENT ===========================*/ | ||
67 changes: 67 additions & 0 deletions
67
driver/modern_bpf/programs/tail_called/events/syscall_dispatched_events/epoll_create1.bpf.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright (C) 2022 The Falco Authors. | ||
| * | ||
| * This file is dual licensed under either the MIT or GPL 2. See MIT.txt | ||
| * or GPL2.txt for full copies of the license. | ||
| */ | ||
|
|
||
| #include <helpers/interfaces/fixed_size_event.h> | ||
|
|
||
| /*=============================== ENTER EVENT ===========================*/ | ||
|
|
||
| SEC("tp_btf/sys_enter") | ||
| int BPF_PROG(epoll_create1_e, | ||
| struct pt_regs *regs, | ||
| long id) | ||
| { | ||
| struct ringbuf_struct ringbuf; | ||
| if(!ringbuf__reserve_space(&ringbuf, EPOLL_CREATE1_E_SIZE)) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| ringbuf__store_event_header(&ringbuf, PPME_SYSCALL_EPOLL_CREATE1_E, EPOLL_CREATE1_E_SIZE); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| /* Parameter 1: flags (type: PT_FLAGS32) */ | ||
| s32 flags = (s32)extract__syscall_argument(regs, 0); | ||
| ringbuf__store_u32(&ringbuf, epoll_create1_flags_to_scap(flags)); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| ringbuf__submit_event(&ringbuf); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| /*=============================== ENTER EVENT ===========================*/ | ||
|
|
||
| /*=============================== EXIT EVENT ===========================*/ | ||
|
|
||
| SEC("tp_btf/sys_exit") | ||
| int BPF_PROG(epoll_create1_x, | ||
| struct pt_regs *regs, | ||
| long ret) | ||
| { | ||
| struct ringbuf_struct ringbuf; | ||
| if(!ringbuf__reserve_space(&ringbuf, EPOLL_CREATE1_X_SIZE)) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| ringbuf__store_event_header(&ringbuf, PPME_SYSCALL_EPOLL_CREATE1_X, EPOLL_CREATE1_X_SIZE); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| /* Parameter 1: res (type: PT_ERRNO)*/ | ||
FedeDP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ringbuf__store_s64(&ringbuf, ret); | ||
|
|
||
| /*=============================== COLLECT PARAMETERS ===========================*/ | ||
|
|
||
| ringbuf__submit_event(&ringbuf); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| /*=============================== EXIT EVENT ===========================*/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
We were using wrong flags for
mlock2.