This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Create more sockets with SOCK_CLOEXEC [BZ #15722]
On 18/04/2017 17:09, Florian Weimer wrote:
> On 04/18/2017 09:53 PM, Adhemerval Zanella wrote:
>> LGTM. So I presume this patch covers all the internal sockets (as described
>> in the patch), correct?
>
> As described in the bug? Unfortunately not. There are some holdouts in nss_nis, which may require some new (internal) Sun RPC interfaces, or a little bit of code duplication to create the socket within nss_nis instead. I didn't include that in this patch because these changes will be less obviously correct.
Right, so I think we can't close this bug yet then.
>> On 18/04/2017 15:40, Florian Weimer wrote:
>>> 2017-04-18 Florian Weimer <fweimer@redhat.com>
>>>
>>> [BZ #15722]
>>> * resolv/res_hconf.c (_res_hconf_reorder_addrs): Create socket
>>> with SOCK_CLOEXEC.
>>> * resolv/res_send.c (send_vc, reopen): Likewise.
>>> * sysdeps/posix/getaddrinfo.c (getaddrinfo): Likewise.
>>> * sysdeps/unix/sysv/linux/check_native.c (__check_native):
>>> Likewise.
>>> * sysdeps/unix/sysv/linux/ifaddrs.c (__netlink_open): Likewise.
>>> * inet/rexec.c (rexec_af): Add comment.
>>> * inet/rcmd.c (rresvport_af): Likewise.
>>>
>>> diff --git a/inet/rcmd.c b/inet/rcmd.c
>>> index b7cc7a8..e43d4af 100644
>>> --- a/inet/rcmd.c
>>> +++ b/inet/rcmd.c
>>> @@ -383,6 +383,7 @@ rresvport_af (int *alport, sa_family_t family)
>>> __set_errno (EAFNOSUPPORT);
>>> return -1;
>>> }
>>> + /* NB: No SOCK_CLOXEC for backwards compatibility. */
>>
>> Why maintaining backwards is important in this situation?
>
> It's a legacy interface, so I don't think it's worth introducing a compat symbol and switch to O_CLOEXEC for these descriptors. The file descriptor is returned to the caller.
>
Right, it makes sense.
> Thanks,
> Florian