summaryrefslogtreecommitdiff
path: root/gnu/tests/base.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-12-14 00:29:44 +0100
committerLudovic Courtès <ludo@gnu.org>2025-12-19 00:05:43 +0100
commit3e2bd2e30bcb183804e853b6cc611387c05712e1 (patch)
tree7a2e2d0715edfd0962dbaacbcc03237087994dc1 /gnu/tests/base.scm
parent55bf53fe92fac2b98e117b6f01fddd7db0285529 (diff)
services: nscd: Cause PID 1 to drop nscd database mappings on shutdown.
Partly fixes guix/guix#4269. Fixes a bug whereby shepherd (PID 1) could retain memory mappings for /var/run/nscd/dbXXX, which are created by glibc’s NSS from database file descriptors sent by nscd. Those mappings could then prevent ‘root-file-system’ from re-mounting the root file system as read-write. This change causes PID 1 to drop these mappings. PID 1 typically calls libc database functions such as ‘getgr’ when dealing with AF_UNIX endpoints for socket-activated services, to look up the socket’s owner and group. This is where the bug would manifest. The regression may have been introduced by 85ac164c41fc4c93d3cb2a5d3321c63598c2855f, which caused nscd to handle the password and group databases. * gnu/services/base.scm (nscd-shepherd-service): In ‘stop’ procedure, call ‘getpw’, ‘getgr’, and ‘getaddrinfo’. * gnu/tests/base.scm (run-root-unmount-test) <"open libc NSS database">: New test. (%test-root-unmount): Add #:imported-modules. Change-Id: I197cc8c82165c631f857415898137412ce9bd439 Reported-by: Rutherther <rutherther@ditigal.xyz> Signed-off-by: Ludovic Courtès <ludo@gnu.org> Merges: #4828
Diffstat (limited to 'gnu/tests/base.scm')
-rw-r--r--gnu/tests/base.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index dc51880d8ed..86fa6374efc 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -827,6 +827,18 @@ in a loop. See <http://bugs.gnu.org/26931>.")
827 ,witness-size)))))) 827 ,witness-size))))))
828 marionette)) 828 marionette))
829 829
830 ;; Cause PID 1 to create a mapping to nscd's database files.
831 ;; Those mappings used to prevent 'root-file-system' to remount
832 ;; read-only on shutdown. See
833 ;; <https://codeberg.org/guix/guix/issues/4269>.
834 (test-equal "open libc NSS database"
835 "root"
836 (marionette-eval '(begin
837 (use-modules (gnu services herd))
838 (start-service 'nscd) ;wait for nscd
839 (eval-there '(passwd:name (getgr "root"))))
840 marionette))
841
830 ;; Halt the system. 842 ;; Halt the system.
831 (marionette-eval '(system* "/run/current-system/profile/sbin/halt") 843 (marionette-eval '(system* "/run/current-system/profile/sbin/halt")
832 marionette) 844 marionette)
@@ -891,7 +903,10 @@ in a loop. See <http://bugs.gnu.org/26931>.")
891 "Make sure the root file system is cleanly unmounted when the system is 903 "Make sure the root file system is cleanly unmounted when the system is
892halted.") 904halted.")
893 (value 905 (value
894 (let ((os (marionette-operating-system %simple-os))) 906 (let ((os (marionette-operating-system
907 %simple-os
908 #:imported-modules '((gnu services herd)
909 (guix combinators)))))
895 (run-root-unmount-test os))))) 910 (run-root-unmount-test os)))))
896 911
897 912