From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32236 invoked by alias); 14 Oct 2010 20:42:06 -0000 Received: (qmail 32224 invoked by uid 22791); 14 Oct 2010 20:42:05 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_DQ,TW_VD,TW_XF X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 14 Oct 2010 20:42:00 +0000 From: "viriketo at gmail dot com" To: glibc-bugs@sources.redhat.com Subject: [Bug libc/12123] New: SIGBUS on strstr_sse42 due to bad alignment X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: viriketo at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: drepper.fsp at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Thu, 14 Oct 2010 20:42:00 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2010-10/txt/msg00103.txt.bz2 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.