Re: [PATCH v8 2/5] selftests/mm: unify pkey sighandler selftest assertions and tracing

From: Kevin Brodsky

Date: Wed Jul 01 2026 - 04:50:12 EST


On 30/06/2026 09:32, Hongfu Li wrote:
> Add per-test tracing to the pkey signal-handler selftest and use
> pkey_assert() for error handling. Each test enables tracing at start
> and disables it at end; on failure, pkey_assert() calls abort_hooks()
> to turn tracing off so ftrace is not left enabled.
>
> Signed-off-by: Hongfu Li <lihongfu@xxxxxxxxxx>
> ---
> .../selftests/mm/pkey_sighandler_tests.c | 69 ++++++++++---------
> 1 file changed, 36 insertions(+), 33 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> index 302fef54049c..085e771227fb 100644
> --- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
> +++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
> @@ -19,7 +19,6 @@
> #include <stdint.h>
> #include <stdbool.h>
> #include <signal.h>
> -#include <assert.h>
> #include <stdlib.h>
> #include <sys/mman.h>
> #include <sys/types.h>
> @@ -36,6 +35,10 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
> static siginfo_t siginfo = {0};
>
> +int iteration_nr = 1;
> +int test_nr;
> +int dprint_in_signal;

Might as well define those in pkey_util.c as well (move them in patch 1
too).

> [...]
>
> /* Use clone to avoid newer glibcs using rseq on new threads */
> - long ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> + ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> CLONE_DETACHED,

Align these lines to the opening (.

> [...]
>
> /* Use clone to avoid newer glibcs using rseq on new threads */
> - long ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> + ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> CLONE_DETACHED,

Same here.

- Kevin