public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/12123] New: SIGBUS on strstr_sse42 due to bad alignment
@ 2010-10-14 20:42 viriketo at gmail dot com
  2010-10-14 20:43 ` [Bug libc/12123] " viriketo at gmail dot com
                   ` (24 more replies)
  0 siblings, 25 replies; 26+ messages in thread
From: viriketo at gmail dot com @ 2010-10-14 20:42 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=12123

           Summary: SIGBUS on strstr_sse42 due to bad alignment
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper.fsp@gmail.com
        ReportedBy: viriketo@gmail.com


I've been having a trouble in the dynamic loader, at some code that ends up
calling strstr(p, "SMP") (the is_system_smp() call, at
__pthread_initialize_minimal_internal), before main(), in a system capable of
sse4.2.

I am using gcc 4.5.1 with glibc 2.12.1 on GNU/Linux i686.

Here is my debugging session, starting the program 'xz' compiled with these
above:

Program received signal SIGSEGV, Segmentation fault.
0xf7f5141e in __strstr_sse42 ()
   from /nix/store/mdjakl9ywywrrz9149cs6n7yfzvb12v7-glibc-2.12.1/lib/libc.so.6
(gdb) bt
#0  0xf7f5141e in __strstr_sse42 ()
   from /nix/store/mdjakl9ywywrrz9149cs6n7yfzvb12v7-glibc-2.12.1/lib/libc.so.6
#1  0xf7fa3af0 in __pthread_initialize_minimal_internal ()
   from
/nix/store/mdjakl9ywywrrz9149cs6n7yfzvb12v7-glibc-2.12.1/lib/libpthread.so.0
#2  0xf7fa3148 in _init ()
   from
/nix/store/mdjakl9ywywrrz9149cs6n7yfzvb12v7-glibc-2.12.1/lib/libpthread.so.0
#3  0xf7fec4d4 in call_init ()
   from
/nix/store/mdjakl9ywywrrz9149cs6n7yfzvb12v7-glibc-2.12.1/lib/ld-linux.so.2
#4  0xf7fec666 in _dl_init_internal ()
   from
/nix/store/mdjakl9ywywrrz9149cs6n7yfzvb12v7-glibc-2.12.1/lib/ld-linux.so.2
#5  0xf7fdd85f in _dl_start_user ()
   from
/nix/store/mdjakl9ywywrrz9149cs6n7yfzvb12v7-glibc-2.12.1/lib/ld-linux.so.2
(gdb) disassemble 
........
0xf7f51416 <__strstr_sse42+70>: call   0xf7f51270 <__m128i_strloadu>
0xf7f5141b <__strstr_sse42+75>: mov    0xc(%ebp),%ecx
0xf7f5141e <__strstr_sse42+78>: movdqa %xmm0,-0x34(%ebp)
0xf7f51423 <__strstr_sse42+83>: cmpb   $0x0,0x1(%ecx)
0xf7f51427 <__strstr_sse42+87>: je     0xf7f51600 <__strstr_sse42+560>
0xf7f5142d <__strstr_sse42+93>: mov    %ecx,%eax
.......


Notice the segfault (SIGBUS in fact) at:
0xf7f5141e <__strstr_sse42+78>: movdqa %xmm0,-0x34(%ebp)

(gdb) print $ebp - 0x34
$4 = (void *) 0xffffce4c

See that the address is not aligned.

The strstr_sse42 code is in ./sysdeps/x86_64/multiarch/strstr.c, and I bet it
is this line (the first __m128i_strloadu call):
  __m128i frag1 = strloadu (p1);

This is a simple assignment. From
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838 I understand that gcc
supposes that the stack is aligned for every function, and the $ebp here shows
that it is not aligned.

I think the dynamic loader first functions should guarantee an aligned stack,
and it is not the case I think.

If you need more information, the bug is easy to reproduce here.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2014-06-30  7:49 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-14 20:42 [Bug libc/12123] New: SIGBUS on strstr_sse42 due to bad alignment viriketo at gmail dot com
2010-10-14 20:43 ` [Bug libc/12123] " viriketo at gmail dot com
2010-10-26  3:02 ` drepper.fsp at gmail dot com
2010-10-26  6:46 ` hjl.tools at gmail dot com
2010-10-26  7:23 ` viriketo at gmail dot com
2010-10-26  7:39 ` hjl.tools at gmail dot com
2010-10-26  7:51 ` viriketo at gmail dot com
2010-10-26  7:52 ` viriketo at gmail dot com
2010-10-26 15:12 ` schwab@linux-m68k.org
2010-10-26 16:17 ` viriketo at gmail dot com
2010-10-26 16:31 ` viriketo at gmail dot com
2010-10-26 16:49 ` viriketo at gmail dot com
2010-10-26 17:22 ` hjl.tools at gmail dot com
2010-10-26 17:24 ` viriketo at gmail dot com
2010-10-26 17:37 ` jakub at redhat dot com
2010-10-26 17:53 ` viriketo at gmail dot com
2010-10-27  8:25 ` schwab@linux-m68k.org
2010-10-27 12:38 ` viriketo at gmail dot com
2010-10-28 15:42 ` throctukes at gmail dot com
2010-10-28 19:29 ` viriketo at gmail dot com
2010-10-28 19:32 ` hjl.tools at gmail dot com
2010-10-28 20:10 ` viriketo at gmail dot com
2010-10-29 15:43 ` throctukes at gmail dot com
2010-11-01 18:42 ` drepper.fsp at gmail dot com
2010-11-01 18:51 ` viriketo at gmail dot com
2014-06-30  7:49 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).