This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Segmentation fault in __ctype_init


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I build both GLIBC-s with the same configure line, but with different
compilers. What could be the source of such difference?

1) Works fine:

Dump of assembler code for function __GI___ctype_init:
   0xf7e4fe1b <+0>:	push   %ebx
   0xf7e4fe1c <+1>:	call   0xf7f51692 <__i686.get_pc_thunk.bx>
   0xf7e4fe21 <+6>:	add    $0x17c1d3,%ebx
=> 0xf7e4fe27 <+12>:	mov    -0x14c(%ebx),%eax
   0xf7e4fe2d <+18>:	mov    %gs:(%eax),%eax
   0xf7e4fe30 <+21>:	mov    (%eax),%edx
   0xf7e4fe32 <+23>:	mov    0x24(%edx),%ecx
   0xf7e4fe35 <+26>:	add    $0x100,%ecx
   0xf7e4fe3b <+32>:	mov    -0x124(%ebx),%edx
   0xf7e4fe41 <+38>:	mov    %ecx,%gs:(%edx)
   0xf7e4fe44 <+41>:	mov    (%eax),%edx
   0xf7e4fe46 <+43>:	mov    0x28(%edx),%ecx
   0xf7e4fe49 <+46>:	add    $0x200,%ecx
   0xf7e4fe4f <+52>:	mov    -0xb4(%ebx),%edx
   0xf7e4fe55 <+58>:	mov    %ecx,%gs:(%edx)
   0xf7e4fe58 <+61>:	mov    (%eax),%eax
   0xf7e4fe5a <+63>:	mov    0x30(%eax),%edx
   0xf7e4fe5d <+66>:	add    $0x200,%edx
   0xf7e4fe63 <+72>:	mov    -0x84(%ebx),%eax
   0xf7e4fe69 <+78>:	mov    %edx,%gs:(%eax)
   0xf7e4fe6c <+81>:	pop    %ebx
   0xf7e4fe6d <+82>:	ret
End of assembler dump.

2) Crashes (sigsegv)

Dump of assembler code for function __GI___ctype_init:
   0xf7e4a277 <+0>:	push   %ebx
   0xf7e4a278 <+1>:	call   0xf7f46763 <__x86.get_pc_thunk.bx>
   0xf7e4a27d <+6>:	add    $0x181d3f,%ebx
   0xf7e4a283 <+12>:	mov    -0x170(%ebx),%eax
   0xf7e4a289 <+18>:	mov    %gs:(%eax),%eax
=> 0xf7e4a28c <+21>:	mov    (%eax),%edx
   0xf7e4a28e <+23>:	mov    0x24(%edx),%ecx
   0xf7e4a291 <+26>:	add    $0x100,%ecx
   0xf7e4a297 <+32>:	mov    -0x164(%ebx),%edx
   0xf7e4a29d <+38>:	mov    %ecx,%gs:(%edx)
   0xf7e4a2a0 <+41>:	mov    (%eax),%edx
   0xf7e4a2a2 <+43>:	mov    0x28(%edx),%ecx
   0xf7e4a2a5 <+46>:	add    $0x200,%ecx
   0xf7e4a2ab <+52>:	mov    -0x15c(%ebx),%edx
   0xf7e4a2b1 <+58>:	mov    %ecx,%gs:(%edx)
   0xf7e4a2b4 <+61>:	mov    (%eax),%eax
   0xf7e4a2b6 <+63>:	mov    0x30(%eax),%edx
   0xf7e4a2b9 <+66>:	add    $0x200,%edx
   0xf7e4a2bf <+72>:	mov    -0x160(%ebx),%eax
   0xf7e4a2c5 <+78>:	mov    %edx,%gs:(%eax)
   0xf7e4a2c8 <+81>:	pop    %ebx
   0xf7e4a2c9 <+82>:	ret
End of assembler dump.

Thanks,
- - D.

On 11/15/2013 04:30 PM, Dmitry Mikushin wrote:
> 
> Dear all,
> 
> I'm encountering the following segfault when running 32-bit glibc.
> Is it a known problem?
> 
> Thanks, - D.
> 
> 0xf7e3dd7b in __GI___ctype_init () at ctype-info.c:31 31      *bp =
> (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128; 
> (gdb) bt #0  0xf7e3dd7b in __GI___ctype_init () at ctype-info.c:31 
> #1  0xf7fe97aa in call_init (l=0xf7fdacb0, argc=argc@entry=1, 
> argv=argv@entry=0xffffd0f4, env=env@entry=0xffffd0fc) at
> dl-init.c:69 #2  0xf7fe98e4 in call_init (env=0xffffd0fc,
> argv=0xffffd0f4, argc=1, l=<optimized out>) at dl-init.c:36 #3
> _dl_init (main_map=0xf7ffd900, argc=1, argv=0xffffd0f4, 
> env=0xffffd0fc) at dl-init.c:132 #4  0xf7fdb92f in _dl_start_user
> () from 
> /home/marcusmae/rpmbuild/kernelgen/head_llvm192445_i686-linux-gnu_x86_64-linux-gnu_debug/INSTALL/lib/gcc/x86_64-unknown-linux-gnu/4.8.3/32/ld-linux.so.2
>
> 
(gdb) list
> 26 27    void 28    __ctype_init (void) 29    { 30      const
> uint16_t **bp = __libc_tsd_address (const uint16_t *, CTYPE_B); 31
> *bp = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) +
> 128; 32      const int32_t **up = __libc_tsd_address (const int32_t
> *, CTYPE_TOUPPER); 33      *up = ((int32_t *) _NL_CURRENT
> (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128); 34      const int32_t **lp =
> __libc_tsd_address (const int32_t *, CTYPE_TOLOWER); 35      *lp =
> ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128);
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJShlwAAAoJENwm3+sbf/pMlXoH/iAgux8JacCnY+4x+DdbDor6
+v5MfAQ6rHWQId2DJs4xHsqr25hGKCSzFuLz5kParRt7MnUBrCe5IaGIr6HQy8jW
H9l8FvAxtGgcGj067y0H/7WRzsg7OrjVI6TEm4vCrXnlSwKL75ScVn7n5zaMTcdc
DgXYuhvvq/iY9TbIvpskoDDB8YjUqQH6mIbruAw759tcv8ExjIgTIn9USy2X0Y1v
PGujyL8SjugPcNuepNDr4pTKgUaId2LPxk3CWY/oIt4FBz/s9+sKlijcPmc+JhCK
IUo150WcXUeir5VyEHPs/0WiCbXD7prGvNiKAlqSo+oTFkT4ZLAr+OGw9qwnZJY=
=7nPa
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]