From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,youngjun.park@lge.com,stable@vger.kernel.org,
sj@kernel.org,shikemeng@huaweicloud.com,nphamcs@gmail.com,kees@kernel.org,
kasong@tencent.com,gustavo@embeddedor.com,gustavoars@kernel.org,
chrisl@kernel.org,baoquan.he@linux.dev,baohua@kernel.org,
android-mm@google.com,kaleshsingh@google.com,akpm@linux-foundation.org
Subject: + mm-swap-make-swap_header-badpages-a-flexible-array.patch added to mm-hotfixes-unstable branch
Date: Mon, 23 Nov 2026 17:24:09 -0800 [thread overview]
Message-ID: <20261124012409.7437F1F000C6@smtp.kernel.org> (raw)
In-Reply-To: <20261120061750.2973004-1-kaleshsingh@google.com>
The patch titled
Subject: mm: swap: make swap_header badpages a flexible array
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-swap-make-swap_header-badpages-a-flexible-array.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-swap-make-swap_header-badpages-a-flexible-array.patch
This patch will later appear in the mm-hotfixes-unstable branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
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: Kalesh Singh <kaleshsingh@google.com>
Subject: mm: swap: make swap_header badpages a flexible array
Date: Fri, 20 Nov 2026 06:17:49 +0000
The swap header declares its list of bad pages as a one-element array,
even though the list can fill the rest of the header page. Since the
kernel is built with -fstrict-flex-arrays=3, the compiler takes that size
literally, so with UBSAN bounds checking, swapon() of a swap area with two
or more bad pages reports an out-of-bounds access:
UBSAN: array-index-out-of-bounds in mm/swapfile.c:3674:26
index 1 is out of range for type '__u32[1]' (aka 'unsigned int[1]')
Kernels that trap on UBSAN reports and panic on oops, such as Android GKI
kernels, crash instead.
Declare the list as a flexible array. The layout of the swap header
does not change.
Link: https://patch.msgid.link/20261120061750.2973004-1-kaleshsingh@google.com
Fixes: df8fc4e934c1 ("kbuild: Enable -fstrict-flex-arrays=3")
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: SJ Park <sj@kernel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Christopher Li <chrisl@kernel.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Barry Song <baohua@kernel.org>
Cc: Youngjun Park <youngjun.park@lge.com>
Cc: <android-mm@google.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: <stable@vger.kernel.org> # 6.6.y, 6.12.y, 6.18.y
include/linux/swap.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/include/linux/swap.h~mm-swap-make-swap_header-badpages-a-flexible-array
+++ a/include/linux/swap.h
@@ -129,7 +129,7 @@ union swap_header {
unsigned char sws_uuid[16];
unsigned char sws_volume[16];
__u32 padding[117];
- __u32 badpages[1];
+ __u32 badpages[];
} info;
};
_
Patches currently in -mm which might be from kaleshsingh@google.com are
mm-swap-make-swap_header-badpages-a-flexible-array.patch
next prev parent reply other threads:[~2026-11-24 1:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 6:17 [PATCH] mm: swap: make swap_header badpages a flexible array kaleshsingh
2026-11-21 0:31 ` Gustavo A. R. Silva
2026-11-21 0:47 ` SJ Park
2026-11-24 1:24 ` Andrew Morton
2026-11-24 1:24 ` Andrew Morton [this message]
2026-12-02 3:47 ` [merged mm-hotfixes-stable] mm-swap-make-swap_header-badpages-a-flexible-array.patch removed from -mm tree Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261124012409.7437F1F000C6@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=android-mm@google.com \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chrisl@kernel.org \
--cc=gustavo@embeddedor.com \
--cc=gustavoars@kernel.org \
--cc=kaleshsingh@google.com \
--cc=kasong@tencent.com \
--cc=kees@kernel.org \
--cc=mm-commits@vger.kernel.org \
--cc=nphamcs@gmail.com \
--cc=shikemeng@huaweicloud.com \
--cc=sj@kernel.org \
--cc=stable@vger.kernel.org \
--cc=youngjun.park@lge.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.