* + mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch added to mm-new branch
@ 2026-08-29 23:58 Andrew Morton
0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2026-08-29 23:58 UTC (permalink / raw)
To: mm-commits, vbabka, surenb, shikemeng, rppt, pfalcato, peterx,
nphamcs, mhocko, ljs, liam, kasong, jannh, hughd, hannes, david,
chrisl, chengming.zhou, baoquan.he, baolin.wang, baohua, leitao,
akpm
The patch titled
Subject: mm: fail the fault on a malformed swap entry instead of retrying it
has been added to the -mm mm-new branch. Its filename is
mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Breno Leitao <leitao@debian.org>
Subject: mm: fail the fault on a malformed swap entry instead of retrying it
Date: Tue, 18 Aug 2026 03:06:24 -0700
do_swap_page() returns 0 when get_swap_device() fails, which the fault
handler reads as "handled". For an entry that can never become valid the
retry takes the same fault again, so the thread spins forever, retrying on
the same fault.
Return VM_FAULT_SIGBUS (Bad access) for a malformed entry (pr_err() was
called at get_swap_device()).
Link: https://lore.kernel.org/20260818-swap-v3-2-d3fa52598a59@debian.org
Signed-off-by: Breno Leitao <leitao@debian.org>
Acked-by: Kairui Song <kasong@tencent.com>
Reviewed-by: Barry Song <baohua@kernel.org>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Chris Li <chrisl@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/memory.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/mm/memory.c~mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it
+++ a/mm/memory.c
@@ -4958,8 +4958,11 @@ vm_fault_t do_swap_page(struct vm_fault
/* Prevent swapoff from happening to us, and reject a bad entry. */
si = get_swap_device(entry);
- if (IS_ERR_OR_NULL(si))
+ if (IS_ERR_OR_NULL(si)) {
+ if (IS_ERR(si))
+ ret = VM_FAULT_SIGBUS;
goto out;
+ }
folio = swap_cache_get_folio(entry);
if (folio)
_
Patches currently in -mm which might be from leitao@debian.org are
mm-swap-distinguish-a-malformed-swap-entry-from-a-dying-device.patch
mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-29 23:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-29 23:58 + mm-fail-the-fault-on-a-malformed-swap-entry-instead-of-retrying-it.patch added to mm-new branch Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.