#2100 new defect

SIGFPE

Reported by: Sebastian Huber Owned by: Joel Sherrill
Priority: low Milestone: Indefinite
Component: score Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

A GCC test uses the following mechanic:

#include <assert.h>
#include <stdlib.h>
#include <signal.h>
#include <pthread.h>

void sigfpe(int signum)
{

exit(0);

}

int main()
{

signal(SIGFPE, sigfpe);

#ifdef rtems

sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGFPE);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);

#endif

raise(SIGFPE);

assert(0);

}

The parts in the defined(rtems) section are necessary in RTEMS to get a behaviour similar to Linux.

This is because RTEMS has a special treatment for some signals (in killinfo()):

/*

  • P1003.1c/Draft 10, p. 33 says that certain signals should always
  • be directed to the executing thread such as those caused by hardware
  • faults. */
if ( (sig == SIGFPE)
(sig == SIGILL) (sig == SIGSEGV ) )

return pthread_kill( pthread_self(), sig );

We should evaluate if this works as intended.

Change History (5)

comment:1 Changed on Mar 26, 2013 at 2:58:19 PM by Joel Sherrill

I can't tell from this example whether main() is a POSIX pthread or a Classic API task. If it is a Classic API task, all POSIX signals are masked since that tasks under that API no nothing about signals.

Assuming the BSP propagates a SIGFPE exception, if this is a pthread, then it should work.

I can't find the text that requires SIGFPE and other hardware originated signals to be directed at a thread. I found this in book:

http://books.google.com/books?id=_xvnuFzo7q0C&pg=PA216&lpg=PA216&dq=SIGFPE+thread&source=bl&ots=Kn3SYTY6Uf&sig=4tHRFIbJdjf2MVv98CuN8Y5hGuk&hl=en&sa=X&ei=-MRRUdSwIYSa9QT6pIGgDQ&ved=0CDAQ6AEwAA#v=onepage&q=SIGFPE%20thread&f=false

The question likely comes down to what the default signal mask should be for a task that is not a POSIX Thread.

comment:2 Changed on Nov 23, 2014 at 4:25:30 PM by Joel Sherrill

Description: modified (diff)

What about the code in killinfo.c simply checking that it is inside an ISR before doing that test. What do you think Sebastian?

comment:3 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

comment:4 Changed on Dec 18, 2014 at 12:26:01 PM by Sebastian Huber

Description: modified (diff)
Milestone: 4.115.0
Priority: normallow

comment:5 Changed on Aug 14, 2017 at 12:39:21 AM by Chris Johns

Milestone: 5.0Indefinite
Version: 4.11
Note: See TracTickets for help on using tickets.