XAllocID issues -- returns 0, calls geteuid, looks strange

Younes Manton younes.m at gmail.com
Sat Aug 1 17:54:54 PDT 2009


I'm having with some issues with XAllocID from libX11 1.1.5. In
certain cases it returns 0, which seems very odd when I look at the
source in XlibInt.c. Then I objdump libX11.so and I get this, which
looks like a completely different function to me:

00041970 <_XAllocID>:
   41970:       55                      push   %ebp
   41971:       89 e5                   mov    %esp,%ebp
   41973:       8b 55 08                mov    0x8(%ebp),%edx
   41976:       53                      push   %ebx
   41977:       e8 2b 1d fd ff          call   136a7 <geteuid at plt+0xcf>
   4197c:       81 c3 78 a6 0a 00       add    $0xaa678,%ebx
   41982:       8b 82 38 05 00 00       mov    0x538(%edx),%eax
   41988:       8b 48 38                mov    0x38(%eax),%ecx
   4198b:       c7 40 38 00 00 00 00    movl   $0x0,0x38(%eax)
   41992:       f6 82 94 00 00 00 08    testb  $0x8,0x94(%edx)
   41999:       75 10                   jne    419ab <_XAllocID+0x3b>
   4199b:       8b 42 7c                mov    0x7c(%edx),%eax
   4199e:       83 8a 94 00 00 00 08    orl    $0x8,0x94(%edx)
   419a5:       89 82 24 05 00 00       mov    %eax,0x524(%edx)
   419ab:       8d 83 4c 67 f5 ff       lea    -0xa98b4(%ebx),%eax
   419b1:       89 42 7c                mov    %eax,0x7c(%edx)
   419b4:       89 c8                   mov    %ecx,%eax
   419b6:       5b                      pop    %ebx
   419b7:       5d                      pop    %ebp
   419b8:       c3                      ret

Basically I call XAllocID in two functions in a shared lib that's
eventually dlopened; one instance returns !0, the other returns 0, and
I can't figure out why. I'm not calling XAllocID excessively or
anything at all, just twice in a simple test and I can confirm that in
both calls the above code gets executed, so I'm not jumping to
something else. If anyone knows what's going on I'd appreciate it.


More information about the xorg-devel mailing list