Skip to content
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

fuzz: rework df_exec_cmd_check() #119

Merged
merged 1 commit into from
Jul 12, 2022
Merged

Conversation

mrc0mmand
Copy link
Member

Explicitly use fork() & execl() to avoid the file descriptor
shenanigans, and move & rename the function to util.[ch].

Also, when at it, add a unit test for the function as well.

src/util.c Outdated Show resolved Hide resolved
@evverx
Copy link
Member

evverx commented Jul 10, 2022

@mrc0mmand could you move the first commit (with g_assert) to a separate PR? I think it should be good to go.

@mrc0mmand
Copy link
Member Author

@mrc0mmand could you move the first commit (with g_assert) to a separate PR? I think it should be good to go.

Sure thing, done in #121.

@mrc0mmand
Copy link
Member Author

@evverx I tweaked the logging stuff a bit, so we can differentiate between multiple logging handles - in our case it only general and command (so far) - and made --debug accept an optional argument, so now we can do --debug or --debug=general for the expected/current behavior, --debug=command to show only output from the --command, and --debug=all to show everything. Hopefully it makes sense.

@evverx
Copy link
Member

evverx commented Jul 11, 2022

now we can do --debug or --debug=general for the expected/current behavior, --debug=command to show only output from the --command

I'm kind of on the fence about this. On the one hand it should make it possible to extend that part easily but on the other hand as a user I'd prefer to pass something like -e '/some/weird/script' --keep-command-output' and be done with it.

@mrc0mmand
Copy link
Member Author

now we can do --debug or --debug=general for the expected/current behavior, --debug=command to show only output from the --command

I'm kind of on the fence about this. On the one hand it should make it possible to extend that part easily but on the other hand as a user I'd prefer to pass something like -e '/some/weird/script' --keep-command-output' and be done with it.

I don't really have a preference here, so I can definitely leave the --debug option as is and just add a new one :-)

@evverx
Copy link
Member

evverx commented Jul 11, 2022

Just to clarify, I'm just used to tools where I have to flip a switch like -Q in honggfuzz or AFL_DEBUG_CHILD in afl-fuzz to start capturing the output of various binaries so whatever I'm saying here is subjective and can be ignored :-)

@evverx
Copy link
Member

evverx commented Jul 11, 2022

I can definitely leave the --debug option as is and just add a new one :-)

I think I'd go with this. If at some point it causes any issues in terms of extending the logger it will be on me :-)

Explicitly use fork() & execl() to avoid the file descriptor
shenanigans, and move & rename the function to util.[ch].

Also, when at it, add a unit test for the function as well.
@evverx
Copy link
Member

evverx commented Jul 12, 2022

@mrc0mmand one last thing. I wonder what was wrong with system? It seems to me that it would be shorter than fork/execl at least.

@evverx
Copy link
Member

evverx commented Jul 12, 2022

I think I should have read the commit message carefully. fork followed up by execl lets dfuzzer avoid saving/restoring its stdin/stdout/stderr with dup/dup2. LGTM. I'll go ahead and merge it. Thanks!

@evverx evverx merged commit e696448 into dbus-fuzzer:master Jul 12, 2022
@mrc0mmand mrc0mmand deleted the more-tests branch July 12, 2022 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants