]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/landlock: Test abstract UNIX socket scoping
authorTahera Fahimi <fahimitahera@gmail.com>
Thu, 5 Sep 2024 00:13:57 +0000 (18:13 -0600)
committerMickaël Salaün <mic@digikod.net>
Mon, 16 Sep 2024 21:50:48 +0000 (23:50 +0200)
commitfefcf0f7cf470845b3675286c298484a056a7b13
treea6ea8946ce7133db10228a881fc59983db7da2f9
parent5b6b63cd64bbaf9894e799b198cb4562733cab03
selftests/landlock: Test abstract UNIX socket scoping

Add three tests that examine different scenarios for abstract UNIX
socket:

1) scoped_domains: Base tests of the abstract socket scoping mechanism
   for a landlocked process, same as the ptrace test.

2) scoped_vs_unscoped: Generates three processes with different domains
   and tests if a process with a non-scoped domain can connect to other
   processes.

3) outside_socket: Since the socket's creator credentials are used
   for scoping sockets, this test examines the cases where the socket's
   credentials are different from the process using it.

Move protocol_variant, service_fixture, and sys_gettid() from net_test.c
to common.h, and factor out code into a new set_unix_address() helper.

Signed-off-by: Tahera Fahimi <fahimitahera@gmail.com>
Link: https://lore.kernel.org/r/9321c3d3bcd9212ceb4b50693e29349f8d625e16.1725494372.git.fahimitahera@gmail.com
[mic: Fix commit message, remove useless clang-format tags, move
drop_caps() calls, move and rename variables, rename variants, use more
EXPECT, improve comments, simplify the outside_socket test]
Signed-off-by: Mickaël Salaün <mic@digikod.net>
tools/testing/selftests/landlock/common.h
tools/testing/selftests/landlock/net_test.c
tools/testing/selftests/landlock/scoped_abstract_unix_test.c [new file with mode: 0644]
tools/testing/selftests/landlock/scoped_base_variants.h [new file with mode: 0644]
tools/testing/selftests/landlock/scoped_common.h [new file with mode: 0644]
tools/testing/selftests/landlock/scoped_multiple_domain_variants.h [new file with mode: 0644]