Bug 157584 - Second SIGFPE is missed
Second SIGFPE is missed
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
3
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Roland McGrath
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-05-12 16:51 EDT by djm
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-18 00:42:24 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
C source code (457 bytes, text/plain)
2005-05-12 16:51 EDT, djm
no flags Details

  None (edit)
Description djm 2005-05-12 16:51:32 EDT
Description of problem:
I'm trying to catch SIGFPE when generated by an integer divide by 0 exception.
The first is caught and handled by my handler sucessfully.  The second
is handled by the kernel and never passed to my handler.

Version-Release number of selected component (if applicable):
I've tried this on FC2, FC3, and FC4T3 (all X86_64).  It works fine on RH73.

How reproducible:
Always.

Steps to Reproduce:
1. g++ -o t t.c
2. ./t
  
Actual results:
SIGFPE caught 1 of 2
Floating exception

Expected results: (from RH73)
SIGFPE caught 1 of 2
SIGFPE caught 2 of 2

Additional info:
source code
---------------------- CUT HERE ----------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <float.h>
#include <setjmp.h>

typedef void (*fptr)(int);

jmp_buf env;

void Catcher(int arg1) {
    static int count=1;
    printf("SIGFPE caught %d of 2\n", count++);
    longjmp(env,1);
}

void run_test(int a, int b) {
    signal(SIGFPE, (fptr)Catcher);
    if (setjmp(env)==0) {
        int c = a/b;
    }
}

int main (int argc, char** argv) {
    run_test(1,0);
    run_test(2,0);
}
Comment 1 djm 2005-05-12 16:51:32 EDT
Created attachment 114313 [details]
C source code
Comment 2 Roland McGrath 2005-05-18 00:42:24 EDT
The program should use sigsetjmp and siglongjmp.
Using plain longjmp to leave a signal handler leaves signals blocked.

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