Re: [PATCH] mm/swapfile: validate swap offset in unuse_pte_range()
From: Kairui Song
Date: Tue Dec 02 2025 - 21:54:40 EST
On Mon, Dec 1, 2025 at 6:48 PM Deepanshu Kartikey <kartikey406@xxxxxxxxx> wrote:
>
> Hi Kairui,
>
> Thank you for the detailed feedback!
You are welcome :),
> > But it seems the report is no longer triggering after the softleaf v3
> > change right? Checking the syzbot link, last reproduce was 11/11
>
> You're right - I should have checked the syzbot status more carefully.
> If softleaf v3 has already fixed this, then this patch may not be
> needed.
>
> Could you point me to which specific change in softleaf v3 fixed it?
> I'd like to understand the root cause better.
This one, I think Lorenzo included it or a similar fix along with
another fix in swapfile.c:
https://lore.kernel.org/all/CAMgjq7AP383YfU3L5ZxJ9U3x-vRPnEkEUtmnPdXD29HiNC8OrA@xxxxxxxxxxxxxx/
>
> > What kind of race will lead to a invalid swap entry in the page table?
>
> You make a good point. I was speculating about possible causes without
> concrete evidence.
>
> > I'm not against a sanity check like this though, just want to double
> > check before we process.
>
> If softleaf v3 has fixed the underlying issue, I can withdraw this
> patch. Or if you think a defensive sanity check still has value, I can
> update the commit message to reflect that it is defensive hardening
> rather than a fix for an active bug.
A sanity check here is acceptable since swapoff is cold and the
overhead is hardly visible. No strong opinion on this one.