Bug 31922 - SIGTERM cause segfault
SIGTERM cause segfault
Status: CLOSED NOTABUG
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc (Show other bugs)
1.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-03-15 20:12 EST by Olivier Baudron
Modified: 2007-04-18 12:32 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-03-16 10:24:17 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Olivier Baudron 2001-03-15 20:12:31 EST
The following bug happens when compiling with kcc-1.1.2-40
(and not with gcc-2.96-78).

test.c:
--------------------------- cut here ---------------------------------
#include <stdio.h>
#include <signal.h>

void arret (int n) {
    int err=0;

    printf ("err=%d\n", err);
}

int main (int argc, char **argv) {
    int err[4];
    struct sigaction sig;

    sig.sa_handler = arret;
    err[0] = sigaction (SIGTERM, &sig, NULL);

    while (1);

    return 0;
}
--------------------------- cut here ---------------------------------

$ kgcc -Wall -g -o test test.c
$ ./test

Then, send SIGTERM to the process 'test'.
This one halts with: Segmentation fault

Note: The kernel is a 2.2.4, and glibc is 2.2.2-5.
Comment 1 Jakub Jelinek 2001-03-16 06:08:13 EST
Cannot reproduce it with either glibc 2.2.2-4 and 2.2.2-6, (there were no
suspicious changes in 2.2.2-5), on kernel 2.4.0.
Comment 2 Olivier Baudron 2001-03-16 08:04:59 EST
If this can help, feel free to test the "bug" on my PC:
$ ssh -l guest baud.dyndns.org
The password is 'guest'.
Files 'test.c' and 'test' are in the homedir.
Comment 3 Jakub Jelinek 2001-03-16 08:29:36 EST
The issue is that you don't have compat-glibc installed. kgcc does not require
it, since kgcc is for kernel compilation only. If you want to use it for
userland compilation, then you should install compat-egcs (and that requires
compat-glibc) and use either egcs or i386-glibc21-linux-gcc gcc drivers.
BTW: This has been revamped recently, so there is no kgcc package any longer
and egcs/kgcc/egcs++ commands in compat-* packages mean egcs 1.1.2 using
glibc 2.2.2 headers and linking against those libraries, while i386-glibc21-*
commands use glibc 2.1.x headers and link against 2.1.x libraries.
Comment 4 Olivier Baudron 2001-03-16 10:24:06 EST
In fact the testcase is very sensitive to lots of things. For example, a
different order in the declaration of variables makes it works or not. This
makes me think that something is wrong somewhere in gcc or glibc...

I found a new testcase that segfaults (on a SIGTERM signal) with gcc-2.96-78 +
glibc-2.2.2-5 + kernel-2.4.2. Would you mind testing it at RedHat or on my PC?

test.c:
--------------------------- cut here ---------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>

void arret (int n) {
    printf ("End.\n");
    exit (0);
}

int main (int argc, char **argv) {
    struct sigaction sig;
    int err;

    sig.sa_handler = arret;
    err = sigaction (SIGTERM, &sig, NULL);

    while (1);

    return 0;
}
--------------------------- cut here ---------------------------------
Comment 5 Olivier Baudron 2001-03-16 10:42:22 EST
Sorry, the bug was in the programmer (me)!

Note You need to log in before you can comment on or make changes to this bug.