mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-08 17:42:12 +03:00
nss: handle stat failure in check_reload_and_get (BZ #28752)
Skip the chroot test if the database isn't loaded
correctly (because the chroot test uses some
existing DB state).
The __stat64_time64 -> fstatat call can fail if
running under an (aggressive) seccomp filter,
like Firefox seems to use.
This manifested in a crash when using glib built
with FAM support with such a Firefox build.
Suggested-by: DJ Delorie <dj@redhat.com>
Signed-off-by: Sam James <sam@gentoo.org>
Reviewed-by: DJ Delorie <dj@redhat.com>
(cherry picked from commit ace9e3edbc
)
This commit is contained in:
@@ -420,11 +420,15 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int stat_rv = __stat64_time64 ("/", &str);
|
||||||
|
|
||||||
|
if (local->data.services[database_index] != NULL)
|
||||||
|
{
|
||||||
/* Before we reload, verify that "/" hasn't changed. We assume that
|
/* Before we reload, verify that "/" hasn't changed. We assume that
|
||||||
errors here are very unlikely, but the chance that we're entering
|
errors here are very unlikely, but the chance that we're entering
|
||||||
a container is also very unlikely, so we err on the side of both
|
a container is also very unlikely, so we err on the side of both
|
||||||
very unlikely things not happening at the same time. */
|
very unlikely things not happening at the same time. */
|
||||||
if (__stat64_time64 ("/", &str) != 0
|
if (stat_rv != 0
|
||||||
|| (local->root_ino != 0
|
|| (local->root_ino != 0
|
||||||
&& (str.st_ino != local->root_ino
|
&& (str.st_ino != local->root_ino
|
||||||
|| str.st_dev != local->root_dev)))
|
|| str.st_dev != local->root_dev)))
|
||||||
@@ -435,8 +439,13 @@ nss_database_check_reload_and_get (struct nss_database_state *local,
|
|||||||
__libc_lock_unlock (local->lock);
|
__libc_lock_unlock (local->lock);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (stat_rv == 0)
|
||||||
|
{
|
||||||
local->root_ino = str.st_ino;
|
local->root_ino = str.st_ino;
|
||||||
local->root_dev = str.st_dev;
|
local->root_dev = str.st_dev;
|
||||||
|
}
|
||||||
|
|
||||||
__libc_lock_unlock (local->lock);
|
__libc_lock_unlock (local->lock);
|
||||||
|
|
||||||
/* Avoid overwriting the global configuration until we have loaded
|
/* Avoid overwriting the global configuration until we have loaded
|
||||||
|
Reference in New Issue
Block a user