libs icon indicating copy to clipboard operation
libs copied to clipboard

new(driver,userspace/libsinsp): added support for state modifying `epoll_create` and `epoll_create1`.

Open FedeDP opened this issue 3 years ago • 17 comments

What type of PR is this?

/kind feature

Any specific area of the project related to this PR?

/area driver-kmod /area driver-bpf /area libsinsp

Does this PR require a change in the driver versions?

Yep, because it adds a new event.

/version driver-SCHEMA-version-minor

But, given that min schema version was already bumped since last libs release, i think we can skip this. (see https://github.com/falcosecurity/libs/pull/501).

What this PR does / why we need it:

Adds support for epoll_create and epoll_create1 syscalls, because they create a FD thus are needed for sinsp state.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

new: support `epoll_create` and `epoll_create1` syscalls.

FedeDP avatar Sep 12 '22 08:09 FedeDP

Github 503 :/

FedeDP avatar Sep 12 '22 12:09 FedeDP

Probably we need to add them also in the modern probe /hold

Andreagit97 avatar Sep 12 '22 14:09 Andreagit97

Would this case fit along the others in the creates_fd_generic test you recently added?

LucaGuerra avatar Sep 12 '22 16:09 LucaGuerra

Would this case fit along the others in the creates_fd_generic test you recently added?

Done!

Probably we need to add them also in the modern probe

Done!

@LucaGuerra @Andreagit97

FedeDP avatar Sep 13 '22 06:09 FedeDP

Probably we need to add them also in the modern probe

Done!

Awesome @FedeDP . I will look later thru the patch set. Thanks.

hbrueckner avatar Sep 13 '22 07:09 hbrueckner

But epoll_create1 tests are failing and i don't get why :/

FedeDP avatar Sep 13 '22 07:09 FedeDP

But epoll_create1 tests are failing and i don't get why :/

Looks like the syscall passes but does not create an event:

[ RUN      ] SyscallEnter.epoll_create1E
HALLO: fd=245 errno=Success
/root/git/falcosecurity/libs/test/modern_bpf/event_class/event_class.cpp:378: Failure
Failed
There is no event in the buffer.

with using printf("HALLO: fd=%i errno=%s\n", fd, strerror(errno));

hbrueckner avatar Sep 13 '22 08:09 hbrueckner

@FedeDP Tests pass on s390x:

# ./test/modern_bpf/bpf_test  |grep epoll
[ RUN      ] SyscallExit.epoll_create1X
[       OK ] SyscallExit.epoll_create1X (0 ms)
[ RUN      ] SyscallExit.epoll_createX
[       OK ] SyscallExit.epoll_createX (0 ms)
[ RUN      ] SyscallEnter.epoll_create1E
[       OK ] SyscallEnter.epoll_create1E (0 ms)
[ RUN      ] SyscallEnter.epoll_createE
[       OK ] SyscallEnter.epoll_createE (0 ms)

will review then later.

hbrueckner avatar Sep 13 '22 09:09 hbrueckner

@hbrueckner fixed everything!

FedeDP avatar Sep 13 '22 10:09 FedeDP

@FedeDP other the minors above, this looks good to me. /lgtm

hbrueckner avatar Sep 13 '22 14:09 hbrueckner

LGTM label has been added.

Git tree hash: 835f1bbd5f7b2660455fa49c8b49147baf08d3f5

poiana avatar Sep 13 '22 14:09 poiana

@FedeDP Thanks for the update. /lgtm

hbrueckner avatar Sep 14 '22 08:09 hbrueckner

LGTM label has been added.

Git tree hash: 9af79754e9aa2bbd7266eaa8c87801ae8bc1273a

poiana avatar Sep 14 '22 08:09 poiana

Rebased on top of master.

FedeDP avatar Sep 20 '22 12:09 FedeDP

TODO:

  • bump schema version minor

FedeDP avatar Oct 11 '22 14:10 FedeDP

Rebased on top of master.

FedeDP avatar Oct 26 '22 14:10 FedeDP

/milestone next-driver

Andreagit97 avatar Oct 26 '22 15:10 Andreagit97

LGTM label has been added.

Git tree hash: 2b4be8c8dccf18ffa19529968baf5ca9bfd3b00c

poiana avatar Oct 27 '22 15:10 poiana

Rebased on top of master.

FedeDP avatar Oct 28 '22 07:10 FedeDP

LGTM label has been added.

Git tree hash: 8daa64dbb061e4f2e87d90f356b29bbf5f80b615

poiana avatar Oct 28 '22 14:10 poiana

@Andreagit97 thanks for your review! Addressed in latest commit!

FedeDP avatar Oct 31 '22 09:10 FedeDP

LGTM label has been added.

Git tree hash: b57738ff9664e41821f9765b3a8adcd2cbccef33

poiana avatar Oct 31 '22 10:10 poiana

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Andreagit97, FedeDP, hbrueckner, 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:
  • ~~OWNERS~~ [Andreagit97,FedeDP,leogr]

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

poiana avatar Oct 31 '22 12:10 poiana

/unhold

FedeDP avatar Oct 31 '22 13:10 FedeDP