From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Christian König" <christian.koenig@amd.com>,
igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org,
Felix Kuehling <felix.kuehling@amd.com>,
Lorenzo Stoakes <ljs@kernel.org>,
"Prosyak, Vitaly" <Vitaly.Prosyak@amd.com>
Subject: Re: [PATCH i-g-t] tests/gem_mmap_offset: Accept partial read in oob-read
Date: Tue, 24 Nov 2026 10:41:25 +0100 [thread overview]
Message-ID: <8f01b6eb-712c-4fb5-8a47-0d767ac8c92e@kernel.org> (raw)
In-Reply-To: <a7c343d6-5eae-43dc-9b6c-3ea386510fcb@amd.com>
On 11/24/26 09:46, Christian König wrote:
> On 11/23/26 22:10, David Hildenbrand (Arm) wrote:
>> The oob-read test reads 8 bytes through /proc/self/mem, assuming that
>> the kernel would reject the entire read with EIO.
>>
>> However, we have 4 remaining bytes in the 4 KiB mapping we can read, so
>> it's valid for the kernel to only do a partial read that covers these 4
>> bytes. Allow that as well.
>
> If I understand it correctly what happens is that userspace tries to read over the end of one VMA into the next, right?
Yes. It now behaves just like any other cases where userspace would do that
(reading through ordinary GUP).
>
> Mhm, allowing that makes sense from the uAPI point of view but I'm not sure if that can't cause problems apart from that test case.
Hard to imagine :)>
>> Otherwise, the test will fail on a kernel with upcoming vm_ops->access
>> fixes, whereby vm_ops->access is limited to the current VMA, so the
>> read would continue with the next mapping (if any).
>>
>> So we have to make sure that nothing is mapped after the GEM mapping.
>> Let's reserve an 8 KiB memory region, map the GEM object into the first
>> 4 KiB slot, and create a hole by unmapping the second 4 KiB slot.
>>
>> With the kernel changes in place:
>>
>> $ build/tests/gem_mmap_offset --run-subtest oob-read
>> [...]
>> Using IGT_SRANDOM=1795467759 for randomisation
>> Opened device: /dev/dri/card1
>> Starting subtest: oob-read
>> Subtest oob-read: SUCCESS (0,000s)
>>
>> Link: https://lore.kernel.org/r/20261122-access_shite-v2-0-808d8d2aa700@kernel.org
>> Cc: Felix Kuehling <felix.kuehling@amd.com>
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: Lorenzo Stoakes <ljs@kernel.org>
>> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
>
> Adding Vitaly on CC to take a look as well and maybe double check with AMDs CI if your patch breaks anything.
Thanks for CCing the right people and for the review!
--
Cheers,
David
prev parent reply other threads:[~2026-11-24 9:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 21:10 [PATCH i-g-t] tests/gem_mmap_offset: Accept partial read in oob-read David Hildenbrand (Arm)
2026-11-24 8:46 ` Christian König
2026-11-24 9:41 ` David Hildenbrand (Arm) [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=8f01b6eb-712c-4fb5-8a47-0d767ac8c92e@kernel.org \
--to=david@kernel.org \
--cc=Vitaly.Prosyak@amd.com \
--cc=christian.koenig@amd.com \
--cc=felix.kuehling@amd.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ljs@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