Re: [PATCH] mm/gup: fault in ranges that start at address 0
From: David Hildenbrand (Arm)
Date: Mon Nov 30 2026 - 07:38:53 EST
On 11/27/26 11:04, Hengyu Liang wrote:
> Hi David,
>
> On Wed, 25 Nov 2026 at 23:51, David Hildenbrand (Arm) <david@xxxxxxxxxx> wrote:
>> Okay, but you did not actually run into this yourself, right?
>
> No. I found it while comparing the behavior of different kernel
> versions, and I don't know of an application that hits it.
>
>> Likely this is "nobody cares" and we don't need CC stable.
>
> Agreed, I will drop the stable Cc.
>
>> /* Stop once we overflow to 0. */
>> These comments are not really correct anymore. We don't stop once we overflow to
>> 0 anymore.
>>
>> Likely we want to be more careful when calcualting+handling end instead.
>
> Something like this, in all three functions?
>
> unsigned long end, cur;
> ...
> /* Page-aligned end of the range, 0 if it reaches the top. */
> if (check_add_overflow(start, size, &end))
> end = 0;
> else
> end = PAGE_ALIGN(end);
>
> for (cur = start; cur != end; cur = PAGE_ALIGN_DOWN(cur + PAGE_SIZE))
> ...
>
> A range at address 0 is then handled like any other, and the loop
> still stops at the top of the address space. This is close to what
> the code did before a7797e74bd39.
>
> If that is what you had in mind, I will send a v2 like this.
Yes, looks good. Can you send a v2 and clarify in the description that using
NULL is uncommon today, and usually only root can do it etc?
--
Cheers,
David