Bug#595403: perl: POSIX::sigaction breakage on armel

Niko Tyni ntyni at debian.org
Tue Sep 14 20:20:25 UTC 2010


On Fri, Sep 10, 2010 at 02:35:54PM +0300, Niko Tyni wrote:
> On Fri, Sep 03, 2010 at 09:01:27PM +0300, Niko Tyni wrote:
> 
> > > As Sys::SigAction is a pure perl module, I agree the bug is most probably
> > > in POSIX::sigaction in the perl package.
> 
> Testcase:
 
#!perl
use POSIX q/sigaction/;
 
my $a1 = POSIX::SigAction->new( sub {} );
my $a2 = POSIX::SigAction->new();

sigaction(ALRM, $a1, $a2);
sigaction(ALRM, $a1, $a2);
sigaction(ALRM, $a2);

kill ALRM => $$;
__END__
 
> This results in stack corruption on agricola (haven't tried on abel):

Further inspection shows the stack corruption somehow happens between
the signal delivery and the signal handler invocation. See the gdb
session below. Returning from the sighandler makes the program crash
as the return address is smashed.

This is contrary to amd64, where the call stack looks fine all the way
through the test program.

This seems to lead into kernel or libc land, and I don't really know
how to debug it further. I'd love some help from the arm porters (cc'd).

Is there a way to trace the signal handler invocation? What kind of bug
in a program could cause this behaviour? Or is this clearly a kernel/libc
bug (which seems probable given the abel.d.o system crashes I mentioned
earlier on the list)?

Reading symbols from /home/ntyni/x/usr/bin/debugperl...done.
(gdb) handle 14 stop
Signal        Stop  Print   Pass to program Description
SIGALRM       Yes   Yes Yes     Alarm clock
(gdb) br Perl_sighandler 
Breakpoint 1 at 0xa91c0: file mg.c, line 2901.
(gdb) run ~/595403.t
Starting program: /home/ntyni/x/usr/bin/debugperl ~/595403.t
[Thread debugging using libthread_db enabled]

Program received signal SIGALRM, Alarm clock.
0x4013bf5c in kill () from /lib/libc.so.6
(gdb) bt
#0  0x4013bf5c in kill () from /lib/libc.so.6
#1  0x00150924 in Perl_apply (my_perl=0x22a008, type=<value optimized out>, mark=0x2e6cf8, sp=0x2e6cf8)
    at doio.c:1768
#2  0x00138e30 in Perl_pp_chown (my_perl=0x22a008) at pp_sys.c:3485
#3  0x000983d4 in Perl_runops_debug (my_perl=0x22a008) at dump.c:1968
#4  0x0003f5e8 in S_run_body (my_perl=<value optimized out>) at perl.c:2431
#5  perl_run (my_perl=<value optimized out>) at perl.c:2349
#6  0x0002553c in main (argc=-1098564320, argv=0x0, env=0xbe853d20) at perlmain.c:117
(gdb) c
Continuing.

Breakpoint 1, Perl_sighandler (sig=14, sip=0xe, uap=0x0) at mg.c:2901
2901    mg.c: No such file or directory.
    in mg.c
(gdb) bt
#0  Perl_sighandler (sig=14, sip=0xe, uap=0x0) at mg.c:2901
#1  0x41676952 in ?? ()
#2  0x41676952 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x41676952 in ?? ()

For the sake of completeness, here's the backtrace from Perl_sighandler
breakpoint on amd64, which looks like it should with <signal handler called>
in the call stack:

#0  Perl_sighandler (sig=14, sip=0x7fffffffe330, uap=0x7fffffffe200) at mg.c:2897
#1  <signal handler called>
#2  0x00007ffff740e447 in kill () at ../sysdeps/unix/syscall-template.S:82
#3  0x000000000056c312 in Perl_apply (my_perl=0x870010, type=<value optimized out>, mark=0x9a7a28, 
    sp=0x9a7a28) at doio.c:1768
#4  0x0000000000551191 in Perl_pp_chown (my_perl=0x870010) at pp_sys.c:3485
#5  0x000000000049b32b in Perl_runops_debug (my_perl=0x870010) at dump.c:1968
#6  0x000000000043d04f in S_run_body (my_perl=<value optimized out>) at perl.c:2431
#7  perl_run (my_perl=<value optimized out>) at perl.c:2349
#8  0x0000000000421b4c in main (argc=2, argv=0x7fffffffe988, env=0x7fffffffe9a0) at perlmain.c:117

Any help is appreciated.
-- 
Niko Tyni   ntyni at debian.org






More information about the Perl-maintainers mailing list