public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Maurides <stud1313@di.uoa.gr>
To: linux-kernel@vger.kernel.org
Subject: 2.6.x signal handler bug
Date: Sat, 26 Jun 2004 02:56:51 +0300	[thread overview]
Message-ID: <40DCBBC3.2010308@di.uoa.gr> (raw)

The bug has been reproduced successfully using the following program
on kernel 2.6.5 and 2.6.7, and probably affects any other 2.6 kernel.

Kernel 2.4 produce the correct behavior, an endless loop of handled 
signals, but on kernel 2.6 the program segfaults.

#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>

volatile int len;
volatile int real;
volatile int caught;
jmp_buf env;

void catcher(int sig){
    signal(SIGSEGV,catcher);
    printf("requested: %9d malloced: %9d\n",len,real);
    longjmp(env, 1);
}

int main(){
    char* p=0;
    len = 0;
    signal(SIGSEGV,catcher);

    setjmp(env);
    len++;
    free(p);
    p = malloc(len);
    real = 0;
    while(1){
        p[real] = 0;
        real++;
    }
    return 0;
}

PS. I'm not subscribed to this list, so please include me in the cc


             reply	other threads:[~2004-06-25 23:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-25 23:56 Paul Maurides [this message]
2004-06-26  0:07 ` 2.6.x signal handler bug Andrew Morton
2004-06-26  1:33 ` David Wagner
2004-06-28 21:56 ` Jörn Engel
  -- strict thread matches above, loose matches on Subject: below --
2004-06-26 14:33 Steve G
2004-06-26 16:05 ` Davide Libenzi
2004-06-27 22:16   ` Andries Brouwer
2004-06-27 22:45     ` Davide Libenzi
2004-06-27 22:51       ` Davide Libenzi
2004-06-28  2:01         ` Steve G
2004-06-28 11:26         ` Steve G
2004-06-28 14:56           ` Davide Libenzi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40DCBBC3.2010308@di.uoa.gr \
    --to=stud1313@di.uoa.gr \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox