glibc/glibc-upstream-2.33-1.patch
DistroBaker c0a7313e92 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/glibc.git#40ad858c64f2a5eb509c81e29d63a1ad65c86256
2021-02-19 18:21:03 +00:00

43 lines
1.4 KiB
Diff

commit 17f0ff097887008b2d3dca270c8ffbb4b43a8749
Author: Sergei Trofimovich <slyfox@gentoo.org>
Date: Fri Feb 5 07:32:18 2021 +0000
nsswitch: return result when nss database is locked [BZ #27343]
Before the change nss_database_check_reload_and_get() did not populate
the '*result' value when it returned success in a case of chroot
detection. This caused initgroups() to use garage pointer in the
following test (extracted from unbound):
```
int main() {
// load some NSS modules
struct passwd * pw = getpwnam("root");
chdir("/tmp");
chroot("/tmp");
chdir("/");
// access nsswitch.conf in a chroot
initgroups("root", 0);
}
```
Reviewed-by: DJ Delorie <dj@redhat.com>
diff --git a/nss/nss_database.c b/nss/nss_database.c
index cf0306adc47f12d9..e1bef6bd75ce0160 100644
--- a/nss/nss_database.c
+++ b/nss/nss_database.c
@@ -398,8 +398,9 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
&& (str.st_ino != local->root_ino
|| str.st_dev != local->root_dev)))
{
- /* Change detected; disable reloading. */
+ /* Change detected; disable reloading and return current state. */
atomic_store_release (&local->data.reload_disabled, 1);
+ *result = local->data.services[database_index];
__libc_lock_unlock (local->lock);
__nss_module_disable_loading ();
return true;