[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241223220504.4ae4adf2@gandalf.local.home>
Date: Mon, 23 Dec 2024 22:05:04 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Shuah Khan <skhan@...uxfoundation.org>
Cc: Vincent Donnefort <vdonnefort@...gle.com>, mhiramat@...nel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
kernel-team@...roid.com, aha310510@...il.com, eadavis@...com,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH] selftests/ring-buffer: Add test for out-of-bound pgoff
mapping
Hi Shuah,
Care to take this through your tree?
On Wed, 18 Dec 2024 17:03:18 +0000
Vincent Donnefort <vdonnefort@...gle.com> wrote:
> Extend the ring-buffer mapping test coverage by checking an out-of-bound
> pgoff which has proven to be problematic in the past.
>
> Cc: Shuah Khan <skhan@...uxfoundation.org>
> Cc: linux-kselftest@...r.kernel.org
> Signed-off-by: Vincent Donnefort <vdonnefort@...gle.com>
>
> diff --git a/tools/testing/selftests/ring-buffer/map_test.c b/tools/testing/selftests/ring-buffer/map_test.c
> index d10a847130fb..a58f520f2f41 100644
> --- a/tools/testing/selftests/ring-buffer/map_test.c
> +++ b/tools/testing/selftests/ring-buffer/map_test.c
> @@ -233,12 +233,18 @@ TEST_F(map, data_mmap)
> ASSERT_NE(data, MAP_FAILED);
> munmap(data, data_len);
>
> - /* Overflow the available subbufs by 1 */
> + /* Offset within ring-buffer bounds, mapping size overflow */
> meta_len += desc->meta->subbuf_size * 2;
> data = mmap(NULL, data_len, PROT_READ, MAP_SHARED,
> desc->cpu_fd, meta_len);
> ASSERT_EQ(data, MAP_FAILED);
>
> + /* Offset outside ring-buffer bounds */
> + data_len = desc->meta->subbuf_size * desc->meta->nr_subbufs;
> + data = mmap(NULL, data_len, PROT_READ, MAP_SHARED,
> + desc->cpu_fd, data_len + (desc->meta->subbuf_size * 2));
> + ASSERT_EQ(data, MAP_FAILED);
> +
> /* Verify meta-page padding */
> if (desc->meta->meta_page_size > getpagesize()) {
> data_len = desc->meta->meta_page_size;
>
> base-commit: 61baee2dc5341c936e7fa7b1ca33c5607868de69
You can ignore the above "base-commit" (I don't have it), as it applies
fine to v6.13-rc4.
-- Steve
Powered by blists - more mailing lists