[PATCH] ash: clear sa_flags always

Ian Wienand ianw at vmware.com
Mon Apr 11 22:28:19 UTC 2011


Hi,

Without explicit zeroing this sigaction call can pass random values
off the stack.  I guess Linux doesn't mind this, but other kernels
might :) But in a generic sense, since you're passing random values
there's no guarantee that actually you won't pass some bit that
actually means something in the future.

-i

Signed-off-by: Ian Wienand <ianw at vmware.com>

---
 shell/ash.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/shell/ash.c b/shell/ash.c
index cde0afc..19d47da 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -3486,13 +3486,14 @@ setsignal(int signo)
 	switch (new_act) {
 	case S_CATCH:
 		act.sa_handler = signal_handler;
-		act.sa_flags = 0; /* matters only if !DFL and !IGN */
-		sigfillset(&act.sa_mask); /* ditto */
 		break;
 	case S_IGN:
 		act.sa_handler = SIG_IGN;
 		break;
 	}
+
+	act.sa_flags = 0;
+	sigfillset(&act.sa_mask);
 	sigaction_set(signo, &act);
 
 	*t = new_act;
-- 
tg: (10348a6..) vmware/ash-clear-saflags (depends on: vmkernel-main-build)


More information about the busybox mailing list