[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ltp-list
Subject:    [LTP] [PATCH] Fix segfault of "pan" on signal action
From:       Daniel Gollub <dgollub () suse ! de>
Date:       2008-10-27 21:25:31
Message-ID: 200810272225.32077.dgollub () suse ! de
[Download RAW message or body]

Hi,

pan segfaults when receiving various signal registered by sigaction.

----->8--------
i386:~ # /usr/lib/ltp/pan/pan -q -e -S -a 24911 -n 24911 -f /root/ftest05 &
[1] 25049
i386:~ # killall -SIGINT pan
[1]+  Segmentation fault      /usr/lib/ltp/pan/pan -q -e -S -a 24911 -n 24911 -f /root/ftest05
------8<-------

Valgrind reports various uninitalied bytes of the sigaction struct:

----->8--------
==25055== Syscall param rt_sigaction(act->sa_mask) points to uninitialised byte(s)
==25055==    at 0x407AA17: __libc_sigaction (in /lib/libc-2.4.so)
==25055==    by 0x407AB02: sigaction (in /lib/libc-2.4.so)
==25055==    by 0x804AAEF: main (pan.c:448)
==25055==  Address 0xbe9763a4 is on thread 1's stack
==25055== 
==25055== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s)
==25055==    at 0x407AA17: __libc_sigaction (in /lib/libc-2.4.so)
==25055==    by 0x407AB02: sigaction (in /lib/libc-2.4.so)
==25055==    by 0x804AAEF: main (pan.c:448)
==25055==  Address 0xbe97639c is on thread 1's stack
------8<-------

Initializing the sigaction struct as empty avoids a segfault of "pan".


Signed-off-by: Daniel Gollub <dgollub@suse.de>

---

 pan/pan.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pan/pan.c b/pan/pan.c
index 457de0f..0ed4be3 100644
--- a/pan/pan.c
+++ b/pan/pan.c
@@ -444,7 +444,11 @@ main(int argc, char **argv)
 
     rec_signal = send_signal = 0;
     if (run_time != -1) { alarm(run_time); }
+
+    sigemptyset(&sa.sa_mask);
+    sa.sa_flags = 0;
     sa.sa_handler = wait_handler;
+
     sigaction(SIGALRM, &sa, NULL);
     sigaction(SIGINT, &sa, NULL);
     sigaction(SIGTERM, &sa, NULL);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic