landlock: Change landlock_restrict_self(2) check ordering
authorMickaël Salaün <mic@digikod.net>
Fri, 6 May 2022 16:08:19 +0000 (18:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:26:23 +0000 (10:26 +0200)
commitfdb4aef066ff3799583e71293f724ad9455367c8
tree65096c834c73b1161461c51beea039168a889131
parentd0b8bd16781ad35aec4cfbd9b19564012567a0e3
landlock: Change landlock_restrict_self(2) check ordering

commit eba39ca4b155c54adf471a69e91799cc1727873f upstream.

According to the Landlock goal to be a security feature available to
unprivileges processes, it makes more sense to first check for
no_new_privs before checking anything else (i.e. syscall arguments).

Merge inval_fd_enforce and unpriv_enforce_without_no_new_privs tests
into the new restrict_self_checks_ordering.  This is similar to the
previous commit checking other syscalls.

Link: https://lore.kernel.org/r/20220506160820.524344-10-mic@digikod.net
Cc: stable@vger.kernel.org
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
security/landlock/syscalls.c
tools/testing/selftests/landlock/base_test.c