Re: [syzbot ci] Re: Virtual Swap Space (Swap Table Edition)
Nhat Pham <[email protected]>
| Newsgroups | org.kernel.vger.cgroups,dev.linux.lists.syzbot,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <CAKEwX=M=08W43G3dSjRh1p7Z0QFSDQZWuNWguon1yETvxW+89A@mail.gmail.com> |
On Fri, Aug 7, 2026 at 12:21 AM Chris Li <[email protected]> wrote: > > Hi Nhat, > > On Thu, Aug 6, 2026 at 10:26 PM syzbot ci > <[email protected]> wrote: > > > > syzbot ci has tested the following series > > > > [v3] Virtual Swap Space (Swap Table Edition) > > https://lore.kernel.org/all/[email protected] > > * [PATCH v3 01/11] mm, swap: add virtual swap device infrastructure > > * [PATCH v3 02/11] mm, swap: support zswap and zeroswap as vswap backends > > * [PATCH v3 03/11] mm, swap: prepare the swap IO path for vswap > > * [PATCH v3 04/11] mm, swap: support physical swap as a vswap backend > > * [PATCH v3 05/11] mm, swap: enable THP swapin for vswap entries > > * [PATCH v3 06/11] mm, swap: write back vswap zswap entries to physical swap > > * [PATCH v3 07/11] mm, swap: reclaim physical slots backing cache-only vswap entries > > * [PATCH v3 08/11] mm, swap: only charge physical swap entries > > * [PATCH v3 09/11] mm, swap: add debugfs counters for vswap > > * [PATCH v3 10/11] mm, swap: defer memcg_table allocation for physical swap clusters > > * [PATCH v3 11/11] mm, swap: widen swap_info_struct max/pages to unsigned long > > > > and found the following issue: > > KASAN: null-ptr-deref Read in swap_entry_backend_has_flag > > > > Full report is available here: > > https://ci.syzbot.org/series/e7da1097-3230-4e50-80cb-1dfafeebea40 > > Please take a look at the syzbot report and let us know what you think. > > Chris > Oh it's a real bug. Not too hard to fix though. Basically, before adding the folio to the swap cache, all bets are off. If you don't lock the PTE ("and pte mapped but not yet locked"), the swap entry can even go away under you. With the old code and no indirection, it's fine - we pin the swap device, and we only need that swap device's property here (for the sync IO dispatch). With vswap though, you need to also check vswap's entry backend device. I need to add proper rcu/null check here in the case the vswap entry (and its cluster) goes away. Ironically, I think I got this correct in the pre-swap-table version :) I was way, way overly defensive over there (I think I add one extra pin for the vswap entry, and then pin the backend device to just for good measures, which is not really necessary).