Thread (56 messages) 56 messages, 2 authors, 3d ago

[PATCH 00/27] landlock: Selftest fixes and cleanups

flat view
WARM3d

From: Günther Noack <hidden>
Date: 2026-10-08 14:26:45
Also in: linux-kselftest

A collection of Landlock Selftest fixes
=======================================

This patch set is bundled together to be slightly less spammy,
but the patches are mostly independent.  The commits are ordered
such that the simpler and more orthogonal patches come earlier.

The patch set is LLM-assisted (and that turned out to be very useful
for spotting errors).  Needless to say, I have verified all commits by
hand, and reworked them where necessary.

The last few patches are a bit more cross-cutting and probably more
prone to merge conflicts, as they correct cases where we have been
using EXPECT and ASSERT in the wrong way (details in the commit
messages).  I believe that the rationale for each of these is
reasonable, but I am happy to discuss.

Motivation
==========

LLMs (and humans ;-)) have an unfortunate tendency to pick up and
replicate bad coding style patterns, so I hope that a broader cleanup
of the test style will avoid this spreading further.


When applying this patch set, please base it on a branch that has Wang
Yan's snprintf() patch in it [1], which I also support as a selftest
cleanup.

–Günther

[1] https://lore.kernel.org/all/20260626070016.61049-1-wangyan01@kylinos.cn/ (local)

Günther Noack (27):
  selftests/landlock: Propagate grandchild failures in unix_scoping
  selftests/landlock: Propagate EXPECT failures from forked children
  selftests/landlock: Check the thread result in audit.thread
  selftests/landlock: Zero-initialize the buffer in inconsistent_attr
  selftests/landlock: Fix the openat() success check in fs_bench
  selftests/landlock: Fix the reported clock tick rate in fs_bench
  selftests/landlock: Fix the ruleset_fd check in empty_or_same_ruleset
  selftests/landlock: Handle a missing control message in recv_fd()
  selftests/landlock: Assert tracefs_extract_field() results that are
    used
  selftests/landlock: Assert audit initialization in fixture setups
  selftests/landlock: Assert helper results that are used afterwards
  selftests/landlock: Assert audit_count_records() before using its
    result
  selftests/landlock: Fix memory leak in audit_init_filter_exe()
  selftests/landlock: Make audit_message large enough for any exe filter
  selftests/landlock: Close leaked file descriptors
  selftests/landlock: Check errno for combined VERSION and ERRATA flags
  selftests/landlock: Fix SIGURG handler setup in scoped_signal_test
  selftests/landlock: Fix regex_escape() error handling in
    matches_log_fs_extra()
  selftests/landlock: Fix off-by-one in regex_escape()
  selftests/landlock: Fix the snprintf() error check in
    matches_log_fs_extra()
  selftests/landlock: Use _exit() in the named_pipe_ioctl child
  selftests/landlock: Fix messages and comments in helper programs
  selftests/landlock: Fix stale comments in common.h and audit.h
  selftests/landlock: Use ASSERT for syscall failures before errno
    checks
  selftests/landlock: Assert WIFEXITED() before checking the exit status
  selftests/landlock: Use EXPECT for closing FDs and stopping threads
  selftests/landlock: Use EXPECT for checks that later steps do not need

 tools/testing/selftests/landlock/audit.h      |   20 +-
 tools/testing/selftests/landlock/audit_test.c |   56 +-
 tools/testing/selftests/landlock/base_test.c  |  190 +--
 tools/testing/selftests/landlock/common.h     |   32 +-
 tools/testing/selftests/landlock/fs_bench.c   |    5 +-
 tools/testing/selftests/landlock/fs_test.c    | 1300 +++++++++--------
 tools/testing/selftests/landlock/net_test.c   |   64 +-
 .../testing/selftests/landlock/ptrace_test.c  |   44 +-
 .../selftests/landlock/sandbox-and-launch.c   |    6 +-
 .../landlock/scoped_abstract_unix_test.c      |   45 +-
 .../selftests/landlock/scoped_signal_test.c   |   23 +-
 .../testing/selftests/landlock/scoped_test.c  |    2 +-
 .../selftests/landlock/trace_fs_test.c        |    8 +-
 tools/testing/selftests/landlock/trace_test.c |   26 +-
 tools/testing/selftests/landlock/tsync_test.c |   22 +-
 .../selftests/landlock/wait-pipe-sandbox.c    |   16 +-
 tools/testing/selftests/landlock/wait-pipe.c  |    2 +-
 17 files changed, 952 insertions(+), 909 deletions(-)

-- 
2.56.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help