pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/48500: lang/perl5 cause an unaligned access exception.
>Number: 48500
>Category: pkg
>Synopsis: lang/perl5 cause an unaligned access exception.
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jan 05 01:35:00 +0000 2014
>Originator: nullnilaki
>Release: pkgsrc-2013Q3
>Organization:
Japan
>Environment:
$ uname -a
NetBSD 6.99.28 NetBSD 6.99.28 (GENERIC-$Revision: 1.356 $) #28: Sat Jan 4
05:40:46 JST 2014
naruaki@NetBSD:/usr/current/obj.alpha/sys/arch/alpha/compile/GENERIC alpha
$ uname -a
NetBSD 6.1.2 NetBSD 6.1.2 (GENERIC-$Revision: 1.343 $) #13: Sat Dec 7
08:25:52 JST 2013
naruaki@NetBSD:/usr/netbsd_6_1_2/obj.alpha/sys/arch/alpha/compile/GENERIC alpha
>Description:
scope.c cause an unaligned access exception.
----------------------------------------------------------------
Please read the perl-bug
https://rt.perl.org/Public/Bug/Display.html?id=120888
----------------------------------------------------------------
gcc4.5 and gcc4.7 cause this problem.
(I can not compile gcc4.6 and gcc4.8 but I think gcc4.6 and gcc4.8 has some
kind of similar bug.)
----------------------------------------------------------------
-O works around, and there is a report that -O2 -fno-tree-ter is enough.
----------------------------------------------------------------
-O2 version.
(gdb) break scope.c:1217
No source file named scope.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (scope.c:1217) pending.
(gdb) r perl.pl
Starting program: /usr/pkg/bin/perl perl.pl
[Switching to LWP 1]
Breakpoint 1, Perl_leave_scope (my_perl=0x160505000, base=<optimized out>) at
scope.c:1217
1217 *(I8*)ARG0_PTR = (I8)(uv >> 8);
(gdb) list
1212
1213 case SAVEt_I16: /* I16 reference */
1214 *(I16*)ARG0_PTR = (I16)(uv >> 8);
1215 break;
1216 case SAVEt_I8: /* I8 reference */
1217 *(I8*)ARG0_PTR = (I8)(uv >> 8);
1218 break;
1219 case SAVEt_DESTRUCTOR:
1220 (*arg1.any_dptr)(ARG0_PTR);
1221 break;
(gdb) x/10i $pc
=> 0x1601795c0 <Perl_leave_scope+3648>: extbl t5,0x1,t5
0x1601795c4 <Perl_leave_scope+3652>: ldl t0,0(s1)
0x1601795c8 <Perl_leave_scope+3656>: andnot t0,0xff,t0
0x1601795cc <Perl_leave_scope+3660>: or t5,t0,t5
0x1601795d0 <Perl_leave_scope+3664>: stl t5,0(s1)
0x1601795d4 <Perl_leave_scope+3668>: ldl t3,48(s0)
0x1601795d8 <Perl_leave_scope+3672>: ldl t0,152(s0)
0x1601795dc <Perl_leave_scope+3676>: br 0x160178800
<Perl_leave_scope+128>
0x1601795e0 <Perl_leave_scope+3680>: mov s0,a0
0x1601795e4 <Perl_leave_scope+3684>: ldq t12,-24984(gp)
(gdb) p uv
$1 = 2574
(gdb) ptype uv
type = long unsigned int
(gdb) ptype I8
type = signed char
(gdb) print /a uv
$2 = 0xa0e
(gdb) p arg0
$1 = {any_ptr = 0x1605104ee, any_i32 = 1615922414, any_iv = 5910889710, any_uv
= 5910889710, any_long = 5910889710, any_bool = 238,
any_dptr = 0x1605104ee, any_dxptr = 0x1605104ee}
(gdb) p &arg0
Address requested for identifier "arg0" which is in register $s1
(gdb) n
pid 436 (perl): unaligned access: va=0x1605104ee pc=0x1601795c4 ra=0x160179124
sp=0x1ffffc698 op=ldl
pid 436 (perl): unaligned access: va=0x1605104ee pc=0x1601795d0 ra=0x160179124
sp=0x1ffffc698 op=stl
1218 break;
1218 break;
(gdb) p uv
$1 = <optimized out>
-------------------------------------------------------------------
-O2 -fno-tree-ter version.
(gdb) break scope.c:1217
No source file named scope.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (scope.c:1217) pending.
(gdb) r perl.pl
Starting program: /usr/pkg/bin/perl perl.pl
[Switching to LWP 1]
Breakpoint 1, Perl_leave_scope (my_perl=0x160505000, base=<optimized out>) at
scope.c:1217
1217 *(I8*)ARG0_PTR = (I8)(uv >> 8);
(gdb) x/10i $pc
=> 0x160177df0 <Perl_leave_scope+3664>: extbl t5,0x1,t5
0x160177df4 <Perl_leave_scope+3668>: ldq_u t0,0(s1)
0x160177df8 <Perl_leave_scope+3672>: insbl t5,s1,t5
0x160177dfc <Perl_leave_scope+3676>: mskbl t0,s1,t0
0x160177e00 <Perl_leave_scope+3680>: or t5,t0,t5
0x160177e04 <Perl_leave_scope+3684>: stq_u t5,0(s1)
0x160177e08 <Perl_leave_scope+3688>: ldl t3,48(s0)
0x160177e0c <Perl_leave_scope+3692>: ldl t0,152(s0)
0x160177e10 <Perl_leave_scope+3696>: br 0x160177020
<Perl_leave_scope+128>
0x160177e14 <Perl_leave_scope+3700>: unop
(gdb) p uv
$1 = 2574
(gdb) ptype uv
type = long unsigned int
(gdb) ptype I8
type = signed char
(gdb) print /a uv
$2 = 0xa0e
(gdb) p arg0
$1 = {any_ptr = 0x1605104ee, any_i32 = 1615922414, any_iv = 5910889710, any_uv
= 5910889710, any_long = 5910889710, any_bool = 238,
any_dptr = 0x1605104ee, any_dxptr = 0x1605104ee}
(gdb) n
1218 break;
>How-To-Repeat:
>Fix:
Please apply this patch at pkgsrc/lang/perl5/hacks.mk
### gcc-4.*.* in NetBSD/alpha causes unaligned access exception in perl.
### -O works around, and there is a report that -O2 -fno-tree-ter is enough.
.if !empty(MACHINE_PLATFORM:MNetBSD-*-alpha) && !empty(CC_VERSION:Mgcc-4.*.*)
# XXX: is there any good way to replace the default -O2 with multiple args?
#PKG_HACKS+= optimisation
#BUILDLINK_TRANSFORM+= rename:-O[2-9]*:-O2 -fno-tree-ter
CFLAGS+=-O2 -fno-tree-ter
.endif
Home |
Main Index |
Thread Index |
Old Index