selftests/landlock: Test ptrace as much as possible with Yama
authorJeff Xu <jeffxu@google.com>
Sat, 14 Jan 2023 02:03:06 +0000 (02:03 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:34:10 +0000 (09:34 +0100)
commit21477427ecb4d1862952082b2bd7a919aff1b6b7
tree9729b33ecf2780c044cd6d733dc79b8342fe32e8
parent6c51c0702815225939f464285db5ce3f575221ea
selftests/landlock: Test ptrace as much as possible with Yama

commit 8677e555f17f51321d0730b945aeb7d4b95f998f upstream.

Update ptrace tests according to all potential Yama security policies.
This is required to make such tests pass even if Yama is enabled.

Tests are not skipped but they now check both Landlock and Yama boundary
restrictions at run time to keep a maximum test coverage (i.e. positive
and negative testing).

Signed-off-by: Jeff Xu <jeffxu@google.com>
Link: https://lore.kernel.org/r/20230114020306.1407195-2-jeffxu@google.com
Cc: stable@vger.kernel.org
[mic: Add curly braces around EXPECT_EQ() to make it build, and improve
commit message]
Co-developed-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Mickaël Salaün <mic@digikod.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/testing/selftests/landlock/ptrace_test.c