Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Hongfu Li <lihongfu@kylinos.cn>
Cc: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
	liam@infradead.org, vbabka@kernel.org, surenb@google.com,
	mhocko@suse.com, shuah@kernel.org, linux-mm@kvack.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/4] selftests/mm: unify pkey sighandler selftest assertions and tracing
Date: Sun, 31 May 2026 17:31:43 +0300	[thread overview]
Message-ID: <ahxGT9Q4JjhHBK0z@kernel.org> (raw)
In-Reply-To: <20260529071633.2807814-3-lihongfu@kylinos.cn>

Hi,

On Fri, May 29, 2026 at 03:16:31PM +0800, 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@kylinos.cn>
> ---
>  .../selftests/mm/pkey_sighandler_tests.c      | 104 +++++++++---------
>  1 file changed, 50 insertions(+), 54 deletions(-)
>
> @@ -323,18 +323,18 @@ static void test_sigsegv_handler_with_different_pkey_for_stack(void)
>  	memset(&siginfo, 0, sizeof(siginfo));
>  
>  	/* Use clone to avoid newer glibcs using rseq on new threads */
> -	long ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> -			     CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> -			     CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> -			     CLONE_DETACHED,
> -			     stack + STACK_SIZE,
> -			     &parent_pid,
> -			     &child_pid);
> -
> -	if (ret < 0) {
> -		errno = -ret;
> +	child_pid = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> +			      CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> +			      CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> +			      CLONE_DETACHED,
> +			      stack + STACK_SIZE,
> +			      &parent_pid,
> +			      &child_pid);
> +
> +	if (child_pid < 0) {
> +		errno = -child_pid;

This change does not seem related at all to the patch.

>  		perror("clone");
> -	} else if (ret == 0) {
> +	} else if (child_pid == 0) {
>  		thread_segv_maperr_ptr(&sigstack);
>  		syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0);
>  	}
>
> @@ -494,23 +490,22 @@ static void test_pkru_sigreturn(void)
>  	sigstack.ss_size = STACK_SIZE;
>  
>  	/* Use clone to avoid newer glibcs using rseq on new threads */
> -	long ret = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> -			     CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> -			     CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> -			     CLONE_DETACHED,
> -			     stack + STACK_SIZE,
> -			     &parent_pid,
> -			     &child_pid);
> -
> -	if (ret < 0) {
> -		errno = -ret;
> +	child_pid = clone_raw(CLONE_VM | CLONE_FS | CLONE_FILES |
> +			      CLONE_SIGHAND | CLONE_THREAD | CLONE_SYSVSEM |
> +			      CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID |
> +			      CLONE_DETACHED,
> +			      stack + STACK_SIZE,
> +			      &parent_pid,
> +			      &child_pid);
> +
> +	if (child_pid < 0) {
> +		errno = -child_pid;

Ditto.

>  		perror("clone");
> -	}  else if (ret == 0) {
> +	} else if (child_pid == 0) {
>  		thread_sigusr2_self(&sigstack);
>  		syscall_raw(SYS_exit, 0, 0, 0, 0, 0, 0);
>  	}
>  
> -	child_pid =  ret;
>  	/* Check that thread exited */
>  	do {
>  		sched_yield();

-- 
Sincerely yours,
Mike.


  reply	other threads:[~2026-05-31 14:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-29  7:16 [PATCH v4 0/4] selftests/mm: refactor pkey helpers and fix mmap error handling Hongfu Li
2026-05-29  7:16 ` [PATCH v4 1/4] selftests/mm: move pkey selftest helpers to pkey_util.c Hongfu Li
2026-05-29  8:12   ` Hongfu Li
2026-05-29  7:16 ` [PATCH v4 2/4] selftests/mm: unify pkey sighandler selftest assertions and tracing Hongfu Li
2026-05-31 14:31   ` Mike Rapoport [this message]
2026-05-29  7:16 ` [PATCH v4 3/4] selftests/mm: use pkey_assert on clone_raw failure in pkey test Hongfu Li
2026-05-31 14:36   ` Mike Rapoport
2026-06-01  5:32     ` Hongfu Li
2026-05-29  7:16 ` [PATCH v4 4/4] selftests/mm: add missing mmap() return checks in pkey tests Hongfu Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ahxGT9Q4JjhHBK0z@kernel.org \
    --to=rppt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=lihongfu@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=shuah@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox