[Xquartz-dev] Re: xauth bus error

Jeremy Huddleston jeremyhu at berkeley.edu
Thu Jan 10 20:55:58 PST 2008


So actually, I traced it back to duplicate entries appearing as a  
result of get_address_info()... and that seems to be coming from OSX's  
getaddrinfo() returning the duplicate entry:

Is this a bug in getaddrinfo()?  Should it not be returning  
duplicates?  I don't see in the documentation anywhere that it  
guarantees uniqueness... so I'm going to try whipping together a patch  
to get_address_info() which prevents the duplicates from being passed  
on to the caller of get_address_info()... hopefully that will solve  
our problem.

(gdb) n
296	        if (getaddrinfo(host,NULL,&hints,&firstai) !=0) return NULL;
(gdb) n
297		for (ai = firstai; ai != NULL; ai = ai->ai_next) {
(gdb) print *firstai
$1 = {
   ai_flags = 0,
   ai_family = 30,
   ai_socktype = 1,
   ai_protocol = 6,
   ai_addrlen = 28,
   ai_canonname = 0x0,
   ai_addr = 0x3003e0,
   ai_next = 0x300400
}
(gdb) print *firstai->ai_next
$2 = {
   ai_flags = 0,
   ai_family = 30,
   ai_socktype = 1,
   ai_protocol = 6,
   ai_addrlen = 28,
   ai_canonname = 0x0,
   ai_addr = 0x300420,
   ai_next = 0x300440
}
(gdb) print *firstai->ai_next->ai_next
$3 = {
   ai_flags = 0,
   ai_family = 2,
   ai_socktype = 1,
   ai_protocol = 6,
   ai_addrlen = 16,
   ai_canonname = 0x0,
   ai_addr = 0x3004a0,
   ai_next = 0x0
}
(gdb) print *firstai->ai_addr
$4 = {
   sa_len = 28 '\034',
   sa_family = 30 '\036',
   sa_data = '\0' <repeats 13 times>
}
(gdb) print *firstai->ai_next->ai_addr
$5 = {
   sa_len = 28 '\034',
   sa_family = 30 '\036',
   sa_data = '\0' <repeats 13 times>
}
(gdb)





On Jan 10, 2008, at 20:25, Jeremy Huddleston wrote:

> Ok,
>
> I've put together a summary of most of my debugging here: http://trac.macosforge.org/projects/xquartz/ticket/44
>
> I've narrowed it down to one oddity, and I'm getting to a point  
> where I want to take a break for a while... so I'll probably try  
> working on this tomorrow unless someone else finishes up where I  
> started... and hopefully someone with more experience with xauth  
> will chime in (hence the CC to xorg@).
>
> Basically, OSX's /etc/hosts file has three localhost entries:
>
> 127.0.0.1	localhost
> ::1             localhost
> fe80::1%lo0	localhost
>
> Commenting out that last one causes our problem to go away, but  
> that's not good enough.  It should work!  So here's the main thing I  
> noticed:
>
> Doing xauth add localhost:0 before :0 causes two ipv6 xauth entries  
> to be created for localhost and one ipv4 entry (presumably this is  
> somehow one for each line in /etc/hosts as commenting out the last  
> localhost line in /etc/hosts causes one less ipv6 entry).  If we did  
> the add :0 before localhost:0, then the localhost:0 addition would  
> add just one ipv4 entry and one ipv6 entry (even with the last /etc/ 
> hosts line present).
>
> Then doing the 'xauth remove localhost:0', I noticed that we called  
> remove_entry() attempting to remove the ipv6 entry twice (even  
> though there was only one in the list when doing the :0 add before  
> the localhost:0 add).  If we did the localhost:0 add first, there  
> would be a second ipv6 entry to remove, so it wouldn't crash.
>
> So... a few questions for someone on xorg at l.f.o who can hopefully  
> help me out here:
>
> 1) Why is the second ipv6 entry being added at all?  It seems like  
> it should only be added once.  So why is it behaving that way in one  
> ordering of adds and not the other?
>
> 2) Why is remove_entry() being called a second time with the ipv6  
> auth removal even when there is only one matching auth in the list.   
> Looking at iterdpy(), I don't see why that should be happening as it  
> iterates over the same list being removed from.
>
>
>
> On Jan 10, 2008, at 14:22, Jeremy Huddleston wrote:
>
>> Ok, I can finally reproduce it (without /etc/hostconfig settings  
>> or /etc/hosts settings) via:
>>
>> ~ $ xauth add :0 MIT-MAGIC-COOKIE-1 ce234f956a2ddef8eb2d94fb9bd6af81
>> ~ $ xauth add localhost:0 MIT-MAGIC-COOKIE-1  
>> ce234f956a2ddef8eb2d94fb9bd6af81
>> ~ $ xauth remove localhost:0
>> Bus error
>>
>> ---
>>
>> This works:
>> ~ $ xauth add localhost:0 MIT-MAGIC-COOKIE-1  
>> ce234f956a2ddef8eb2d94fb9bd6af81
>> ~ $ xauth remove localhost:0
>>
>> ---
>>
>> And the sequence causing the bus error seems to work fine on linux.
>>
>> Thanks,
>> Jeremy
>>
>> On Jan 10, 2008, at 13:56, John Koren wrote:
>>
>>> Just 'jnlt'. In my /etc/hosts I have '127.0.0.1       localhost  
>>> jnlt'.
>>>
>>> -John
>>>
>>> On Jan 10, 2008 1:42 PM, Jeremy Huddleston <  
>>> jeremyhu at berkeley.edu> wrote:
>>> BTW, what was the entry in /etc/hostconfig?  Was it a fully  
>>> qualified
>>> domain name? Or just 'jnlt'?
>> _______________________________________________
>> Xquartz-dev mailing list
>> Xquartz-dev at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo/xquartz-dev
>
> _______________________________________________
> Xquartz-dev mailing list
> Xquartz-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/xquartz-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3040 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg/attachments/20080110/09e5c39a/attachment.bin>


More information about the xorg mailing list