[git commit] expr: make it NOEXEC

Denys Vlasenko vda.linux at googlemail.com
Mon Aug 7 21:23:18 UTC 2017


commit: https://git.busybox.net/busybox/commit/?id=af5d0086694b9c9b7cbf896e49e1997ec7039904
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 NOFORK_NOEXEC.lst | 4 ++--
 coreutils/expr.c  | 7 +++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/NOFORK_NOEXEC.lst b/NOFORK_NOEXEC.lst
index fd53063..acbe29e 100644
--- a/NOFORK_NOEXEC.lst
+++ b/NOFORK_NOEXEC.lst
@@ -108,12 +108,12 @@ dumpleases - leaks: open+xread
 echo - NOFORK
 ed - interactive, longterm
 egrep - longterm runner ("CMD | egrep ..."  may run indefinitely, better to exec to conserve memory)
-eject - leaks: open+ioctl_or_perror_and_die, changes state (moves fds)
+eject - hardware, leaks: open+ioctl_or_perror_and_die, changes state (moves fds)
 env - noexec. spawner, changes state (env)
 envdir - noexec. spawner
 envuidgid - noexec. spawner
 expand - runner
-expr - leaks: nested allocs
+expr - noexec. leaks: nested allocs
 factor - runner (eats stdin if no params)
 fakeidentd - daemon
 false - NOFORK
diff --git a/coreutils/expr.c b/coreutils/expr.c
index a2bbfdd..e54afbb 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -38,7 +38,7 @@
 //config:	the applet slightly larger, but will allow computation with very
 //config:	large numbers.
 
-//applet:IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP))
+//applet:IF_EXPR(APPLET_NOEXEC(expr, expr, BB_DIR_USR_BIN, BB_SUID_DROP, expr))
 
 //kbuild:lib-$(CONFIG_EXPR) += expr.o
 
@@ -118,7 +118,10 @@ struct globals {
 	char **args;
 } FIX_ALIASING;
 #define G (*(struct globals*)bb_common_bufsiz1)
-#define INIT_G() do { setup_common_bufsiz(); } while (0)
+#define INIT_G() do { \
+	setup_common_bufsiz(); \
+	/* NB: noexec applet - globals not zeroed */ \
+} while (0)
 
 /* forward declarations */
 static VALUE *eval(void);


More information about the busybox-cvs mailing list