-
-
Notifications
You must be signed in to change notification settings - Fork 330
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
Adding ExitCodeObserver and ExitSignalObserver #2138
Conversation
nice |
libafl/src/executors/command.rs
Outdated
|
||
match res.map(|status| status.signal()) { | ||
// for reference: https://www.man7.org/linux/man-pages/man7/signal.7.html | ||
Some(Some(9)) => Ok(ExitKind::Oom), |
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 not your fault,
but can you change this exitkind::oom (and all occurences of exitkind::oom) to something else?
for example exitkind::sigkill
exit code 9 is not oom. there's no way to tell if the process exited out of oom (unless we type dmesg
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.
I was wondering what was up with that but didn't want to touch it without understanding what was actually happening.
If this gets touched already: Does it make sense to have an exit kind for SIGKILL only? Or do we want further types for certain signals? Or just remove it altogether and use an ExitSignalObserver
whenever we need the functionality? What do you think?
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.
imo just changing this to ExitKind::SIGKILL is fine. it represents an error sent by the kernel (but not necessarily OOM)
ideally we could separate it into SIGSEGV, SIGABRT, SIGTERM... (if you want to do it)
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.
I've looked into it a bit more deeply and I think the best way would just be to remove ExitKind::Oom
without replacement. If a user wants more advanced handling of exits, they have to write a custom Feedback
implementation regardless, and they can just use a ExitSignalObserver
to get the specific signal.
The issue is that a SIGSEGV etc. is also a crash, so a user may be confused if it isn't reported as such.
I'm more so thinking about what signals may not indicate a crash and maybe handle them differently (or just report them as ExitKind::Ok
. I don't know Unix well enough to make this a final list, but maybe something like this:
- SIGTERM
- SIGINT
- SIGUSR1
- SIGUSR2
- SIGCONT
- SIGALRM
Any other signal? How do we handle them?
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.
I would call them maybe ExitKind::Interrupted.
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.
I had to re-add ExitKind::Oom
, because libafl_libfuzzer
uses it — I added a disclaimer to the definition.
In the future, I'd prefer if all features are implemented for all possible combinations, or at least have compile-time errors it not — it's a recipe for weird behaviour for people new to libafl. Not sure how this would be done here and I feel like it doesn't have much to do with this PR, so I'm not going to make those changes now. This is something I've stumbled across at multiple places within the code base, so it may be good to fundamentally think about this at some point.
e8a1a75
to
1444959
Compare
can you fix the clippy errors too? |
ff623be
to
7c6c5c0
Compare
6ff858c
to
c0abfa6
Compare
(I'm so sorry, I messed up my git history. Should hopefully be better now.) |
thank you 👍 |
Sorry. I have another idea about this.
(Okay there is What I would do is
can you
|
These observers allow observing the exit code and exit signal of a process, specifically in CommandExecutor. This is helpful if the standard
CrashFeedback
is not specific enough.