[Bug libgcc/57405] New: Using printf in signal handler with alternate stack generates a SIGSEGV

2013-05-24 Thread jkf at research dot att.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57405

Bug ID: 57405
   Summary: Using printf in signal handler with alternate stack
generates a SIGSEGV
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libgcc
  Assignee: unassigned at gcc dot gnu.org
  Reporter: jkf at research dot att.com

Created attachment 30185
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30185&action=edit
requested bug information and gdb session showing failure

When using several printf's in a sigaction signal handler and alternate stacks
generates a SIGSEGV:
Program received signal SIGSEGV, Segmentation fault.
0x003b8ce480ac in _IO_vfprintf_internal (s=,
format=, ap=) at vfprintf.c:1641
1641  process_string_arg (((struct printf_spec *) NULL));

This is independent of the size of the alternate signal stack. I have tried it
with 4 * SIGSTKSZ and same error at same line when alternate signal stack is is
SIGSTKSZ (8k).

Attached is file with requested information and output of gdb debug session of
program execution.


[Bug libgcc/57405] Using printf in signal handler with alternate stack generates a SIGSEGV

2013-05-24 Thread jkf at research dot att.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57405

--- Comment #2 from jkf  ---
Andrew,
According to POSIX the write function is allowed inside a signal handler. Since
eventually printf ends in a write(), I'm assuming it is valid. If printf()
isn't valid than please supply a list of valid libc functions from inside
signal handlers. 

Jeff Fellin

-Original Message-
From: pinskia at gcc dot gnu.org [mailto:gcc-bugzi...@gcc.gnu.org] 
Sent: Friday, May 24, 2013 16:54
To: FELLIN, JEFFREY K (JEFF)
Subject: [Bug libgcc/57405] Using printf in signal handler with alternate stack
generates a SIGSEGV

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57405

Andrew Pinski  changed:

   What|Removed |Added

Version|unknown |4.4.7

--- Comment #1 from Andrew Pinski  --- Is calling
printf a valid thing to do inside this signal handler?

Also can you try a newer compiler 4.4.7 is no longer supported.  Since you are
using a redhat supplied GCC, you really should reporting it to them.

--
You are receiving this mail because:
You reported the bug.


[Bug libgcc/57405] Using printf in signal handler with alternate stack generates a SIGSEGV

2013-05-24 Thread jkf at research dot att.com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57405

--- Comment #4 from jkf  ---
Andrew,
BTW, if I only use the printf("act_handler sig %d addr=%p base=%p end=%p\n",
sig, add, &alt_stack[0], alt_top);

There is no SIGSEGV during execution.

So, I don't believe it a hard rule the printf is not allowed in signal
handlers.

Jeff Fellin

-Original Message-
From: pinskia at gcc dot gnu.org [mailto:gcc-bugzi...@gcc.gnu.org] 
Sent: Friday, May 24, 2013 16:54
To: FELLIN, JEFFREY K (JEFF)
Subject: [Bug libgcc/57405] Using printf in signal handler with alternate stack
generates a SIGSEGV

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57405

Andrew Pinski  changed:

   What|Removed |Added

Version|unknown |4.4.7

--- Comment #1 from Andrew Pinski  --- Is calling
printf a valid thing to do inside this signal handler?

Also can you try a newer compiler 4.4.7 is no longer supported.  Since you are
using a redhat supplied GCC, you really should reporting it to them.

--
You are receiving this mail because:
You reported the bug.