Re: [Bug report] hash_name() may cross page boundary and trigger

From: Xie Yuanbin

Date: Sat Nov 29 2025 - 04:26:28 EST


On Sat, 29 Nov 2025 09:08:13 +0000, Al Viro wrote:
> On Sat, Nov 29, 2025 at 12:08:17PM +0800, Xie Yuanbin wrote:
>
>> I think the `user_mode(regs)` check is necessary because the label
>> no_context actually jumps to __do_kernel_fault(), whereas page fault
>> from user mode should jump to `__do_user_fault()`.
>>
>> Alternatively, we would need to change `goto no_context` to
>> `goto bad_area`. Or perhaps I misunderstood something, please point it out.
>
> FWIW, goto bad_area has an obvious problem: uses of 'fault' value, which
> contains garbage.

Yes, I know it, I just omitted it. Thank you for pointing that out.

> or
> if (unlikely(addr >= TASK_SIZE)) {
> fault = 0;
> code = SEGV_MAPERR;
> goto bad_area;
> }

In fact, I have already submitted another patch, which is exactly the way
as you described:
Link: https://lore.kernel.org/20251127140109.191657-1-xieyuanbin1@xxxxxxxxxx

The only difference is that I will move the judgment to before
local_irq_enable(). The reason for doing this is to fix another bug,
you can find more details about it here:
Link: https://lore.kernel.org/20250925025744.6807-1-xieyuanbin1@xxxxxxxxxx
Link: https://lore.kernel.org/20251129021815.9679-1-xieyuanbin1@xxxxxxxxxx

To keep the email concise, I will not repeat the description here.

Xie Yuanbin