Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: [netbsd-9] src/lib/libc/resolv



Module Name:    src
Committed By:   martin
Date:           Tue Oct  5 11:06:58 UTC 2021

Modified Files:
        src/lib/libc/resolv [netbsd-9]: res_init.c res_private.h

Log Message:
Pull up following revision(s) (requested by christos in ticket #1356):

        lib/libc/resolv/res_init.c: revision 1.32
        lib/libc/resolv/res_private.h: revision 1.4

kqueue(2) file descriptors are not inherited across fork(2). A
process that that calls getaddrinfo(3) will end up cacheing the
kqueue(2) file descriptor in its res_state structure. If that
process fork(2)s and calls getaddrinfo(3) again might end up closing
that cached file descriptor which can end up pointing to a different
file object than the kqueue(2) original one. To fix this, associate
the kqueue(2) file descriptor with the process id that created it,
and don't close(2) it if it is being closed from a different process.

An alternative fix would be to attach the resolver to a fork(2) hook
to cleanup the res_state, but handling it internally in the resolver
is less intrusive. This was discovered by Dima Veselov when using
the FreeRADIUS package.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.14.1 src/lib/libc/resolv/res_init.c
cvs rdiff -u -r1.3 -r1.3.48.1 src/lib/libc/resolv/res_private.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index