linux: Fail as unsupported if personality call is filtered
commitd4963a844dc72c4ac14da3395cf511f3d191d689
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 2 Jun 2023 13:19:48 +0000 (2 10:19 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 5 Jun 2023 15:51:48 +0000 (5 12:51 -0300)
tree778fbfbccffc7d09bd4ead257f90405d7692bff0
parentbe9b883ddd12acd2baa517fd1b5b8c8be22f733a
linux: Fail as unsupported if personality call is filtered

Container management default seccomp filter [1] only accepts
personality(2) with PER_LINUX, (0x0), UNAME26 (0x20000),
PER_LINUX32 (0x8), UNAME26 | PER_LINUX32, and 0xffffffff (to query
current personality)

Although the documentation only state it is blocked to prevent
'enabling BSD emulation' (PER_BSD, not implemented by Linux), checking
on repository log the real reason is to block ASLR disable flag
(ADDR_NO_RANDOMIZE) and other poorly support emulations.

So handle EPERM and fail as UNSUPPORTED if we can really check for
BZ#19408.

Checked on aarch64-linux-gnu.

[1] https://github.com/moby/moby/blob/master/profiles/seccomp/default.json

Reviewed-by: Florian Weimer <fweimer@redhat.com>
sysdeps/unix/sysv/linux/tst-personality.c