Skip to content

Commit 7ba45f1

Browse files
committed
Merge tag 'mm-hotfixes-stable-2025-11-16-10-40' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "7 hotfixes. 5 are cc:stable, 4 are against mm/ All are singletons - please see the respective changelogs for details" * tag 'mm-hotfixes-stable-2025-11-16-10-40' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: mm, swap: fix potential UAF issue for VMA readahead selftests/user_events: fix type cast for write_index packed member in perf_test lib/test_kho: check if KHO is enabled mm/huge_memory: fix folio split check for anon folios in swapcache MAINTAINERS: update David Hildenbrand's email address crash: fix crashkernel resource shrink mm: fix MAX_FOLIO_ORDER on powerpc configs with hugetlb
2 parents 7254a2b + 1c2a936 commit 7ba45f1

File tree

11 files changed

+55
-22
lines changed

11 files changed

+55
-22
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ Danilo Krummrich <[email protected]> <[email protected]>
206206
David Brownell <[email protected]>
207207
208208
209+
209210
210211
211212

MAINTAINERS

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11528,7 +11528,7 @@ F: include/linux/platform_data/huawei-gaokun-ec.h
1152811528
HUGETLB SUBSYSTEM
1152911529
M: Muchun Song <[email protected]>
1153011530
M: Oscar Salvador <[email protected]>
11531-
R: David Hildenbrand <david@redhat.com>
11531+
R: David Hildenbrand <david@kernel.org>
1153211532
1153311533
S: Maintained
1153411534
F: Documentation/ABI/testing/sysfs-kernel-mm-hugepages
@@ -13735,7 +13735,7 @@ KERNEL VIRTUAL MACHINE for s390 (KVM/s390)
1373513735
M: Christian Borntraeger <[email protected]>
1373613736
M: Janosch Frank <[email protected]>
1373713737
M: Claudio Imbrenda <[email protected]>
13738-
R: David Hildenbrand <david@redhat.com>
13738+
R: David Hildenbrand <david@kernel.org>
1373913739
1374013740
S: Supported
1374113741
T: git git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
@@ -16222,7 +16222,7 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
1622216222
F: drivers/devfreq/tegra30-devfreq.c
1622316223

1622416224
MEMORY HOT(UN)PLUG
16225-
M: David Hildenbrand <david@redhat.com>
16225+
M: David Hildenbrand <david@kernel.org>
1622616226
M: Oscar Salvador <[email protected]>
1622716227
1622816228
S: Maintained
@@ -16247,7 +16247,7 @@ F: tools/mm/
1624716247

1624816248
MEMORY MANAGEMENT - CORE
1624916249
M: Andrew Morton <[email protected]>
16250-
M: David Hildenbrand <david@redhat.com>
16250+
M: David Hildenbrand <david@kernel.org>
1625116251
R: Lorenzo Stoakes <[email protected]>
1625216252
R: Liam R. Howlett <[email protected]>
1625316253
R: Vlastimil Babka <[email protected]>
@@ -16303,7 +16303,7 @@ F: mm/execmem.c
1630316303

1630416304
MEMORY MANAGEMENT - GUP (GET USER PAGES)
1630516305
M: Andrew Morton <[email protected]>
16306-
M: David Hildenbrand <david@redhat.com>
16306+
M: David Hildenbrand <david@kernel.org>
1630716307
R: Jason Gunthorpe <[email protected]>
1630816308
R: John Hubbard <[email protected]>
1630916309
R: Peter Xu <[email protected]>
@@ -16319,7 +16319,7 @@ F: tools/testing/selftests/mm/gup_test.c
1631916319

1632016320
MEMORY MANAGEMENT - KSM (Kernel Samepage Merging)
1632116321
M: Andrew Morton <[email protected]>
16322-
M: David Hildenbrand <david@redhat.com>
16322+
M: David Hildenbrand <david@kernel.org>
1632316323
R: Xu Xin <[email protected]>
1632416324
R: Chengming Zhou <[email protected]>
1632516325
@@ -16335,7 +16335,7 @@ F: mm/mm_slot.h
1633516335

1633616336
MEMORY MANAGEMENT - MEMORY POLICY AND MIGRATION
1633716337
M: Andrew Morton <[email protected]>
16338-
M: David Hildenbrand <david@redhat.com>
16338+
M: David Hildenbrand <david@kernel.org>
1633916339
R: Zi Yan <[email protected]>
1634016340
R: Matthew Brost <[email protected]>
1634116341
R: Joshua Hahn <[email protected]>
@@ -16375,7 +16375,7 @@ F: mm/workingset.c
1637516375

1637616376
MEMORY MANAGEMENT - MISC
1637716377
M: Andrew Morton <[email protected]>
16378-
M: David Hildenbrand <david@redhat.com>
16378+
M: David Hildenbrand <david@kernel.org>
1637916379
R: Lorenzo Stoakes <[email protected]>
1638016380
R: Liam R. Howlett <[email protected]>
1638116381
R: Vlastimil Babka <[email protected]>
@@ -16463,7 +16463,7 @@ F: mm/shuffle.h
1646316463
MEMORY MANAGEMENT - RECLAIM
1646416464
M: Andrew Morton <[email protected]>
1646516465
M: Johannes Weiner <[email protected]>
16466-
R: David Hildenbrand <david@redhat.com>
16466+
R: David Hildenbrand <david@kernel.org>
1646716467
R: Michal Hocko <[email protected]>
1646816468
R: Qi Zheng <[email protected]>
1646916469
R: Shakeel Butt <[email protected]>
@@ -16476,7 +16476,7 @@ F: mm/workingset.c
1647616476

1647716477
MEMORY MANAGEMENT - RMAP (REVERSE MAPPING)
1647816478
M: Andrew Morton <[email protected]>
16479-
M: David Hildenbrand <david@redhat.com>
16479+
M: David Hildenbrand <david@kernel.org>
1648016480
M: Lorenzo Stoakes <[email protected]>
1648116481
R: Rik van Riel <[email protected]>
1648216482
R: Liam R. Howlett <[email protected]>
@@ -16521,7 +16521,7 @@ F: mm/swapfile.c
1652116521

1652216522
MEMORY MANAGEMENT - THP (TRANSPARENT HUGE PAGE)
1652316523
M: Andrew Morton <[email protected]>
16524-
M: David Hildenbrand <david@redhat.com>
16524+
M: David Hildenbrand <david@kernel.org>
1652516525
M: Lorenzo Stoakes <[email protected]>
1652616526
R: Zi Yan <[email protected]>
1652716527
R: Baolin Wang <[email protected]>
@@ -16623,7 +16623,7 @@ MEMORY MAPPING - MADVISE (MEMORY ADVICE)
1662316623
M: Andrew Morton <[email protected]>
1662416624
M: Liam R. Howlett <[email protected]>
1662516625
M: Lorenzo Stoakes <[email protected]>
16626-
M: David Hildenbrand <david@redhat.com>
16626+
M: David Hildenbrand <david@kernel.org>
1662716627
R: Vlastimil Babka <[email protected]>
1662816628
R: Jann Horn <[email protected]>
1662916629
@@ -27090,7 +27090,7 @@ F: net/vmw_vsock/virtio_transport_common.c
2709027090

2709127091
VIRTIO BALLOON
2709227092
M: "Michael S. Tsirkin" <[email protected]>
27093-
M: David Hildenbrand <david@redhat.com>
27093+
M: David Hildenbrand <david@kernel.org>
2709427094
2709527095
S: Maintained
2709627096
F: drivers/virtio/virtio_balloon.c
@@ -27245,7 +27245,7 @@ F: drivers/iommu/virtio-iommu.c
2724527245
F: include/uapi/linux/virtio_iommu.h
2724627246

2724727247
VIRTIO MEM DRIVER
27248-
M: David Hildenbrand <david@redhat.com>
27248+
M: David Hildenbrand <david@kernel.org>
2724927249
2725027250
S: Maintained
2725127251
W: https://virtio-mem.gitlab.io/

arch/powerpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ config PPC
137137
select ARCH_HAS_DMA_OPS if PPC64
138138
select ARCH_HAS_FORTIFY_SOURCE
139139
select ARCH_HAS_GCOV_PROFILE_ALL
140+
select ARCH_HAS_GIGANTIC_PAGE if ARCH_SUPPORTS_HUGETLBFS
140141
select ARCH_HAS_KCOV
141142
select ARCH_HAS_KERNEL_FPU_SUPPORT if PPC64 && PPC_FPU
142143
select ARCH_HAS_MEMBARRIER_CALLBACKS

arch/powerpc/platforms/Kconfig.cputype

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ config PPC_64S_HASH_MMU
423423
config PPC_RADIX_MMU
424424
bool "Radix MMU Support"
425425
depends on PPC_BOOK3S_64
426-
select ARCH_HAS_GIGANTIC_PAGE
427426
default y
428427
help
429428
Enable support for the Power ISA 3.0 Radix style MMU. Currently this

include/linux/mm.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ static inline unsigned long folio_nr_pages(const struct folio *folio)
20742074
return folio_large_nr_pages(folio);
20752075
}
20762076

2077-
#if !defined(CONFIG_ARCH_HAS_GIGANTIC_PAGE)
2077+
#if !defined(CONFIG_HAVE_GIGANTIC_FOLIOS)
20782078
/*
20792079
* We don't expect any folios that exceed buddy sizes (and consequently
20802080
* memory sections).
@@ -2087,10 +2087,17 @@ static inline unsigned long folio_nr_pages(const struct folio *folio)
20872087
* pages are guaranteed to be contiguous.
20882088
*/
20892089
#define MAX_FOLIO_ORDER PFN_SECTION_SHIFT
2090-
#else
2090+
#elif defined(CONFIG_HUGETLB_PAGE)
20912091
/*
20922092
* There is no real limit on the folio size. We limit them to the maximum we
2093-
* currently expect (e.g., hugetlb, dax).
2093+
* currently expect (see CONFIG_HAVE_GIGANTIC_FOLIOS): with hugetlb, we expect
2094+
* no folios larger than 16 GiB on 64bit and 1 GiB on 32bit.
2095+
*/
2096+
#define MAX_FOLIO_ORDER get_order(IS_ENABLED(CONFIG_64BIT) ? SZ_16G : SZ_1G)
2097+
#else
2098+
/*
2099+
* Without hugetlb, gigantic folios that are bigger than a single PUD are
2100+
* currently impossible.
20942101
*/
20952102
#define MAX_FOLIO_ORDER PUD_ORDER
20962103
#endif

kernel/crash_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ static int __crash_shrink_memory(struct resource *old_res,
373373
old_res->start = 0;
374374
old_res->end = 0;
375375
} else {
376-
crashk_res.end = ram_res->start - 1;
376+
old_res->end = ram_res->start - 1;
377377
}
378378

379379
crash_free_reserved_phys_range(ram_res->start, ram_res->end);

lib/test_kho.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,9 @@ static int __init kho_test_init(void)
301301
phys_addr_t fdt_phys;
302302
int err;
303303

304+
if (!kho_is_enabled())
305+
return 0;
306+
304307
err = kho_retrieve_subtree(KHO_TEST_FDT, &fdt_phys);
305308
if (!err)
306309
return kho_test_restore(fdt_phys);

mm/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,13 @@ config PAGE_MAPCOUNT
908908
config PGTABLE_HAS_HUGE_LEAVES
909909
def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE
910910

911+
#
912+
# We can end up creating gigantic folio.
913+
#
914+
config HAVE_GIGANTIC_FOLIOS
915+
def_bool (HUGETLB_PAGE && ARCH_HAS_GIGANTIC_PAGE) || \
916+
(ZONE_DEVICE && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
917+
911918
# TODO: Allow to be enabled without THP
912919
config ARCH_SUPPORTS_HUGE_PFNMAP
913920
def_bool n

mm/huge_memory.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3522,7 +3522,8 @@ bool non_uniform_split_supported(struct folio *folio, unsigned int new_order,
35223522
/* order-1 is not supported for anonymous THP. */
35233523
VM_WARN_ONCE(warns && new_order == 1,
35243524
"Cannot split to order-1 folio");
3525-
return new_order != 1;
3525+
if (new_order == 1)
3526+
return false;
35263527
} else if (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS) &&
35273528
!mapping_large_folio_support(folio->mapping)) {
35283529
/*
@@ -3553,7 +3554,8 @@ bool uniform_split_supported(struct folio *folio, unsigned int new_order,
35533554
if (folio_test_anon(folio)) {
35543555
VM_WARN_ONCE(warns && new_order == 1,
35553556
"Cannot split to order-1 folio");
3556-
return new_order != 1;
3557+
if (new_order == 1)
3558+
return false;
35573559
} else if (new_order) {
35583560
if (IS_ENABLED(CONFIG_READ_ONLY_THP_FOR_FS) &&
35593561
!mapping_large_folio_support(folio->mapping)) {

mm/swap_state.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static struct folio *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask,
748748

749749
blk_start_plug(&plug);
750750
for (addr = start; addr < end; ilx++, addr += PAGE_SIZE) {
751+
struct swap_info_struct *si = NULL;
752+
751753
if (!pte++) {
752754
pte = pte_offset_map(vmf->pmd, addr);
753755
if (!pte)
@@ -761,8 +763,19 @@ static struct folio *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask,
761763
continue;
762764
pte_unmap(pte);
763765
pte = NULL;
766+
/*
767+
* Readahead entry may come from a device that we are not
768+
* holding a reference to, try to grab a reference, or skip.
769+
*/
770+
if (swp_type(entry) != swp_type(targ_entry)) {
771+
si = get_swap_device(entry);
772+
if (!si)
773+
continue;
774+
}
764775
folio = __read_swap_cache_async(entry, gfp_mask, mpol, ilx,
765776
&page_allocated, false);
777+
if (si)
778+
put_swap_device(si);
766779
if (!folio)
767780
continue;
768781
if (page_allocated) {

0 commit comments

Comments
 (0)