public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4067] New: possible problem in sigaction resulting into segfault
@ 2007-02-16 22:36 nico-linux-glibc at schottelius dot org
  2007-02-16 22:52 ` [Bug libc/4067] " drepper at redhat dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: nico-linux-glibc at schottelius dot org @ 2007-02-16 22:36 UTC (permalink / raw)
  To: glibc-bugs

When sa.sa_flags is not set my program segfaults after the handler for sig_child
was called.

I don't think this should be the case.

Having undefined 

Code:
http://unix.schottelius.org/cgi-bin/gitweb.cgi?p=cLinux/cinit.git;a=blob;h=fc744794e5f486cd6ac9d9b04417289e3710fd18;hb=7077199ab69bd9c5760049b71b6ed3c28aafcb87;f=src/core/set_signals.c

Errors in valgrind:
http://home.schottelius.org/~nico/unix/progs/cinit/problem-2007-02-15.valgrind

Description / Tests I did before:
http://home.schottelius.org/~nico/unix/progs/cinit/problem-2007-02-15

I am using 2.3.6.ds1-11 on debian/sid.

-- 
           Summary: possible problem in sigaction resulting into segfault
           Product: glibc
           Version: 2.3.6
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nico-linux-glibc at schottelius dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/4067] possible problem in sigaction resulting into segfault
  2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
@ 2007-02-16 22:52 ` drepper at redhat dot com
  2007-02-17 16:38 ` nico-linux-glibc at schottelius dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: drepper at redhat dot com @ 2007-02-16 22:52 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-02-16 22:52 -------
File this with your distribution.  I'm not going to look into any ancient libc
as a replacement for support the distribution does want to provide.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/4067] possible problem in sigaction resulting into segfault
  2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
  2007-02-16 22:52 ` [Bug libc/4067] " drepper at redhat dot com
@ 2007-02-17 16:38 ` nico-linux-glibc at schottelius dot org
  2007-02-17 18:14 ` drepper at redhat dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nico-linux-glibc at schottelius dot org @ 2007-02-17 16:38 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From nico-linux-glibc at schottelius dot org  2007-02-17 16:38 -------
same happens on glibc-2.4-7mdv2007.0:

[...]
testC
=> cinit started.
test2 - es scheint zu gehen
[SERVICE] /etc/cinit/svc/init: [ FAILED] Service failed!
Finished CHILD catcher
Segmentation fault

If I init the sa.flags it does not segfault:

[telmich@jonas src]$ diff -u core/set_signals.c.segfault core/set_signals.c    
     
--- core/set_signals.c.segfault	2007-02-17 16:34:39.000000000 +0100
+++ core/set_signals.c	2007-02-17 16:34:46.000000000 +0100
@@ -18,17 +18,17 @@
 
    if(action == ACT_SERV) {
       sa.sa_handler  = sig_child;
-//      sa.sa_flags    = SA_NOCLDSTOP; 
+      sa.sa_flags    = SA_NOCLDSTOP; 
    } else {
       sa.sa_handler=SIG_DFL;
-//      sa.sa_flags    = 0;
+      sa.sa_flags    = 0;
    }
-//   sigemptyset(&sa.sa_mask);
+   sigemptyset(&sa.sa_mask);
 
    sigaction(SIGCHLD,&sa,NULL);     /* what todo when a child exited    */
 
    /* reset flags */
-//   sa.sa_flags    = 0;
+   sa.sa_flags    = 0;
    if(action == ACT_SERV) {
       sa.sa_handler=do_reboot;
    }


The version:

[telmich@jonas src]$ /lib/libc.so.6 
GNU C Library development release version 2.4, by Roland McGrath et al.
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.1 20060724 (prerelease) (4.1.1-3mdk).
Compiled on a Linux 2.6.17 system on 2007-01-18.
Available extensions:
	crypt add-on version 2.1 by Michael Glad and others
	GNU libio by Per Bothner
	NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
	Native POSIX Threads Library by Ulrich Drepper et al
	BIND-8.2.3-T5B
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |
            Version|2.3.6                       |2.4


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/4067] possible problem in sigaction resulting into segfault
  2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
  2007-02-16 22:52 ` [Bug libc/4067] " drepper at redhat dot com
  2007-02-17 16:38 ` nico-linux-glibc at schottelius dot org
@ 2007-02-17 18:14 ` drepper at redhat dot com
  2007-02-17 19:40 ` nico-linux-glibc at schottelius dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: drepper at redhat dot com @ 2007-02-17 18:14 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-02-17 18:14 -------
Report it to the distribution.  glibc 2.4 is ancient and not supported here.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/4067] possible problem in sigaction resulting into segfault
  2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
                   ` (2 preceding siblings ...)
  2007-02-17 18:14 ` drepper at redhat dot com
@ 2007-02-17 19:40 ` nico-linux-glibc at schottelius dot org
  2007-02-17 19:54 ` nico-linux-glibc at schottelius dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: nico-linux-glibc at schottelius dot org @ 2007-02-17 19:40 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From nico-linux-glibc at schottelius dot org  2007-02-17 19:40 -------
Damn, you are right, glibc 2.5 works:

zellis% /lib/libc.so.6 
GNU C Library stable release version 2.5, by Roland McGrath et al.

Btw, perhaps you should add 2.5 to the version list so one does not assume 2.4
is the latest when one sees the available versions in bugzilla.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/4067] possible problem in sigaction resulting into segfault
  2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
                   ` (3 preceding siblings ...)
  2007-02-17 19:40 ` nico-linux-glibc at schottelius dot org
@ 2007-02-17 19:54 ` nico-linux-glibc at schottelius dot org
  2007-02-17 21:51 ` drepper at redhat dot com
  2007-02-18  1:02 ` nico-linux-glibc at schottelius dot org
  6 siblings, 0 replies; 8+ messages in thread
From: nico-linux-glibc at schottelius dot org @ 2007-02-17 19:54 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From nico-linux-glibc at schottelius dot org  2007-02-17 19:53 -------
Sorry, used the wrong version with initialized flags. glibc-2.5 also segfaults,
if sa.flags is uninitialized. Use this code to reproduce:

---------------------------
   struct sigaction sa;
   
   if(action == ACT_SERV) {
      sa.sa_handler  = sig_child;
//      sa.sa_flags    = SA_NOCLDSTOP; 
   } else {
      sa.sa_handler=SIG_DFL;
//      sa.sa_flags    = 0;
   }
//   sigemptyset(&sa.sa_mask);

   sigaction(SIGCHLD,&sa,NULL);     /* what todo when a child exited    */

---------------------------

And then fork() away and tada: segfault _after_ the sigchild handler exits.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|VERIFIED                    |REOPENED
         Resolution|FIXED                       |


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/4067] possible problem in sigaction resulting into segfault
  2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
                   ` (4 preceding siblings ...)
  2007-02-17 19:54 ` nico-linux-glibc at schottelius dot org
@ 2007-02-17 21:51 ` drepper at redhat dot com
  2007-02-18  1:02 ` nico-linux-glibc at schottelius dot org
  6 siblings, 0 replies; 8+ messages in thread
From: drepper at redhat dot com @ 2007-02-17 21:51 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-02-17 21:51 -------
What do you expect if you pass uninitialized data?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/4067] possible problem in sigaction resulting into segfault
  2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
                   ` (5 preceding siblings ...)
  2007-02-17 21:51 ` drepper at redhat dot com
@ 2007-02-18  1:02 ` nico-linux-glibc at schottelius dot org
  6 siblings, 0 replies; 8+ messages in thread
From: nico-linux-glibc at schottelius dot org @ 2007-02-18  1:02 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From nico-linux-glibc at schottelius dot org  2007-02-18 01:02 -------
I expect sigaction to return an error or to ignore invalid setting, not silently
to accept the input.

I am wondering, how an unintialised integer that simply sets flags makes glibc
to segfault.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=4067

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-02-18  1:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-16 22:36 [Bug libc/4067] New: possible problem in sigaction resulting into segfault nico-linux-glibc at schottelius dot org
2007-02-16 22:52 ` [Bug libc/4067] " drepper at redhat dot com
2007-02-17 16:38 ` nico-linux-glibc at schottelius dot org
2007-02-17 18:14 ` drepper at redhat dot com
2007-02-17 19:40 ` nico-linux-glibc at schottelius dot org
2007-02-17 19:54 ` nico-linux-glibc at schottelius dot org
2007-02-17 21:51 ` drepper at redhat dot com
2007-02-18  1:02 ` nico-linux-glibc at schottelius dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).