Re: [PATCH] mm/gup: fault in ranges that start at address 0

From: Hengyu Liang

Date: Fri Nov 27 2026 - 05:05:08 EST


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.

Thanks,
Hengyu