From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,youngjun.park@lge.com,stable@vger.kernel.org,
shikemeng@huaweicloud.com,nphamcs@gmail.com,kasong@tencent.com,
chrisl@kernel.org,baoquan.he@linux.dev,baohua@kernel.org,aquini@redhat.com,
oleksandr@natalenko.name,akpm@linux-foundation.org
Subject: + mm-swapfile-really-fix-integer-overflow-in-swap_show-and-swapon.patch added to mm-hotfixes-unstable branch
Date: Wed, 18 Nov 2026 13:48:28 -0800 [thread overview]
Message-ID: <20261118214829.5F5261F000CD@smtp.kernel.org> (raw)
The patch titled
Subject: mm/swapfile: really fix integer overflow in swap_show() and swapon()
has been added to the -mm mm-hotfixes-unstable branch. Its filename is
mm-swapfile-really-fix-integer-overflow-in-swap_show-and-swapon.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-swapfile-really-fix-integer-overflow-in-swap_show-and-swapon.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: Oleksandr Natalenko <oleksandr@natalenko.name>
Subject: mm/swapfile: really fix integer overflow in swap_show() and swapon()
Date: Wed, 18 Nov 2026 12:26:10 +0100
One of the enterprise customers uses 6 TiB of swap, and the values
reported in /proc/swaps as well as in dmesg are still not correct.
Cast si->pages to long explicitly so that the bitshift in K() doesn't
truncate the value to 32 bits.
Also do the same in swapon() for the same reason.
Link: https://lore.kernel.org/20261118112610.122799-1-oleksandr@natalenko.name
Fixes: 642929a2ded0 ("mm/swapfile: fix an integer overflow in swap_show()")
Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Reviewed-by: Youngjun Park <youngjun.park@lge.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Christopher Li <chrisl@kernel.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Baoquan He <baoquan.he@linux.dev>
Cc: Barry Song <baohua@kernel.org>
Cc: <stable@vger.kernel.org>
mm/swapfile.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/mm/swapfile.c~mm-swapfile-really-fix-integer-overflow-in-swap_show-and-swapon
+++ a/mm/swapfile.c
@@ -3452,7 +3452,7 @@ static int swap_show(struct seq_file *sw
return 0;
}
- bytes = K(si->pages);
+ bytes = K((unsigned long)si->pages);
inuse = K(swap_usage_in_pages(si));
file = si->swap_file;
@@ -3968,8 +3968,8 @@ SYSCALL_DEFINE2(swapon, const char __use
/* Sets SWP_WRITEOK, resurrect the percpu ref, expose the swap device */
enable_swap_info(si);
- pr_info("Adding %uk swap on %s. Priority:%d extents:%d across:%lluk %s%s%s%s\n",
- K(si->pages), name->name, si->prio, nr_extents,
+ pr_info("Adding %luk swap on %s. Priority:%d extents:%d across:%lluk %s%s%s%s\n",
+ K((unsigned long)si->pages), name->name, si->prio, nr_extents,
K((unsigned long long)span),
(si->flags & SWP_SOLIDSTATE) ? "SS" : "",
(si->flags & SWP_DISCARDABLE) ? "D" : "",
_
Patches currently in -mm which might be from oleksandr@natalenko.name are
mm-swapfile-really-fix-integer-overflow-in-swap_show-and-swapon.patch
reply other threads:[~2026-11-18 21:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261118214829.5F5261F000CD@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=baohua@kernel.org \
--cc=baoquan.he@linux.dev \
--cc=chrisl@kernel.org \
--cc=kasong@tencent.com \
--cc=mm-commits@vger.kernel.org \
--cc=nphamcs@gmail.com \
--cc=oleksandr@natalenko.name \
--cc=shikemeng@huaweicloud.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox