Skip to content

Commit 0b34fd0

Browse files
committed
Merge tag 'mm-hotfixes-stable-2025-12-28-21-50' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "27 hotfixes. 12 are cc:stable, 18 are MM. There's a patch series from Jiayuan Chen which fixes some issues with KASAN and vmalloc. Apart from that it's the usual shower of singletons - please see the respective changelogs for details" * tag 'mm-hotfixes-stable-2025-12-28-21-50' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (27 commits) mm/ksm: fix pte_unmap_unlock of wrong address in break_ksm_pmd_entry mm/page_owner: fix memory leak in page_owner_stack_fops->release() mm/memremap: fix spurious large folio warning for FS-DAX MAINTAINERS: notify the "Device Memory" community of memory hotplug changes sparse: update MAINTAINERS info mm/page_alloc: report 1 as zone_batchsize for !CONFIG_MMU mm: consider non-anon swap cache folios in folio_expected_ref_count() rust: maple_tree: rcu_read_lock() in destructor to silence lockdep mm: memcg: fix unit conversion for K() macro in OOM log mm: fixup pfnmap memory failure handling to use pgoff tools/mm/page_owner_sort: fix timestamp comparison for stable sorting selftests/mm: fix thread state check in uffd-unit-tests kernel/kexec: fix IMA when allocation happens in CMA area kernel/kexec: change the prototype of kimage_map_segment() MAINTAINERS: add ABI headers to KHO and LIVE UPDATE .mailmap: remove one of the entries for WangYuli mm/damon/vaddr: fix missing pte_unmap_unlock in damos_va_migrate_pmd_entry() MAINTAINERS: update one straggling entry for Bartosz Golaszewski mm/page_alloc: change all pageblocks migrate type on coalescing mm: leafops.h: correct kernel-doc function param. names ...
2 parents 7839932 + d6b5a8d commit 0b34fd0

26 files changed

Lines changed: 163 additions & 59 deletions

File tree

.mailmap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ Barry Song <[email protected]> <[email protected]>
127127
128128
129129
130-
Bartosz Golaszewski <[email protected]> <[email protected]>
130+
Bartosz Golaszewski <[email protected]> <[email protected]>
131+
Bartosz Golaszewski <[email protected]> <[email protected]>
131132
132133
133134
Ben Gardner <[email protected]>
@@ -857,7 +858,6 @@ Vladimir Davydov <[email protected]> <[email protected]>
857858
858859
859860
860-
861861
862862
863863

MAINTAINERS

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13959,6 +13959,7 @@ S: Maintained
1395913959
F: Documentation/admin-guide/mm/kho.rst
1396013960
F: Documentation/core-api/kho/*
1396113961
F: include/linux/kexec_handover.h
13962+
F: include/linux/kho/
1396213963
F: kernel/liveupdate/kexec_handover*
1396313964
F: lib/test_kho.c
1396413965
F: tools/testing/selftests/kho/
@@ -14637,6 +14638,7 @@ S: Maintained
1463714638
F: Documentation/core-api/liveupdate.rst
1463814639
F: Documentation/mm/memfd_preservation.rst
1463914640
F: Documentation/userspace-api/liveupdate.rst
14641+
F: include/linux/kho/abi/
1464014642
F: include/linux/liveupdate.h
1464114643
F: include/linux/liveupdate/
1464214644
F: include/uapi/linux/liveupdate.h
@@ -16426,6 +16428,7 @@ MEMORY HOT(UN)PLUG
1642616428
M: David Hildenbrand <[email protected]>
1642716429
M: Oscar Salvador <[email protected]>
1642816430
16431+
1642916432
S: Maintained
1643016433
F: Documentation/admin-guide/mm/memory-hotplug.rst
1643116434
F: Documentation/core-api/memory-hotplug.rst
@@ -16751,6 +16754,7 @@ F: tools/testing/selftests/mm/transhuge-stress.c
1675116754

1675216755
MEMORY MANAGEMENT - USERFAULTFD
1675316756
M: Andrew Morton <[email protected]>
16757+
M: Mike Rapoport <[email protected]>
1675416758
R: Peter Xu <[email protected]>
1675516759
1675616760
S: Maintained
@@ -21345,7 +21349,7 @@ F: Documentation/devicetree/bindings/net/qcom,bam-dmux.yaml
2134521349
F: drivers/net/wwan/qcom_bam_dmux.c
2134621350

2134721351
QUALCOMM BLUETOOTH DRIVER
21348-
M: Bartosz Golaszewski <brgl@bgdev.pl>
21352+
M: Bartosz Golaszewski <brgl@kernel.org>
2134921353
2135021354
S: Maintained
2135121355
F: drivers/bluetooth/btqca.[ch]
@@ -24571,7 +24575,7 @@ F: drivers/tty/vcc.c
2457124575
F: include/linux/sunserialcore.h
2457224576

2457324577
SPARSE CHECKER
24574-
M: "Luc Van Oostenryck" <[email protected]>
24578+
M: Chris Li <[email protected]>
2457524579
2457624580
S: Maintained
2457724581
W: https://sparse.docs.kernel.org/

include/linux/genalloc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ struct gen_pool;
4444
* @nr: The number of zeroed bits we're looking for
4545
* @data: optional additional data used by the callback
4646
* @pool: the pool being allocated from
47+
* @start_addr: start address of memory chunk
4748
*/
4849
typedef unsigned long (*genpool_algo_t)(unsigned long *map,
4950
unsigned long size,

include/linux/kasan.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ typedef unsigned int __bitwise kasan_vmalloc_flags_t;
2828
#define KASAN_VMALLOC_INIT ((__force kasan_vmalloc_flags_t)0x01u)
2929
#define KASAN_VMALLOC_VM_ALLOC ((__force kasan_vmalloc_flags_t)0x02u)
3030
#define KASAN_VMALLOC_PROT_NORMAL ((__force kasan_vmalloc_flags_t)0x04u)
31+
#define KASAN_VMALLOC_KEEP_TAG ((__force kasan_vmalloc_flags_t)0x08u)
3132

3233
#define KASAN_VMALLOC_PAGE_RANGE 0x1 /* Apply exsiting page range */
3334
#define KASAN_VMALLOC_TLB_FLUSH 0x2 /* TLB flush */
@@ -630,6 +631,16 @@ static __always_inline void kasan_poison_vmalloc(const void *start,
630631
__kasan_poison_vmalloc(start, size);
631632
}
632633

634+
void __kasan_unpoison_vmap_areas(struct vm_struct **vms, int nr_vms,
635+
kasan_vmalloc_flags_t flags);
636+
static __always_inline void
637+
kasan_unpoison_vmap_areas(struct vm_struct **vms, int nr_vms,
638+
kasan_vmalloc_flags_t flags)
639+
{
640+
if (kasan_enabled())
641+
__kasan_unpoison_vmap_areas(vms, nr_vms, flags);
642+
}
643+
633644
#else /* CONFIG_KASAN_VMALLOC */
634645

635646
static inline void kasan_populate_early_vm_area_shadow(void *start,
@@ -654,6 +665,11 @@ static inline void *kasan_unpoison_vmalloc(const void *start,
654665
static inline void kasan_poison_vmalloc(const void *start, unsigned long size)
655666
{ }
656667

668+
static __always_inline void
669+
kasan_unpoison_vmap_areas(struct vm_struct **vms, int nr_vms,
670+
kasan_vmalloc_flags_t flags)
671+
{ }
672+
657673
#endif /* CONFIG_KASAN_VMALLOC */
658674

659675
#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \

include/linux/kexec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ extern bool kexec_file_dbg_print;
530530
#define kexec_dprintk(fmt, arg...) \
531531
do { if (kexec_file_dbg_print) pr_info(fmt, ##arg); } while (0)
532532

533-
extern void *kimage_map_segment(struct kimage *image, unsigned long addr, unsigned long size);
533+
extern void *kimage_map_segment(struct kimage *image, int idx);
534534
extern void kimage_unmap_segment(void *buffer);
535535
#else /* !CONFIG_KEXEC_CORE */
536536
struct pt_regs;
@@ -540,7 +540,7 @@ static inline void __crash_kexec(struct pt_regs *regs) { }
540540
static inline void crash_kexec(struct pt_regs *regs) { }
541541
static inline int kexec_should_crash(struct task_struct *p) { return 0; }
542542
static inline int kexec_crash_loaded(void) { return 0; }
543-
static inline void *kimage_map_segment(struct kimage *image, unsigned long addr, unsigned long size)
543+
static inline void *kimage_map_segment(struct kimage *image, int idx)
544544
{ return NULL; }
545545
static inline void kimage_unmap_segment(void *buffer) { }
546546
#define kexec_in_progress false

include/linux/leafops.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static inline bool softleaf_is_none(softleaf_t entry)
133133

134134
/**
135135
* softleaf_type() - Identify the type of leaf entry.
136-
* @enntry: Leaf entry.
136+
* @entry: Leaf entry.
137137
*
138138
* Returns: the leaf entry type associated with @entry.
139139
*/
@@ -534,7 +534,7 @@ static inline bool pte_is_uffd_wp_marker(pte_t pte)
534534
/**
535535
* pte_is_uffd_marker() - Does this PTE entry encode a userfault-specific marker
536536
* leaf entry?
537-
* @entry: Leaf entry.
537+
* @pte: PTE entry.
538538
*
539539
* It's useful to be able to determine which leaf entries encode UFFD-specific
540540
* markers so we can handle these correctly.

include/linux/memory-failure.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ struct pfn_address_space;
99
struct pfn_address_space {
1010
struct interval_tree_node node;
1111
struct address_space *mapping;
12+
int (*pfn_to_vma_pgoff)(struct vm_area_struct *vma,
13+
unsigned long pfn, pgoff_t *pgoff);
1214
};
1315

1416
int register_pfn_address_space(struct pfn_address_space *pfn_space);

include/linux/mm.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,10 +2459,10 @@ static inline int folio_expected_ref_count(const struct folio *folio)
24592459
if (WARN_ON_ONCE(page_has_type(&folio->page) && !folio_test_hugetlb(folio)))
24602460
return 0;
24612461

2462-
if (folio_test_anon(folio)) {
2463-
/* One reference per page from the swapcache. */
2464-
ref_count += folio_test_swapcache(folio) << order;
2465-
} else {
2462+
/* One reference per page from the swapcache. */
2463+
ref_count += folio_test_swapcache(folio) << order;
2464+
2465+
if (!folio_test_anon(folio)) {
24662466
/* One reference per page from the pagecache. */
24672467
ref_count += !!folio->mapping << order;
24682468
/* One reference from PG_private. */

kernel/kexec_core.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -953,17 +953,24 @@ int kimage_load_segment(struct kimage *image, int idx)
953953
return result;
954954
}
955955

956-
void *kimage_map_segment(struct kimage *image,
957-
unsigned long addr, unsigned long size)
956+
void *kimage_map_segment(struct kimage *image, int idx)
958957
{
958+
unsigned long addr, size, eaddr;
959959
unsigned long src_page_addr, dest_page_addr = 0;
960-
unsigned long eaddr = addr + size;
961960
kimage_entry_t *ptr, entry;
962961
struct page **src_pages;
963962
unsigned int npages;
963+
struct page *cma;
964964
void *vaddr = NULL;
965965
int i;
966966

967+
cma = image->segment_cma[idx];
968+
if (cma)
969+
return page_address(cma);
970+
971+
addr = image->segment[idx].mem;
972+
size = image->segment[idx].memsz;
973+
eaddr = addr + size;
967974
/*
968975
* Collect the source pages and map them in a contiguous VA range.
969976
*/
@@ -1004,7 +1011,8 @@ void *kimage_map_segment(struct kimage *image,
10041011

10051012
void kimage_unmap_segment(void *segment_buffer)
10061013
{
1007-
vunmap(segment_buffer);
1014+
if (is_vmalloc_addr(segment_buffer))
1015+
vunmap(segment_buffer);
10081016
}
10091017

10101018
struct kexec_load_limit {

lib/idr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ int idr_alloc_u32(struct idr *idr, void *ptr, u32 *nextid,
4040

4141
if (WARN_ON_ONCE(!(idr->idr_rt.xa_flags & ROOT_IS_IDR)))
4242
idr->idr_rt.xa_flags |= IDR_RT_MARKER;
43+
if (max < base)
44+
return -ENOSPC;
4345

4446
id = (id < base) ? 0 : id - base;
4547
radix_tree_iter_init(&iter, id);

0 commit comments

Comments
 (0)