nss: Protect against errno changes in function lookup (bug 28953)
authorFlorian Weimer <fweimer@redhat.com>
Fri, 11 Mar 2022 07:23:56 +0000 (08:23 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Fri, 11 Mar 2022 07:24:19 +0000 (08:24 +0100)
commit9bdf92c79d63b42f931101bb6df87129c408b0c4
tree7efd60fdfd80e687502c0bb1c7b511010153e7a4
parentaefc79ab5ad4bb9feea2876720cec70dca7cd8ed
nss: Protect against errno changes in function lookup (bug 28953)

dlopen may clobber errno.  The nss_test_errno module uses an ELF
constructor to achieve that, but there could be internal errors
during dlopen that cause this, too.  Therefore, the NSS framework
has to guard against such errno clobbers.

__nss_module_get_function is currently the only function that calls
__nss_module_load, so it is sufficient to save and restore errno
around this call.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
nss/Makefile
nss/nss_module.c
nss/nss_test_errno.c [new file with mode: 0644]
nss/tst-nss-test_errno.c [new file with mode: 0644]