Making BusyBox self-contained by modifying exec calls and NOEXEC behaviour
Nadav Tasher
tashernadav at gmail.com
Sun Jan 19 23:10:16 UTC 2025
Hi all!
This patch series aims to make some improvements in the way BusyBox
handles execXX calls.
My goal is to have a gateway function that can be used to proxy all
execXX calls made by BusyBox applets. This is quite useful when running
BusyBox in a contrained environment.
I took the liberty of rewriting BB_EXECVP (an existing function) to make
it do the following things:
1. Decide whether an applet needs to be executed (NOEXEC can be forced)
2. Exit if configured to only run applets and no applet was found
3. Fallback to execvp
Additionaly, I've modified some applets that were using execXX syscalls directly
to use BB_EXECVP or BB_EXECVP_or_die.
These changes reduce code duplication when using BB_EXECVP_or_die.
The ash applet was also modified to make it use BB_EXECVP so that the
applet execution decision only happens in one place, BB_EXECVP.
I'm pretty happy with the result, and would like to hear your thoughts about
this!
Going forward, I might take a look at replacing system() calls with BB_EXECVP
calls.
Kind regards,
Nadav
More information about the busybox
mailing list