From: "Radek Marciňa" <github.unusual340@8alias.com>
To: stable@vger.kernel.org
Cc: Thomas Gleixner <tglx@kernel.org>,Ingo Molnar
<mingo@redhat.com>,Borislav Petkov <bp@alien8.de>,Dave Hansen
<dave.hansen@linux.intel.com>,x86@kernel.org,Andrew Morton
<akpm@linux-foundation.org>,David Hildenbrand
<david@kernel.org>,linux-mm@kvack.org,Arnd Bergmann
<arnd@arndb.de>,Michael Kelley
<mhkelley58@gmail.com>,linux-kernel@vger.kernel.org
Subject: [PATCH 6.12.y 2/2] mm/early_ioremap: Sign-extend PAGE_MASK when aligning the physical address
Date: Sat, 31 Oct 2026 15:45:21 +0000 [thread overview]
Message-ID: <179346152914.8.7838190602983146541.1735981230@8alias.com> (raw)
In-Reply-To: <179346145167.7.7861216093151225931.1735978772@8alias.com>
From: Radek Marciňa <github.unusual340@8alias.com>
[ Stable-only fix: mainline is not affected since v6.13, see below. ]
On 32-bit kernels with a 64-bit phys_addr_t and an unsigned long
PAGE_MASK, which in this tree is x86-32 with PAE, __early_ioremap()
phys_addr &= PAGE_MASK;
clears bits 32-63, so early_ioremap() and early_memremap() of anything
above 4 GiB map the alias at the low 32 bits instead. Cast PAGE_MASK
to signed long so it sign-extends.
Mainline lost the bug when commit efe8419ae78d ("vdso: Introduce
vdso/page.h") and commit d4a65302dd84 ("vdso: Change PAGE_MASK to
signed on all 32-bit architectures") made PAGE_MASK signed on 32-bit.
Those rework PAGE_MASK for every architecture, so they are not
backported.
Fixes: 9e5c33d7aeee ("mm: create generic early_ioremap() support")
Assisted-by: LLM
Signed-off-by: Radek Marciňa <github.unusual340@8alias.com>
---
mm/early_ioremap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/early_ioremap.c b/mm/early_ioremap.c
index ce06b2884789..ba0acdb72396 100644
--- a/mm/early_ioremap.c
+++ b/mm/early_ioremap.c
@@ -129,7 +129,7 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
* Mappings have to be page-aligned
*/
offset = offset_in_page(phys_addr);
- phys_addr &= PAGE_MASK;
+ phys_addr &= (signed long)PAGE_MASK;
size = PAGE_ALIGN(last_addr + 1) - phys_addr;
/*
--
2.56.0
next prev parent reply other threads:[~2026-10-31 15:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 15:44 [PATCH 6.12.y 0/2] Fix ioremap of addresses above 4 GiB on x86-32 PAE Radek Marciňa
2026-10-31 15:45 ` [PATCH 6.12.y 1/2] x86/ioremap: Sign-extend PAGE_MASK when aligning the physical address Radek Marciňa
2026-10-31 15:45 ` Radek Marciňa [this message]
2026-10-31 20:25 ` [PATCH 6.12.y 2/2] mm/early_ioremap: " Greg KH
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=179346152914.8.7838190602983146541.1735981230@8alias.com \
--to=github.unusual340@8alias.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhkelley58@gmail.com \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/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
all inboxes | Powered by JetHome®