pack: Relocatable wrapper leaves root available to child processes.
authorLudovic Courtès <ludo@gnu.org>
Sat, 31 Oct 2020 22:02:33 +0000 (23:02 +0100)
committerLudovic Courtès <ludo@gnu.org>
Sat, 31 Oct 2020 22:16:43 +0000 (23:16 +0100)
commitbfe82fe2f6e9f34c0774fe2114cdc7e937ba8bd2
tree5140552cb16dc6a5eb611054a2b44023e259fdf6
parent95460da83b6ffd2bf3b96b3ab7cd302ab76be38a
pack: Relocatable wrapper leaves root available to child processes.

Fixes <https://bugs.gnu.org/44261>.
Reported by Jan Nieuwenhuizen <janneke@gnu.org>.

* gnu/packages/aux-files/run-in-namespace.c (exec_in_user_namespace):
Add call to 'prctl'.  Call 'mount' for NEW_ROOT and define 'is_tmpfs'.
When IS_TMPFS is true, call 'umount' and 'rmdir' after 'waitpid';
otherwise, call 'rm_rf' only when 'waitpid' returns -1 the second time.
(exec_with_loader): Call 'prctl'.  Remove NEW_ROOT only when 'waitpid'
returns -1 the second time, otherwise leave it behind.
* tests/guix-pack-relocatable.sh (wait_for_file): New function.
Add test.
gnu/packages/aux-files/run-in-namespace.c
tests/guix-pack-relocatable.sh