Skip to content

Commit 4f553c1

Browse files
committed
Merge tag 'mm-hotfixes-stable-2025-09-10-20-00' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "20 hotfixes. 15 are cc:stable and the remainder address post-6.16 issues or aren't considered necessary for -stable kernels. 14 of these fixes are for MM. This includes - kexec fixes from Breno for a recently introduced use-uninitialized bug - DAMON fixes from Quanmin Yan to avoid div-by-zero crashes which can occur if the operator uses poorly-chosen insmod parameters and misc singleton fixes" * tag 'mm-hotfixes-stable-2025-09-10-20-00' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: MAINTAINERS: add tree entry to numa memblocks and emulation block mm/damon/sysfs: fix use-after-free in state_show() proc: fix type confusion in pde_set_flags() compiler-clang.h: define __SANITIZE_*__ macros only when undefined mm/vmalloc, mm/kasan: respect gfp mask in kasan_populate_vmalloc() ocfs2: fix recursive semaphore deadlock in fiemap call mm/memory-failure: fix VM_BUG_ON_PAGE(PagePoisoned(page)) when unpoison memory mm/mremap: fix regression in vrm->new_addr check percpu: fix race on alloc failed warning limit mm/memory-failure: fix redundant updates for already poisoned pages s390: kexec: initialize kexec_buf struct riscv: kexec: initialize kexec_buf struct arm64: kexec: initialize kexec_buf struct in load_other_segments() mm/damon/reclaim: avoid divide-by-zero in damon_reclaim_apply_parameters() mm/damon/lru_sort: avoid divide-by-zero in damon_lru_sort_apply_parameters() mm/damon/core: set quota->charged_from to jiffies at first charge window mm/hugetlb: add missing hugetlb_lock in __unmap_hugepage_range() init/main.c: fix boot time tracing crash mm/memory_hotplug: fix hwpoisoned large folio handling in do_migrate_range() mm/khugepaged: fix the address passed to notifier on testing young
2 parents 223ba8e + a68172d commit 4f553c1

File tree

22 files changed

+140
-62
lines changed

22 files changed

+140
-62
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16128,6 +16128,7 @@ M: Andrew Morton <[email protected]>
1612816128
M: Mike Rapoport <[email protected]>
1612916129
1613016130
S: Maintained
16131+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git
1613116132
F: include/linux/numa_memblks.h
1613216133
F: mm/numa.c
1613316134
F: mm/numa_emulation.c

arch/arm64/kernel/machine_kexec_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ int load_other_segments(struct kimage *image,
9494
char *initrd, unsigned long initrd_len,
9595
char *cmdline)
9696
{
97-
struct kexec_buf kbuf;
97+
struct kexec_buf kbuf = {};
9898
void *dtb = NULL;
9999
unsigned long initrd_load_addr = 0, dtb_len,
100100
orig_segments = image->nr_segments;

arch/s390/kernel/kexec_elf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
static int kexec_file_add_kernel_elf(struct kimage *image,
1717
struct s390_load_data *data)
1818
{
19-
struct kexec_buf buf;
19+
struct kexec_buf buf = {};
2020
const Elf_Ehdr *ehdr;
2121
const Elf_Phdr *phdr;
2222
Elf_Addr entry;

arch/s390/kernel/kexec_image.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
static int kexec_file_add_kernel_image(struct kimage *image,
1717
struct s390_load_data *data)
1818
{
19-
struct kexec_buf buf;
19+
struct kexec_buf buf = {};
2020

2121
buf.image = image;
2222

arch/s390/kernel/machine_kexec_file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int kexec_file_update_purgatory(struct kimage *image,
129129
static int kexec_file_add_purgatory(struct kimage *image,
130130
struct s390_load_data *data)
131131
{
132-
struct kexec_buf buf;
132+
struct kexec_buf buf = {};
133133
int ret;
134134

135135
buf.image = image;
@@ -152,7 +152,7 @@ static int kexec_file_add_purgatory(struct kimage *image,
152152
static int kexec_file_add_initrd(struct kimage *image,
153153
struct s390_load_data *data)
154154
{
155-
struct kexec_buf buf;
155+
struct kexec_buf buf = {};
156156
int ret;
157157

158158
buf.image = image;
@@ -184,7 +184,7 @@ static int kexec_file_add_ipl_report(struct kimage *image,
184184
{
185185
__u32 *lc_ipl_parmblock_ptr;
186186
unsigned int len, ncerts;
187-
struct kexec_buf buf;
187+
struct kexec_buf buf = {};
188188
unsigned long addr;
189189
void *ptr, *end;
190190
int ret;

fs/ocfs2/extent_map.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,8 @@ int ocfs2_extent_map_get_blocks(struct inode *inode, u64 v_blkno, u64 *p_blkno,
706706
* it not only handles the fiemap for inlined files, but also deals
707707
* with the fast symlink, cause they have no difference for extent
708708
* mapping per se.
709+
*
710+
* Must be called with ip_alloc_sem semaphore held.
709711
*/
710712
static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
711713
struct fiemap_extent_info *fieinfo,
@@ -717,6 +719,7 @@ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
717719
u64 phys;
718720
u32 flags = FIEMAP_EXTENT_DATA_INLINE|FIEMAP_EXTENT_LAST;
719721
struct ocfs2_inode_info *oi = OCFS2_I(inode);
722+
lockdep_assert_held_read(&oi->ip_alloc_sem);
720723

721724
di = (struct ocfs2_dinode *)di_bh->b_data;
722725
if (ocfs2_inode_is_fast_symlink(inode))
@@ -732,8 +735,11 @@ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh,
732735
phys += offsetof(struct ocfs2_dinode,
733736
id2.i_data.id_data);
734737

738+
/* Release the ip_alloc_sem to prevent deadlock on page fault */
739+
up_read(&OCFS2_I(inode)->ip_alloc_sem);
735740
ret = fiemap_fill_next_extent(fieinfo, 0, phys, id_count,
736741
flags);
742+
down_read(&OCFS2_I(inode)->ip_alloc_sem);
737743
if (ret < 0)
738744
return ret;
739745
}
@@ -802,9 +808,11 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
802808
len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits;
803809
phys_bytes = le64_to_cpu(rec.e_blkno) << osb->sb->s_blocksize_bits;
804810
virt_bytes = (u64)le32_to_cpu(rec.e_cpos) << osb->s_clustersize_bits;
805-
811+
/* Release the ip_alloc_sem to prevent deadlock on page fault */
812+
up_read(&OCFS2_I(inode)->ip_alloc_sem);
806813
ret = fiemap_fill_next_extent(fieinfo, virt_bytes, phys_bytes,
807814
len_bytes, fe_flags);
815+
down_read(&OCFS2_I(inode)->ip_alloc_sem);
808816
if (ret)
809817
break;
810818

fs/proc/generic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,8 @@ struct proc_dir_entry *proc_register(struct proc_dir_entry *dir,
393393
if (proc_alloc_inum(&dp->low_ino))
394394
goto out_free_entry;
395395

396-
pde_set_flags(dp);
396+
if (!S_ISDIR(dp->mode))
397+
pde_set_flags(dp);
397398

398399
write_lock(&proc_subdir_lock);
399400
dp->parent = dir;

include/linux/compiler-clang.h

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,42 @@
1818
#define KASAN_ABI_VERSION 5
1919

2020
/*
21+
* Clang 22 added preprocessor macros to match GCC, in hopes of eventually
22+
* dropping __has_feature support for sanitizers:
23+
* https://github.com/llvm/llvm-project/commit/568c23bbd3303518c5056d7f03444dae4fdc8a9c
24+
* Create these macros for older versions of clang so that it is easy to clean
25+
* up once the minimum supported version of LLVM for building the kernel always
26+
* creates these macros.
27+
*
2128
* Note: Checking __has_feature(*_sanitizer) is only true if the feature is
2229
* enabled. Therefore it is not required to additionally check defined(CONFIG_*)
2330
* to avoid adding redundant attributes in other configurations.
2431
*/
32+
#if __has_feature(address_sanitizer) && !defined(__SANITIZE_ADDRESS__)
33+
#define __SANITIZE_ADDRESS__
34+
#endif
35+
#if __has_feature(hwaddress_sanitizer) && !defined(__SANITIZE_HWADDRESS__)
36+
#define __SANITIZE_HWADDRESS__
37+
#endif
38+
#if __has_feature(thread_sanitizer) && !defined(__SANITIZE_THREAD__)
39+
#define __SANITIZE_THREAD__
40+
#endif
2541

26-
#if __has_feature(address_sanitizer) || __has_feature(hwaddress_sanitizer)
27-
/* Emulate GCC's __SANITIZE_ADDRESS__ flag */
42+
/*
43+
* Treat __SANITIZE_HWADDRESS__ the same as __SANITIZE_ADDRESS__ in the kernel.
44+
*/
45+
#ifdef __SANITIZE_HWADDRESS__
2846
#define __SANITIZE_ADDRESS__
47+
#endif
48+
49+
#ifdef __SANITIZE_ADDRESS__
2950
#define __no_sanitize_address \
3051
__attribute__((no_sanitize("address", "hwaddress")))
3152
#else
3253
#define __no_sanitize_address
3354
#endif
3455

35-
#if __has_feature(thread_sanitizer)
36-
/* emulate gcc's __SANITIZE_THREAD__ flag */
37-
#define __SANITIZE_THREAD__
56+
#ifdef __SANITIZE_THREAD__
3857
#define __no_sanitize_thread \
3958
__attribute__((no_sanitize("thread")))
4059
#else

include/linux/kasan.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ static inline void kasan_init_hw_tags(void) { }
562562
#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
563563

564564
void kasan_populate_early_vm_area_shadow(void *start, unsigned long size);
565-
int kasan_populate_vmalloc(unsigned long addr, unsigned long size);
565+
int kasan_populate_vmalloc(unsigned long addr, unsigned long size, gfp_t gfp_mask);
566566
void kasan_release_vmalloc(unsigned long start, unsigned long end,
567567
unsigned long free_region_start,
568568
unsigned long free_region_end,
@@ -574,7 +574,7 @@ static inline void kasan_populate_early_vm_area_shadow(void *start,
574574
unsigned long size)
575575
{ }
576576
static inline int kasan_populate_vmalloc(unsigned long start,
577-
unsigned long size)
577+
unsigned long size, gfp_t gfp_mask)
578578
{
579579
return 0;
580580
}
@@ -610,7 +610,7 @@ static __always_inline void kasan_poison_vmalloc(const void *start,
610610
static inline void kasan_populate_early_vm_area_shadow(void *start,
611611
unsigned long size) { }
612612
static inline int kasan_populate_vmalloc(unsigned long start,
613-
unsigned long size)
613+
unsigned long size, gfp_t gfp_mask)
614614
{
615615
return 0;
616616
}

init/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,7 @@ void start_kernel(void)
956956
sort_main_extable();
957957
trap_init();
958958
mm_core_init();
959+
maple_tree_init();
959960
poking_init();
960961
ftrace_init();
961962

@@ -973,7 +974,6 @@ void start_kernel(void)
973974
"Interrupts were enabled *very* early, fixing it\n"))
974975
local_irq_disable();
975976
radix_tree_init();
976-
maple_tree_init();
977977

978978
/*
979979
* Set up housekeeping before setting up workqueues to allow the unbound

0 commit comments

Comments
 (0)