mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <llong@redhat.com>
To: "André Almeida" <andrealmeid@igalia.com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org
Cc: Darren Hart <dvhart@infradead.org>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	kernel-dev@igalia.com
Subject: Re: [PATCH 2/2] selftest/futex: Reintroduce "Memory out of range" numa_mpol's subtest
Date: Wed, 3 Sep 2025 13:57:05 -0400	[thread overview]
Message-ID: <f00c7f8c-a596-4d96-8e45-43fc3fb4736a@redhat.com> (raw)
In-Reply-To: <20250901203327.53887-2-andrealmeid@igalia.com>

On 9/1/25 4:33 PM, André Almeida wrote:
> Commit d8e2f919997 ("selftests/futex: Fix some futex_numa_mpol
> subtests") removed the "Memory out of range" subtest due to it being
> dependent on the memory layout of the test process having an invalid
> memory address just after the `*futex_ptr` allocated memory.
>
> Reintroduce this test and make it deterministic, by allocation two
> memory pages and marking the second one with PROT_NONE.
>
> Signed-off-by: André Almeida <andrealmeid@igalia.com>
> ---
> This patch is aimed for 6.18
> ---
>   .../testing/selftests/futex/functional/futex_numa_mpol.c  | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/futex/functional/futex_numa_mpol.c b/tools/testing/selftests/futex/functional/futex_numa_mpol.c
> index c84441751235..e4b840184b1d 100644
> --- a/tools/testing/selftests/futex/functional/futex_numa_mpol.c
> +++ b/tools/testing/selftests/futex/functional/futex_numa_mpol.c
> @@ -174,10 +174,13 @@ int main(int argc, char *argv[])
>   	ksft_set_plan(1);
>   
>   	mem_size = sysconf(_SC_PAGE_SIZE);
> -	futex_ptr = mmap(NULL, mem_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
> +	futex_ptr = mmap(NULL, mem_size * 2, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
>   	if (futex_ptr == MAP_FAILED)
>   		ksft_exit_fail_msg("mmap() for %d bytes failed\n", mem_size);
>   
> +	/* Create an invalid memory region for the "Memory out of range" test */
> +	mprotect(futex_ptr + mem_size, mem_size, PROT_NONE);
> +
>   	futex_numa = futex_ptr;
>   
>   	ksft_print_msg("Regular test\n");
> @@ -192,6 +195,9 @@ int main(int argc, char *argv[])
>   	ksft_print_msg("Mis-aligned futex\n");
>   	test_futex(futex_ptr + mem_size - 4, 22);
>   
> +	ksft_print_msg("Memory out of range\n");
> +	test_futex(futex_ptr + mem_size, 14);
> +
>   	futex_numa->numa = FUTEX_NO_NODE;
>   	mprotect(futex_ptr, mem_size, PROT_READ);
>   	ksft_print_msg("Memory, RO\n");
Reviewed-by: Waiman Long <longman@redhat.com>


  reply	other threads:[~2025-09-03 17:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 20:33 [PATCH 1/2] selftest/futex: Make the error check more precise for futex_numa_mpol André Almeida
2025-09-01 20:33 ` [PATCH 2/2] selftest/futex: Reintroduce "Memory out of range" numa_mpol's subtest André Almeida
2025-09-03 17:57   ` Waiman Long [this message]
2025-09-03 17:53 ` [PATCH 1/2] selftest/futex: Make the error check more precise for futex_numa_mpol Waiman Long
2025-09-04 15:23   ` André Almeida
2025-09-04 15:59     ` Waiman Long

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=f00c7f8c-a596-4d96-8e45-43fc3fb4736a@redhat.com \
    --to=llong@redhat.com \
    --cc=andrealmeid@igalia.com \
    --cc=bigeasy@linutronix.de \
    --cc=bp@alien8.de \
    --cc=dave@stgolabs.net \
    --cc=dvhart@infradead.org \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-dev@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=vschneid@redhat.com \
    /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

all inboxes | Powered by JetHome®