Skip to content

Commit d3c82f6

Browse files
committed
Merge tag 'mm-hotfixes-stable-2025-06-06-16-02' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "13 hotfixes. 6 are cc:stable and the remainder address post-6.15 issues or aren't considered necessary for -stable kernels. 11 are for MM" * tag 'mm-hotfixes-stable-2025-06-06-16-02' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: kernel/rcu/tree_stall: add /sys/kernel/rcu_stall_count MAINTAINERS: add mm swap section kmsan: test: add module description MAINTAINERS: add tlb trace events to MMU GATHER AND TLB INVALIDATION mm/hugetlb: fix huge_pmd_unshare() vs GUP-fast race mm/hugetlb: unshare page tables during VMA split, not before MAINTAINERS: add Alistair as reviewer of mm memory policy iov_iter: use iov_offset for length calculation in iov_iter_aligned_bvec mm/mempolicy: fix incorrect freeing of wi_kobj alloc_tag: handle module codetag load errors as module load failures mm/madvise: handle madvise_lock() failure during race unwinding mm: fix vmstat after removing NR_BOUNCE KVM: s390: rename PROT_NONE to PROT_TYPE_DUMMY
2 parents 949ea6f + 2da20fd commit d3c82f6

File tree

16 files changed

+160
-46
lines changed

16 files changed

+160
-46
lines changed

MAINTAINERS

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15818,6 +15818,7 @@ R: Rakie Kim <rakie.kim@sk.com>
1581815818
R: Byungchul Park <byungchul@sk.com>
1581915819
R: Gregory Price <gourry@gourry.net>
1582015820
R: Ying Huang <ying.huang@linux.alibaba.com>
15821+
R: Alistair Popple <apopple@nvidia.com>
1582115822
L: linux-mm@kvack.org
1582215823
S: Maintained
1582315824
W: http://www.linux-mm.org
@@ -15889,6 +15890,25 @@ S: Maintained
1588915890
F: include/linux/secretmem.h
1589015891
F: mm/secretmem.c
1589115892

15893+
MEMORY MANAGEMENT - SWAP
15894+
M: Andrew Morton <akpm@linux-foundation.org>
15895+
R: Kemeng Shi <shikemeng@huaweicloud.com>
15896+
R: Kairui Song <kasong@tencent.com>
15897+
R: Nhat Pham <nphamcs@gmail.com>
15898+
R: Baoquan He <bhe@redhat.com>
15899+
R: Barry Song <baohua@kernel.org>
15900+
R: Chris Li <chrisl@kernel.org>
15901+
L: linux-mm@kvack.org
15902+
S: Maintained
15903+
F: include/linux/swap.h
15904+
F: include/linux/swapfile.h
15905+
F: include/linux/swapops.h
15906+
F: mm/page_io.c
15907+
F: mm/swap.c
15908+
F: mm/swap.h
15909+
F: mm/swap_state.c
15910+
F: mm/swapfile.c
15911+
1589215912
MEMORY MANAGEMENT - THP (TRANSPARENT HUGE PAGE)
1589315913
M: Andrew Morton <akpm@linux-foundation.org>
1589415914
M: David Hildenbrand <david@redhat.com>
@@ -16727,6 +16747,7 @@ L: linux-mm@kvack.org
1672716747
S: Maintained
1672816748
F: arch/*/include/asm/tlb.h
1672916749
F: include/asm-generic/tlb.h
16750+
F: include/trace/events/tlb.h
1673016751
F: mm/mmu_gather.c
1673116752

1673216753
MN88472 MEDIA DRIVER

arch/s390/kvm/gaccess.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ enum prot_type {
319319
PROT_TYPE_DAT = 3,
320320
PROT_TYPE_IEP = 4,
321321
/* Dummy value for passing an initialized value when code != PGM_PROTECTION */
322-
PROT_NONE,
322+
PROT_TYPE_DUMMY,
323323
};
324324

325325
static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -335,7 +335,7 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
335335
switch (code) {
336336
case PGM_PROTECTION:
337337
switch (prot) {
338-
case PROT_NONE:
338+
case PROT_TYPE_DUMMY:
339339
/* We should never get here, acts like termination */
340340
WARN_ON_ONCE(1);
341341
break;
@@ -805,7 +805,7 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
805805
gpa = kvm_s390_real_to_abs(vcpu, ga);
806806
if (!kvm_is_gpa_in_memslot(vcpu->kvm, gpa)) {
807807
rc = PGM_ADDRESSING;
808-
prot = PROT_NONE;
808+
prot = PROT_TYPE_DUMMY;
809809
}
810810
}
811811
if (rc)
@@ -963,7 +963,7 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
963963
if (rc == PGM_PROTECTION)
964964
prot = PROT_TYPE_KEYC;
965965
else
966-
prot = PROT_NONE;
966+
prot = PROT_TYPE_DUMMY;
967967
rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate);
968968
}
969969
out_unlock:

include/linux/codetag.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ union codetag_ref {
3636
struct codetag_type_desc {
3737
const char *section;
3838
size_t tag_size;
39-
void (*module_load)(struct module *mod,
40-
struct codetag *start, struct codetag *end);
39+
int (*module_load)(struct module *mod,
40+
struct codetag *start, struct codetag *end);
4141
void (*module_unload)(struct module *mod,
4242
struct codetag *start, struct codetag *end);
4343
#ifdef CONFIG_MODULES
@@ -89,7 +89,7 @@ void *codetag_alloc_module_section(struct module *mod, const char *name,
8989
unsigned long align);
9090
void codetag_free_module_sections(struct module *mod);
9191
void codetag_module_replaced(struct module *mod, struct module *new_mod);
92-
void codetag_load_module(struct module *mod);
92+
int codetag_load_module(struct module *mod);
9393
void codetag_unload_module(struct module *mod);
9494

9595
#else /* defined(CONFIG_CODE_TAGGING) && defined(CONFIG_MODULES) */
@@ -103,7 +103,7 @@ codetag_alloc_module_section(struct module *mod, const char *name,
103103
unsigned long align) { return NULL; }
104104
static inline void codetag_free_module_sections(struct module *mod) {}
105105
static inline void codetag_module_replaced(struct module *mod, struct module *new_mod) {}
106-
static inline void codetag_load_module(struct module *mod) {}
106+
static inline int codetag_load_module(struct module *mod) { return 0; }
107107
static inline void codetag_unload_module(struct module *mod) {}
108108

109109
#endif /* defined(CONFIG_CODE_TAGGING) && defined(CONFIG_MODULES) */

include/linux/hugetlb.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ bool is_hugetlb_entry_migration(pte_t pte);
279279
bool is_hugetlb_entry_hwpoisoned(pte_t pte);
280280
void hugetlb_unshare_all_pmds(struct vm_area_struct *vma);
281281
void fixup_hugetlb_reservations(struct vm_area_struct *vma);
282+
void hugetlb_split(struct vm_area_struct *vma, unsigned long addr);
282283

283284
#else /* !CONFIG_HUGETLB_PAGE */
284285

@@ -476,6 +477,8 @@ static inline void fixup_hugetlb_reservations(struct vm_area_struct *vma)
476477
{
477478
}
478479

480+
static inline void hugetlb_split(struct vm_area_struct *vma, unsigned long addr) {}
481+
479482
#endif /* !CONFIG_HUGETLB_PAGE */
480483

481484
#ifndef pgd_write

kernel/module/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3386,11 +3386,12 @@ static int load_module(struct load_info *info, const char __user *uargs,
33863386
goto sysfs_cleanup;
33873387
}
33883388

3389+
if (codetag_load_module(mod))
3390+
goto sysfs_cleanup;
3391+
33893392
/* Get rid of temporary copy. */
33903393
free_copy(info, flags);
33913394

3392-
codetag_load_module(mod);
3393-
33943395
/* Done! */
33953396
trace_module_load(mod);
33963397

kernel/rcu/tree_stall.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,28 @@
2020
int sysctl_panic_on_rcu_stall __read_mostly;
2121
int sysctl_max_rcu_stall_to_panic __read_mostly;
2222

23+
#ifdef CONFIG_SYSFS
24+
25+
static unsigned int rcu_stall_count;
26+
27+
static ssize_t rcu_stall_count_show(struct kobject *kobj, struct kobj_attribute *attr,
28+
char *page)
29+
{
30+
return sysfs_emit(page, "%u\n", rcu_stall_count);
31+
}
32+
33+
static struct kobj_attribute rcu_stall_count_attr = __ATTR_RO(rcu_stall_count);
34+
35+
static __init int kernel_rcu_stall_sysfs_init(void)
36+
{
37+
sysfs_add_file_to_group(kernel_kobj, &rcu_stall_count_attr.attr, NULL);
38+
return 0;
39+
}
40+
41+
late_initcall(kernel_rcu_stall_sysfs_init);
42+
43+
#endif // CONFIG_SYSFS
44+
2345
#ifdef CONFIG_PROVE_RCU
2446
#define RCU_STALL_DELAY_DELTA (5 * HZ)
2547
#else
@@ -784,6 +806,10 @@ static void check_cpu_stall(struct rcu_data *rdp)
784806
if (kvm_check_and_clear_guest_paused())
785807
return;
786808

809+
#ifdef CONFIG_SYSFS
810+
++rcu_stall_count;
811+
#endif
812+
787813
rcu_stall_notifier_call_chain(RCU_STALL_NOTIFY_NORM, (void *)j - gps);
788814
if (READ_ONCE(csd_lock_suppress_rcu_stall) && csd_lock_is_stuck()) {
789815
pr_err("INFO: %s detected stall, but suppressed full report due to a stuck CSD-lock.\n", rcu_state.name);

lib/alloc_tag.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -607,15 +607,16 @@ static void release_module_tags(struct module *mod, bool used)
607607
mas_unlock(&mas);
608608
}
609609

610-
static void load_module(struct module *mod, struct codetag *start, struct codetag *stop)
610+
static int load_module(struct module *mod, struct codetag *start, struct codetag *stop)
611611
{
612612
/* Allocate module alloc_tag percpu counters */
613613
struct alloc_tag *start_tag;
614614
struct alloc_tag *stop_tag;
615615
struct alloc_tag *tag;
616616

617+
/* percpu counters for core allocations are already statically allocated */
617618
if (!mod)
618-
return;
619+
return 0;
619620

620621
start_tag = ct_to_alloc_tag(start);
621622
stop_tag = ct_to_alloc_tag(stop);
@@ -627,12 +628,13 @@ static void load_module(struct module *mod, struct codetag *start, struct codeta
627628
free_percpu(tag->counters);
628629
tag->counters = NULL;
629630
}
630-
shutdown_mem_profiling(true);
631-
pr_err("Failed to allocate memory for allocation tag percpu counters in the module %s. Memory allocation profiling is disabled!\n",
631+
pr_err("Failed to allocate memory for allocation tag percpu counters in the module %s\n",
632632
mod->name);
633-
break;
633+
return -ENOMEM;
634634
}
635635
}
636+
637+
return 0;
636638
}
637639

638640
static void replace_module(struct module *mod, struct module *new_mod)

lib/codetag.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ static int codetag_module_init(struct codetag_type *cttype, struct module *mod)
167167
{
168168
struct codetag_range range;
169169
struct codetag_module *cmod;
170+
int mod_id;
170171
int err;
171172

172173
range = get_section_range(mod, cttype->desc.section);
@@ -190,11 +191,20 @@ static int codetag_module_init(struct codetag_type *cttype, struct module *mod)
190191
cmod->range = range;
191192

192193
down_write(&cttype->mod_lock);
193-
err = idr_alloc(&cttype->mod_idr, cmod, 0, 0, GFP_KERNEL);
194-
if (err >= 0) {
195-
cttype->count += range_size(cttype, &range);
196-
if (cttype->desc.module_load)
197-
cttype->desc.module_load(mod, range.start, range.stop);
194+
mod_id = idr_alloc(&cttype->mod_idr, cmod, 0, 0, GFP_KERNEL);
195+
if (mod_id >= 0) {
196+
if (cttype->desc.module_load) {
197+
err = cttype->desc.module_load(mod, range.start, range.stop);
198+
if (!err)
199+
cttype->count += range_size(cttype, &range);
200+
else
201+
idr_remove(&cttype->mod_idr, mod_id);
202+
} else {
203+
cttype->count += range_size(cttype, &range);
204+
err = 0;
205+
}
206+
} else {
207+
err = mod_id;
198208
}
199209
up_write(&cttype->mod_lock);
200210

@@ -295,17 +305,23 @@ void codetag_module_replaced(struct module *mod, struct module *new_mod)
295305
mutex_unlock(&codetag_lock);
296306
}
297307

298-
void codetag_load_module(struct module *mod)
308+
int codetag_load_module(struct module *mod)
299309
{
300310
struct codetag_type *cttype;
311+
int ret = 0;
301312

302313
if (!mod)
303-
return;
314+
return 0;
304315

305316
mutex_lock(&codetag_lock);
306-
list_for_each_entry(cttype, &codetag_types, link)
307-
codetag_module_init(cttype, mod);
317+
list_for_each_entry(cttype, &codetag_types, link) {
318+
ret = codetag_module_init(cttype, mod);
319+
if (ret)
320+
break;
321+
}
308322
mutex_unlock(&codetag_lock);
323+
324+
return ret;
309325
}
310326

311327
void codetag_unload_module(struct module *mod)

lib/iov_iter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ static bool iov_iter_aligned_bvec(const struct iov_iter *i, unsigned addr_mask,
817817
size_t size = i->count;
818818

819819
do {
820-
size_t len = bvec->bv_len;
820+
size_t len = bvec->bv_len - skip;
821821

822822
if (len > size)
823823
len = size;

0 commit comments

Comments
 (0)