public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "sam at gentoo dot org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug nss/28752] New: Segfault in getpwuid when stat fails Date: Thu, 06 Jan 2022 18:30:52 +0000 [thread overview] Message-ID: <bug-28752-131@http.sourceware.org/bugzilla/> (raw) https://sourceware.org/bugzilla/show_bug.cgi?id=28752 Bug ID: 28752 Summary: Segfault in getpwuid when stat fails Product: glibc Version: 2.34 Status: NEW Severity: normal Priority: P2 Component: nss Assignee: unassigned at sourceware dot org Reporter: sam at gentoo dot org Target Milestone: --- Created attachment 13894 --> https://sourceware.org/bugzilla/attachment.cgi?id=13894&action=edit reproducer-seccomp.c Originally reported in Gentoo: https://bugs.gentoo.org/828070 Discussed on libc-help here: https://sourceware.org/pipermail/libc-help/2021-December/006061.html glib compiled with FAM support ends up crashing Firefox. Andreas Fink did some substantial debugging and ended up finding that the issue is that stat (in nss_database_check_reload_and_get) may fail when e.g. newfstatat is forbidden by a seccomp filter. I've attached Andreas' reproducer here. Needs to be linked against libseccomp. azanella had a simple patch which works for me: ``` diff --git a/nss/nss_database.c b/nss/nss_database.c index d56c5b798d..24e34213cd 100644 --- a/nss/nss_database.c +++ b/nss/nss_database.c @@ -424,10 +424,11 @@ nss_database_check_reload_and_get (struct nss_database_state *local, 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 very unlikely things not happening at the same time. */ - if (__stat64_time64 ("/", &str) != 0 - || (local->root_ino != 0 - && (str.st_ino != local->root_ino - || str.st_dev != local->root_dev))) + if (__stat64_time64 ("/", &str) != 0) + return false; + + if (local->root_ino != 0 && (str.st_ino != local->root_ino + || str.st_dev != local->root_dev)) { /* Change detected; disable reloading and return current state. */ atomic_store_release (&local->data.reload_disabled, 1); ``` -- You are receiving this mail because: You are on the CC list for the bug.
next reply other threads:[~2022-01-06 18:30 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-06 18:30 sam at gentoo dot org [this message] 2022-01-07 9:56 ` [Bug nss/28752] " fweimer at redhat dot com 2022-03-14 17:04 ` sam at gentoo dot org 2022-05-19 12:34 ` fweimer at redhat dot com 2022-06-09 5:34 ` sam at gentoo dot org 2022-06-09 5:35 ` sam at gentoo dot org 2022-06-19 2:18 ` sam at gentoo dot org 2022-06-19 2:19 ` sam at gentoo dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-28752-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).