From: Shuah Khan <skhan@linuxfoundation.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Vincent Donnefort <vdonnefort@google.com>,
mhiramat@kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, kernel-team@android.com,
aha310510@gmail.com, eadavis@qq.com,
linux-kselftest@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests/ring-buffer: Add test for out-of-bound pgoff mapping
Date: Thu, 2 Jan 2025 14:19:45 -0700 [thread overview]
Message-ID: <b5ae70c4-055b-442c-be91-3430367f842b@linuxfoundation.org> (raw)
In-Reply-To: <20241223220504.4ae4adf2@gandalf.local.home>
On 12/23/24 20:05, Steven Rostedt wrote:
>
> Hi Shuah,
>
> Care to take this through your tree?
>
> On Wed, 18 Dec 2024 17:03:18 +0000
> Vincent Donnefort <vdonnefort@google.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@linuxfoundation.org>
>> Cc: linux-kselftest@vger.kernel.org
>> Signed-off-by: Vincent Donnefort <vdonnefort@google.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.
>
Applied to linux_kselftest next for Linux 6.14-rc1.
thanks,
-- Shuah
prev parent reply other threads:[~2025-01-02 21:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-18 17:03 [PATCH] selftests/ring-buffer: Add test for out-of-bound pgoff mapping Vincent Donnefort
2024-12-24 3:05 ` Steven Rostedt
2025-01-02 21:19 ` Shuah Khan [this message]
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=b5ae70c4-055b-442c-be91-3430367f842b@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=aha310510@gmail.com \
--cc=eadavis@qq.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=vdonnefort@google.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