proposal to fix CVE-2026-23346 on 6.12 or older kernel
v2 cover proposal to fix CVE-2026-23346 on 6.12 or older kernel
Changes:
V1 -> V2: According to Catalin's review comment, using backport instead of reimplementing fix.
Verified on linux-6.12 with Yocto environment.
Verification code & script:
C code:
------
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
// Using QEMU RTC HW address
#define PHYSICAL_ADDR 0x09010000
#define MAP_SIZE 4096
int main() {
int i = 180;
int fd = open("/dev/mem", O_RDWR | O_SYNC);
if (fd < 0) {
perror("failed to open /dev/mem");
return 1;
}
// Start map
void *map_base = mmap(NULL, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, PHYSICAL_ADDR);
if (map_base == MAP_FAILED) {
perror("failed to mmap");
close(fd);
return 1;
}
printf("Put those info to script PID:%d, VADDR:%p\n", getpid(), map_base);
// Keep running for script trigger the issue.
while(i > 0) {
sleep(1);
i--;
}
munmap(map_base, MAP_SIZE);
close(fd);
return 0;
}------ End of C code ------
Python code:
-----------
python3 -c '
pid = 506
vaddr = 0x7f9de3f000
f = open(f"/proc/{pid}/mem", "rb")f.seek(vaddr)f.read(4)
'
------End of Python code------
Usage:
Ensure kernel enabled the CONFIG_ARM64_PAN and CONFIG_DEVMEM
Start Qemuarm64 with -cpu cortex-a55 -M virt, e.g.:
qemu-system-aarch64 \
-cpu cortex-a55 \
-M virt \
-m 2G \
-smp 2 \
-kernel ./arch/arm64/boot/Image \
-append "console=ttyAMA0 root=/dev/vda rw earlycon" \
-drive if=none,file=rootfs.img,id=hd0,format=raw \
-device virtio-blk-device,drive=hd0 \
-nographicAfter enter the qemu, using cat /proc/iomem to get a vaild MMIO address, here is using RTC address (#define PHYSICAL_ADDR 0x09010000).
Build the C code, put the binary to target qemu system and run it, the C reproducer would output the PID and mapped address, here example pid is 506 and virtual address is 0x7f9de3f000.
Fill pid and virtual address to python code, without fix, kernel would crash with "Unable to handle kernel read from unreadable memory".
Based on crash info, pstate: 20400005 (... +PAN ...) and FSC = 0x0f: level 3 permission fault
Call trace: [ 678.563102] __memcpy_fromio+0x50/0x98 [ 678.563436] __access_remote_vm+0x294/0x3a8 [ 678.563901] access_remote_vm+0x18/0x30 [ 678.564308] mem_rw+0x1e0/0x370 [ 678.564534] mem_read+0x1c/0x30 [ 678.564754] vfs_read+0xcc/0x2d0 [ 678.564975] ksys_read+0x7c/0x120 [ 678.565192] __arm64_sys_read+0x24/0x38 [ 678.565450] invoke_syscall+0x5c/0x138 [ 678.565729] el0_svc_common.constprop.0+0x48/0xf0 [ 678.566038] do_el0_svc+0x24/0x38 [ 678.566264] el0_svc+0x38/0x108 [ 678.566514] el0t_64_sync_handler+0x120/0x130 [ 678.566823] el0t_64_sync+0x190/0x198
....
The behavior is the same as description of
commit:8f098037139b ("arm64: io: Extract user memory type in ioremap_prot()")
Will Deacon (2):
arm64: io: Rename ioremap_prot() to __ioremap_prot()
arm64: io: Extract user memory type in ioremap_prot()
arch/arm64/include/asm/io.h | 24 +++++++++++++++++++----- arch/arm64/kernel/acpi.c | 2 +- arch/arm64/mm/ioremap.c | 7 +++---- 3 files changed, 23 insertions(+), 10 deletions(-)
Signature · 1 line
2.49.1
PATCH v2 1/2 arm64: io: Rename ioremap_prot() to __ioremap_prot()
From: Will Deacon <[email protected]>
commit f6bf47ab32e0863df50f5501d207dcdddb7fc507 upstream.
Rename our ioremap_prot() implementation to __ioremap_prot() and convert all arch-internal callers over to the new function.
ioremap_prot() remains as a #define to __ioremap_prot() for generic_access_phys() and will be subsequently extended to handle user permissions in 'prot'.
--- arch/arm64/include/asm/io.h | 7 ++++--- arch/arm64/kernel/acpi.c | 2 +- arch/arm64/mm/ioremap.c | 7 +++---- 3 files changed, 8 insertions(+), 8 deletions(-)
arch/arm64/include/asm/io.h +4 -3
@@ -274,15 +274,16 @@ __iowrite64_copy(void __iomem *to, const void *from, size_t count)typedef int (*ioremap_prot_hook_t )(phys_addr_t phys_addr,size_t size,pgprot_t *prot);int arm64_ioremap_prot_hook_register (const ioremap_prot_hook_t hook); +void __iomem *__ioremap_prot (phys_addr_t phys,size_t size,pgprot_t prot);#define ioremap_prot ioremap_prot#define _PAGE_IOREMAP PROT_DEVICE_nGnRE#define ioremap_wc (addr, size) \ - ioremap_prot((addr), (size), PROT_NORMAL_NC) + __ioremap_prot((addr), (size), __pgprot(PROT_NORMAL_NC))#define ioremap_np (addr, size) \ - ioremap_prot((addr), (size), PROT_DEVICE_nGnRnE) + __ioremap_prot((addr), (size), __pgprot(PROT_DEVICE_nGnRnE))/* * io{read,write}{16,32,64}be() macros
@@ -303,7 +304,7 @@ static inline void __iomem *ioremap_cache(phys_addr_t addr, size_t size)if (pfn_is_map_memory (__phys_to_pfn (addr)))return (void __iomem *)__phys_to_virt (addr); -return ioremap_prot (addr, size,PROT_NORMAL ); +return __ioremap_prot (addr, size,__pgprot (PROT_NORMAL )); }/*
arch/arm64/kernel/acpi.c +1 -1
@@ -379,7 +379,7 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size) prot =__acpi_get_writethrough_mem_attribute (); } } -return ioremap_prot (phys, size,pgprot_val (prot)); +return __ioremap_prot (phys, size, prot); }/*
arch/arm64/mm/ioremap.c +3 -4
@@ -14,11 +14,10 @@ int arm64_ioremap_prot_hook_register(ioremap_prot_hook_t hook)return 0 ; } -void __iomem *ioremap_prot (phys_addr_t phys_addr,size_t size, -unsigned long prot) +void __iomem *__ioremap_prot (phys_addr_t phys_addr,size_t size, +pgprot_t pgprot) {unsigned long last_addr = phys_addr + size -1 ; -pgprot_t pgprot =__pgprot (prot);/* Don't allow outside PHYS_MASK */ if (last_addr & ~PHYS_MASK )
@@ -39,7 +38,7 @@ void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,return generic_ioremap_prot (phys_addr, size, pgprot); } -EXPORT_SYMBOL (ioremap_prot); +EXPORT_SYMBOL (__ioremap_prot);/* * Must be called after early_fixmap_init
Signature · 1 line
2.49.1
PATCH v2 2/2 arm64: io: Extract user memory type in ioremap_prot()
In reply to Xiangyu ChenFrom: Will Deacon <[email protected]>
[ Upstream commit 8f098037139b294050053123ab2bc0f819d08932 ]
The only caller of ioremap_prot() outside of the generic ioremap() implementation is generic_access_phys(), which passes a 'pgprot_t' value determined from the user mapping of the target 'pfn' being accessed by the kernel. On arm64, the 'pgprot_t' contains all of the non-address bits from the pte, including the permission controls, and so we end up returning a new user mapping from ioremap_prot() which faults when accessed from the kernel on systems with PAN:
| Unable to handle kernel read from unreadable memory at virtual address ffff80008ea89000 | ... | Call trace: | __memcpy_fromio+0x80/0xf8 | generic_access_phys+0x20c/0x2b8 | __access_remote_vm+0x46c/0x5b8 | access_remote_vm+0x18/0x30 | environ_read+0x238/0x3e8 | vfs_read+0xe4/0x2b0 | ksys_read+0xcc/0x178 | __arm64_sys_read+0x4c/0x68
Extract only the memory type from the user 'pgprot_t' in ioremap_prot() and assert that we're being passed a user mapping, to protect us against any changes in future that may require additional handling. To avoid falsely flagging users of ioremap(), provide our own ioremap() macro which simply wraps __ioremap_prot().
[ Modified ioremap_prot() parameter, using "unsigned long user_prot" instead of "pgprot_t user_prot" to fix conflict with generic header ]
--- arch/arm64/include/asm/io.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
arch/arm64/include/asm/io.h +15 -2
@@ -276,10 +276,23 @@ typedef int (*ioremap_prot_hook_t)(phys_addr_t phys_addr, size_t size,int arm64_ioremap_prot_hook_register (const ioremap_prot_hook_t hook);void __iomem *__ioremap_prot (phys_addr_t phys,size_t size,pgprot_t prot); -#define ioremap_prot ioremap_prot +static inline void __iomem *ioremap_prot (phys_addr_t phys,size_t size, +unsigned long user_prot) +{ +pgprot_t prot; +pteval_t user_prot_val =pgprot_val (__pgprot (user_prot)); + +if (WARN_ON_ONCE (!(user_prot_val &PTE_USER ))) +return NULL ; -#define _PAGE_IOREMAP PROT_DEVICE_nGnRE + prot =__pgprot_modify (PAGE_KERNEL ,PTE_ATTRINDX_MASK , + user_prot_val &PTE_ATTRINDX_MASK ); +return __ioremap_prot (phys, size, prot); +} +#define ioremap_prot ioremap_prot +#define ioremap (addr, size) \ + __ioremap_prot((addr), (size), __pgprot(PROT_DEVICE_nGnRE))#define ioremap_wc (addr, size) \ __ioremap_prot((addr), (size), __pgprot(PROT_NORMAL_NC))#define ioremap_np (addr, size) \
Signature · 1 line
2.49.1
Quoted 2 lines · Xiangyu Chen
Changes:
V1 -> V2: According to Catalin's review comment, using backport instead of reimplementing fix.
[...]
Quoted 3 lines
Will Deacon (2):
arm64: io: Renameioremap_prot()to__ioremap_prot()
arm64: io: Extract user memory type inioremap_prot()
The backports look fine, they are nearly identical to the upstream commits apart from the pgprot_t and ptdesc_t types.
Thanks.
Signature · 1 line
Catalin
Quoted 4 lines · Catalin Marinas
CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.On Wed, Jun 03, 2026 at 09:23:12AM +0800, Xiangyu Chen wrote:
Quoted 8 lines
Quoted 2 lines
Changes:
V1 -> V2: According to Catalin's review comment, using backport instead of reimplementing fix.[...]
Quoted 3 lines
Will Deacon (2):
arm64: io: Renameioremap_prot()to__ioremap_prot()
arm64: io: Extract user memory type inioremap_prot()The backports look fine, they are nearly identical to the upstream commits apart from the
pgprot_tandptdesc_ttypes.
Thanks. I will use these insights to backport the fix to kernel 6.6.
Once testing is complete, I will send the patch upstream.
Br,
Xiangyu
Quoted 5 lines
Thanks.
--
Catalin
Sasha Levin
maintainerQuoted 4 lines
[PATCH v2 6.12.y 0/2] arm64: io:
ioremap_prot()rename + extract user memory type (CVE-2026-23346)
1/2 arm64: io: Renameioremap_prot()to__ioremap_prot()2/2 arm64: io: Extract user memory type inioremap_prot()
Both queued for 6.12.y, thanks (and thanks to Catalin for the review).
Signature · 2 lines
Thanks, Sasha