diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2022-09-12 22:24:02 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2022-09-13 05:31:51 +0200 |
commit | 5d3b50c1006590c4b5aab7339203880caa8f2525 (patch) | |
tree | a4eaa005dfa263b5a4bebad13033ac3ef01faee7 /test/lib/term | |
parent | 80d7012b09cddbf6b8bb0d002af5f4645ad5c450 (diff) | |
download | passt-5d3b50c1006590c4b5aab7339203880caa8f2525.tar passt-5d3b50c1006590c4b5aab7339203880caa8f2525.tar.gz passt-5d3b50c1006590c4b5aab7339203880caa8f2525.tar.bz2 passt-5d3b50c1006590c4b5aab7339203880caa8f2525.tar.lz passt-5d3b50c1006590c4b5aab7339203880caa8f2525.tar.xz passt-5d3b50c1006590c4b5aab7339203880caa8f2525.tar.zst passt-5d3b50c1006590c4b5aab7339203880caa8f2525.zip |
Safer handling if we can't open /proc/self/uid_map
passt is allowed to run as "root" (UID 0) in a user namespace, but notas
real root in the init namespace. We read /proc/self/uid_map to determine
if we're in the init namespace or not.
If we're unable to open /proc/self/uid_map we assume we're ok and
continue running as UID 0. This seems unwise. The only instances I
can think of where uid_map won't be available are if the host kernel
doesn't support namespaces, or /proc is not mounted. In neither case
is it safe to assume we're "not really" root and continue (although in
practice we'd likely fail for other reasons pretty soon anyway).
Therefore, fail with an error in this case, instead of carrying on.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'test/lib/term')
0 files changed, 0 insertions, 0 deletions