[PATCH 2/2] resolv: Avoid duplicate query if search list contains '.' (bug 33804)
Florian Weimer
fweimer@redhat.com
Mon Mar 2 17:57:20 GMT 2026
* Carlos O'Donell:
>> I thought it was required because _THROW was used in NSS function
>> declarations (which implies attribute leaf). But the tested functions
>> do not actually have this, so I can drop the volatile. (But similar
>> constructs are used in other resolver tests, maybe also unnecessarily.)
>
> You are correct that __THROW implies __attribute__ ((__leaf__)) within the
> NSS functions, which tells the compiler they do not call back into the TUs
> definitions. They do call back though via response()? So you marked them
> volatile for that purpose? I had not considered this aspect of the
> implementation when I reviewed this, so I think you probably have to keep
> the volatile.
>
> Yes, regarding __THROW, gethostbyname, gethostbyname2, and getaddrinfo are
> all cancellation points and so are not marked __THROW, so they *can* call
> back into the caller's TU and modify data... that means volatile is not
> strictly required.
>
> Do we still consider these two distinct issues?
>
> * Remove use of volatile because none of the called functions are __THROW?
> * Addition of atomics to create synchronizes with behaviour to observe results?
Atomics are not needed because the DNS packet exchange provides
synchronization. The DNS interaction completes before the getaddrinfo
etc. calls return to the main program.
Thanks,
Florian
More information about the Libc-alpha
mailing list