-
Notifications
You must be signed in to change notification settings - Fork 165
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
Infrequent Segfaults for CAPSET_X #817
Comments
cc @loresuso |
Hi @adduali1310, thank you for noticing this. |
@adduali1310 thank you very much for the investigation and for the fix! |
Thanks for the feedback folks. As to your point @loresuso about when this happens, I do not have any hypothesis about it currently but will try to investigate further to get a better idea. Do you have any thoughts on when this might happen? Apart from this, wanted to bring up a couple of other points as well. I was going through the userspace/libsinsp/parsers.cpp file source code and found a couple more issues:
Ex- https://github.com/falcosecurity/libs/blob/master/userspace/libsinsp/parsers.cpp#L223 (NULL check) I don't mind submitting a PR for making the file more consistent but wanted to get all of your thoughts on this. |
Hi @adduali1310, Anyway, I believe the segfault occurred because of some dropped events and the |
Describe the bug
Noticed segfaults when running Falco. These segfaults seem to be intermittent and not very frequent.
Tried to enable log-level debug to figure out the issue, but that was not very helpful.
Tried to examine the coredump and on doing so, I can see the segfault occurs for the PPME_CAPSET_X event case i.e when trying to parse the event for capset_exit on the following line : https://github.com/falcosecurity/libs/blob/3.0.1+driver/userspace/libsinsp/parsers.cpp#L5697
Further tried to examine the issue via gdb and I can see that the threadinfo in the coredump is a nullptr and the threadinfo reference ( m_tinfo_ref) is also empty. The rest of the evt struct seems to have expected values.
Although the capset syscall is to set capabilities of a thread, my guess is some of the starting events have been missed as a result of which the threadinfo is a nullptr.
I can see similar nullptr checks through out the code file which I think handles this issue for specific cases.
Ex - https://github.com/falcosecurity/libs/blob/3.0.1+driver/userspace/libsinsp/parsers.cpp#L2358
https://github.com/falcosecurity/libs/blob/3.0.1+driver/userspace/libsinsp/parsers.cpp#L2827
How to reproduce it
For now seems to be very intermittent which makes me believe that this happens only when some start information is missed.
Edit: Submitted a PR that should help handle the issue.
Expected behaviour
No Segfaults should occur.
Environment
Falco version: 0.33.1-1-48a2c44b
Libs version: 0.9.0
Plugin API: 2.0.0
Driver:
API version: 2.0.0
Schema version: 2.0.0
Default driver: 3.0.1+driver
Machine: x86_64
System: Linux Debian
OS: Debian GNU/Linux 11 (bullseye)
Kernel: 5.15.76
Installation method: From Source
The text was updated successfully, but these errors were encountered: