-
Notifications
You must be signed in to change notification settings - Fork 10
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
Leftover processes after successful bun
run
#14
Comments
Just tried running one of those and it just seems to exit normally:
|
I'm seeing something similar: the afl-fuzz processes get killed by SIGKILL, but its children, the crowbar fuzzed process are all still alive (well actually they seem to be SIGSTOPed due to code in ocaml-afl-persistent). It is unclear how to kill these, since their process group id is different from the afl parents too (well I can use pkill -9 <myfuzzedprogram.exe> but unclear how to do this reliably in a programmatic way). Changing |
https://github.com/jwilk/python-afl/blob/c1b0c535b0c0c8a9486110ebf3b27cfe90a66774/tests/test_fuzz.py#L140-L161 says this is an issue in afl itself. The workaround in python-afl is quite ugly though. I'm sending a PR that uses cgroups to fix it. |
In permanent mode AFL leaves some processes behind: ocurrent#14 (comment) This is partly due to bun using proc#terminate (SIGKILL), but even with SIGTERM there are race conditions in AFL and some processes stay behind: https://groups.google.com/d/topic/afl-users/E37s4YDti7o This can observed by just doing a 'dune runtest' in bun itself, and then `ps -ef|grep short.exe` on a multicore machine. The permanent mode processes stop themselves with SIGSTOP and wait for their afl parent to unblock them, but their afl parent exits, so they stay around forever. Which wouldn't be a problem, except for afl-gotcpu which detect that these processes are around and refuses to start more fuzzing jobs. The processes' parent pid, gid and sid is unrelated to bun or the afl fuzzer processes (afl/forkserver does a setsid call), so we have no easy way of finding these processes. Use cgroups when available to kill child processes reliably: this allows us to easily find all the pids of (grand)children. Signed-off-by: Edwin Török <[email protected]>
In permanent mode AFL leaves some processes behind: ocurrent#14 (comment) This is partly due to bun using proc#terminate (SIGKILL), but even with SIGTERM there are race conditions in AFL and some processes stay behind: https://groups.google.com/d/topic/afl-users/E37s4YDti7o This can observed by just doing a 'dune runtest' in bun itself, and then `ps -ef|grep short.exe` on a multicore machine. The permanent mode processes stop themselves with SIGSTOP and wait for their afl parent to unblock them, but their afl parent exits, so they stay around forever. Which wouldn't be a problem, except for afl-gotcpu which detect that these processes are around and refuses to start more fuzzing jobs. The processes' parent pid, gid and sid is unrelated to bun or the afl fuzzer processes (afl/forkserver does a setsid call), so we have no easy way of finding these processes. Use cgroups when available to kill child processes reliably: this allows us to easily find all the pids of (grand)children. Fixes ocurrent#14 Signed-off-by: Edwin Török <[email protected]>
In permanent mode AFL leaves some processes behind: ocurrent#14 (comment) This is partly due to bun using proc#terminate (SIGKILL), but even with SIGTERM there are race conditions in AFL and some processes stay behind: https://groups.google.com/d/topic/afl-users/E37s4YDti7o This can observed by just doing a 'dune runtest' in bun itself, and then `ps -ef|grep short.exe` on a multicore machine. The permanent mode processes stop themselves with SIGSTOP and wait for their afl parent to unblock them, but their afl parent exits, so they stay around forever. Which wouldn't be a problem, except for afl-gotcpu which detect that these processes are around and refuses to start more fuzzing jobs. The processes' parent pid, gid and sid is unrelated to bun or the afl fuzzer processes (afl/forkserver does a setsid call), so we have no easy way of finding these processes. Use cgroups when available to kill child processes reliably: this allows us to easily find all the pids of (grand)children. Fixes ocurrent#14 Signed-off-by: Edwin Török <[email protected]>
In permanent mode AFL leaves some processes behind: ocurrent#14 (comment) This is partly due to bun using proc#terminate (SIGKILL), but even with SIGTERM there are race conditions and some processes stay behind. This can observed by just doing a 'dune runtest' in bun itself, and then `ps -ef|grep short.exe` on a multicore machine. The permanent mode processes stop themselves with SIGSTOP and wait for their afl parent to unblock them, but their afl parent exits, so they stay around forever. Which wouldn't be a problem, except for afl-gotcpu which detect that these processes are around and refuses to start more fuzzing jobs. The processes' parent pid, gid and sid is unrelated to bun or the afl fuzzer processes (afl/forkserver does a setsid call), so we have no easy way of finding these processes. Use cgroups when available to kill child processes reliably: this allows us to easily find all the pids of (grand)children. Signed-off-by: Edwin Török <[email protected]>
In permanent mode AFL leaves some processes behind: ocurrent#14 (comment) This is partly due to bun using proc#terminate (SIGKILL), but even with SIGTERM there are race conditions in AFL and some processes stay behind: https://groups.google.com/d/topic/afl-users/E37s4YDti7o This can observed by just doing a 'dune runtest' in bun itself, and then `ps -ef|grep short.exe` on a multicore machine. The permanent mode processes stop themselves with SIGSTOP and wait for their afl parent to unblock them, but their afl parent exits, so they stay around forever. Which wouldn't be a problem, except for afl-gotcpu which detect that these processes are around and refuses to start more fuzzing jobs. The processes' parent pid, gid and sid is unrelated to bun or the afl fuzzer processes (afl/forkserver does a setsid call), so we have no easy way of finding these processes. Use cgroups when available to kill child processes reliably: this allows us to easily find all the pids of (grand)children. Fixes ocurrent#14 Signed-off-by: Edwin Török <[email protected]>
I've been toying around with bun this afternoon in order to add a small tutorial in https://github.com/NathanReb/ocaml-afl-examples and a section in my upcoming blog article about AFL fuzzing and OCaml and something weird happened.
I found out that for some reason when I fuzz one of my binaries
bun
seems to leave some process running.I defined
dune
aliases to invokebun
with the right set of parameters. When I build those aliases everything seems to work just fine:but it turns out it leaves some processes running:
I found out about it because, even though the command line for those seems to indicate otherwise,
afl-fuzz
considers them to beafl-fuzz
processes. A subsequentbun
invocation will fail becauseafl-fuzz
believes the given core is being used by anotherafl-fuzz
process for some reason.I tried running the
bun
command myself, wondering ifdune
was interfering somehow but the result is the same.I'l try to further debug this but I'm not yet super familiar with how
bun
works internally so I was hoping you might have an idea what's going wrong here.You can take a look at NathanReb/ocaml-afl-examples#1 if you want to know a bit more about the dune aliases specification or the various binaries being fuzzed but in the following example it's just a
crowbar
binary with a single really basic test and a fairly regularbun
invocation.Please let me know if you need any further detail!
The text was updated successfully, but these errors were encountered: