Skip to content

Commit 8c7c1b5

Browse files
committed
Merge tag 'mm-stable-2025-04-02-22-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull more MM updates from Andrew Morton: - The series "mm: fixes for fallouts from mem_init() cleanup" from Mike Rapoport fixes a couple of issues with the just-merged "arch, mm: reduce code duplication in mem_init()" series - The series "MAINTAINERS: add my isub-entries to MM part." from Mike Rapoport does some maintenance on MAINTAINERS - The series "remove tlb_remove_page_ptdesc()" from Qi Zheng does some cleanup work to the page mapping code - The series "mseal system mappings" from Jeff Xu permits sealing of "system mappings", such as vdso, vvar, vvar_vclock, vectors (arm compat-mode), sigpage (arm compat-mode) - Plus the usual shower of singleton patches * tag 'mm-stable-2025-04-02-22-07' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (31 commits) mseal sysmap: add arch-support txt mseal sysmap: enable s390 selftest: test system mappings are sealed mseal sysmap: update mseal.rst mseal sysmap: uprobe mapping mseal sysmap: enable arm64 mseal sysmap: enable x86-64 mseal sysmap: generic vdso vvar mapping selftests: x86: test_mremap_vdso: skip if vdso is msealed mseal sysmap: kernel config and header change mm: pgtable: remove tlb_remove_page_ptdesc() x86: pgtable: convert to use tlb_remove_ptdesc() riscv: pgtable: unconditionally use tlb_remove_ptdesc() mm: pgtable: convert some architectures to use tlb_remove_ptdesc() mm: pgtable: change pt parameter of tlb_remove_ptdesc() to struct ptdesc* mm: pgtable: make generic tlb_remove_table() use struct ptdesc microblaze/mm: put mm_cmdline_setup() in .init.text section mm/memory_hotplug: fix call folio_test_large with tail page in do_migrate_range MAINTAINERS: mm: add entry for secretmem MAINTAINERS: mm: add entry for numa memblocks and numa emulation ...
2 parents 204e9a1 + e20706d commit 8c7c1b5

File tree

41 files changed

+417
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+417
-128
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#
2+
# Feature name: mseal-system-mappings
3+
# Kconfig: ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
4+
# description: arch supports mseal system mappings
5+
#
6+
-----------------------
7+
| arch |status|
8+
-----------------------
9+
| alpha: | TODO |
10+
| arc: | N/A |
11+
| arm: | N/A |
12+
| arm64: | ok |
13+
| csky: | N/A |
14+
| hexagon: | N/A |
15+
| loongarch: | TODO |
16+
| m68k: | N/A |
17+
| microblaze: | N/A |
18+
| mips: | TODO |
19+
| nios2: | N/A |
20+
| openrisc: | N/A |
21+
| parisc: | TODO |
22+
| powerpc: | TODO |
23+
| riscv: | TODO |
24+
| s390: | ok |
25+
| sh: | N/A |
26+
| sparc: | TODO |
27+
| um: | TODO |
28+
| x86: | ok |
29+
| xtensa: | N/A |
30+
-----------------------

Documentation/userspace-api/mseal.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,27 @@ Use cases
130130

131131
- Chrome browser: protect some security sensitive data structures.
132132

133+
- System mappings:
134+
The system mappings are created by the kernel and includes vdso, vvar,
135+
vvar_vclock, vectors (arm compat-mode), sigpage (arm compat-mode), uprobes.
136+
137+
Those system mappings are readonly only or execute only, memory sealing can
138+
protect them from ever changing to writable or unmmap/remapped as different
139+
attributes. This is useful to mitigate memory corruption issues where a
140+
corrupted pointer is passed to a memory management system.
141+
142+
If supported by an architecture (CONFIG_ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS),
143+
the CONFIG_MSEAL_SYSTEM_MAPPINGS seals all system mappings of this
144+
architecture.
145+
146+
The following architectures currently support this feature: x86-64, arm64,
147+
and s390.
148+
149+
WARNING: This feature breaks programs which rely on relocating
150+
or unmapping system mappings. Known broken software at the time
151+
of writing includes CHECKPOINT_RESTORE, UML, gVisor, rr. Therefore
152+
this config can't be enabled universally.
153+
133154
When not to use mseal
134155
=====================
135156
Applications can apply sealing to any virtual memory region from userspace,

MAINTAINERS

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15487,6 +15487,45 @@ F: tools/mm/
1548715487
F: tools/testing/selftests/mm/
1548815488
N: include/linux/page[-_]*
1548915489

15490+
MEMORY MANAGEMENT - EXECMEM
15491+
M: Andrew Morton <akpm@linux-foundation.org>
15492+
M: Mike Rapoport <rppt@kernel.org>
15493+
L: linux-mm@kvack.org
15494+
S: Maintained
15495+
F: include/linux/execmem.h
15496+
F: mm/execmem.c
15497+
15498+
MEMORY MANAGEMENT - NUMA MEMBLOCKS AND NUMA EMULATION
15499+
M: Andrew Morton <akpm@linux-foundation.org>
15500+
M: Mike Rapoport <rppt@kernel.org>
15501+
L: linux-mm@kvack.org
15502+
S: Maintained
15503+
F: include/linux/numa_memblks.h
15504+
F: mm/numa.c
15505+
F: mm/numa_emulation.c
15506+
F: mm/numa_memblks.c
15507+
15508+
MEMORY MANAGEMENT - SECRETMEM
15509+
M: Andrew Morton <akpm@linux-foundation.org>
15510+
M: Mike Rapoport <rppt@kernel.org>
15511+
L: linux-mm@kvack.org
15512+
S: Maintained
15513+
F: include/linux/secretmem.h
15514+
F: mm/secretmem.c
15515+
15516+
MEMORY MANAGEMENT - USERFAULTFD
15517+
M: Andrew Morton <akpm@linux-foundation.org>
15518+
R: Peter Xu <peterx@redhat.com>
15519+
L: linux-mm@kvack.org
15520+
S: Maintained
15521+
F: Documentation/admin-guide/mm/userfaultfd.rst
15522+
F: fs/userfaultfd.c
15523+
F: include/asm-generic/pgtable_uffd.h
15524+
F: include/linux/userfaultfd_k.h
15525+
F: include/uapi/linux/userfaultfd.h
15526+
F: mm/userfaultfd.c
15527+
F: tools/testing/selftests/mm/uffd-*.[ch]
15528+
1549015529
MEMORY MAPPING
1549115530
M: Andrew Morton <akpm@linux-foundation.org>
1549215531
M: Liam R. Howlett <Liam.Howlett@oracle.com>

arch/arm64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ config ARM64
3838
select ARCH_HAS_KEEPINITRD
3939
select ARCH_HAS_MEMBARRIER_SYNC_CORE
4040
select ARCH_HAS_MEM_ENCRYPT
41+
select ARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGS
4142
select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
4243
select ARCH_HAS_NON_OVERLAPPING_ADDRESS_SPACE
4344
select ARCH_HAS_NONLEAF_PMD_YOUNG if ARM64_HAFT

arch/arm64/kernel/vdso.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ static int __setup_additional_pages(enum vdso_abi abi,
130130
mm->context.vdso = (void *)vdso_base;
131131
ret = _install_special_mapping(mm, vdso_base, vdso_text_len,
132132
VM_READ|VM_EXEC|gp_flags|
133-
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
133+
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
134+
VM_SEALED_SYSMAP,
134135
vdso_info[abi].cm);
135136
if (IS_ERR(ret))
136137
goto up_fail;
@@ -256,7 +257,8 @@ static int aarch32_kuser_helpers_setup(struct mm_struct *mm)
256257
*/
257258
ret = _install_special_mapping(mm, AARCH32_VECTORS_BASE, PAGE_SIZE,
258259
VM_READ | VM_EXEC |
259-
VM_MAYREAD | VM_MAYEXEC,
260+
VM_MAYREAD | VM_MAYEXEC |
261+
VM_SEALED_SYSMAP,
260262
&aarch32_vdso_maps[AA32_MAP_VECTORS]);
261263

262264
return PTR_ERR_OR_ZERO(ret);
@@ -279,7 +281,8 @@ static int aarch32_sigreturn_setup(struct mm_struct *mm)
279281
*/
280282
ret = _install_special_mapping(mm, addr, PAGE_SIZE,
281283
VM_READ | VM_EXEC | VM_MAYREAD |
282-
VM_MAYWRITE | VM_MAYEXEC,
284+
VM_MAYWRITE | VM_MAYEXEC |
285+
VM_SEALED_SYSMAP,
283286
&aarch32_vdso_maps[AA32_MAP_SIGPAGE]);
284287
if (IS_ERR(ret))
285288
goto out;

arch/csky/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm)
6161
return ret;
6262
}
6363

64-
#define __pte_free_tlb(tlb, pte, address) \
65-
do { \
66-
pagetable_dtor(page_ptdesc(pte)); \
67-
tlb_remove_page_ptdesc(tlb, page_ptdesc(pte)); \
68-
} while (0)
64+
#define __pte_free_tlb(tlb, pte, address) \
65+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
6966

7067
extern void pagetable_init(void);
7168
extern void mmu_init(unsigned long min_pfn, unsigned long max_pfn);

arch/hexagon/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
8787
max_kernel_seg = pmdindex;
8888
}
8989

90-
#define __pte_free_tlb(tlb, pte, addr) \
91-
do { \
92-
pagetable_dtor((page_ptdesc(pte))); \
93-
tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte))); \
94-
} while (0)
90+
#define __pte_free_tlb(tlb, pte, addr) \
91+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
9592

9693
#endif

arch/loongarch/include/asm/pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
5555
return pte;
5656
}
5757

58-
#define __pte_free_tlb(tlb, pte, address) \
59-
do { \
60-
pagetable_dtor(page_ptdesc(pte)); \
61-
tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \
62-
} while (0)
58+
#define __pte_free_tlb(tlb, pte, address) \
59+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
6360

6461
#ifndef __PAGETABLE_PMD_FOLDED
6562

arch/m68k/include/asm/sun3_pgalloc.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717

1818
extern const char bad_pmd_string[];
1919

20-
#define __pte_free_tlb(tlb, pte, addr) \
21-
do { \
22-
pagetable_dtor(page_ptdesc(pte)); \
23-
tlb_remove_page_ptdesc((tlb), page_ptdesc(pte)); \
24-
} while (0)
20+
#define __pte_free_tlb(tlb, pte, addr) \
21+
tlb_remove_ptdesc((tlb), page_ptdesc(pte))
2522

2623
static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
2724
{

arch/microblaze/mm/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int page_is_ram(unsigned long pfn)
118118
/*
119119
* Check for command-line options that affect what MMU_init will do.
120120
*/
121-
static void mm_cmdline_setup(void)
121+
static void __init mm_cmdline_setup(void)
122122
{
123123
unsigned long maxmem = 0;
124124
char *p = cmd_line;

0 commit comments

Comments
 (0)