Skip to content

Commit 12ee72f

Browse files
committed
Merge tag 'mm-hotfixes-stable-2023-11-17-14-04' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "Thirteen hotfixes. Seven are cc:stable and the remainder pertain to post-6.6 issues or aren't considered suitable for backporting" * tag 'mm-hotfixes-stable-2023-11-17-14-04' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: mm: more ptep_get() conversion parisc: fix mmap_base calculation when stack grows upwards mm/damon/core.c: avoid unintentional filtering out of schemes mm: kmem: drop __GFP_NOFAIL when allocating objcg vectors mm/damon/sysfs-schemes: handle tried region directory allocation failure mm/damon/sysfs-schemes: handle tried regions sysfs directory allocation failure mm/damon/sysfs: check error from damon_sysfs_update_target() mm: fix for negative counter: nr_file_hugepages selftests/mm: add hugetlb_fault_after_madv to .gitignore selftests/mm: restore number of hugepages selftests: mm: fix some build warnings selftests: mm: skip whole test instead of failure mm/damon/sysfs: eliminate potential uninitialized variable warning
2 parents ffd75bc + afccb08 commit 12ee72f

File tree

16 files changed

+57
-38
lines changed

16 files changed

+57
-38
lines changed

arch/parisc/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ config ARCH_MMAP_RND_COMPAT_BITS_MIN
140140
default 8
141141

142142
config ARCH_MMAP_RND_BITS_MAX
143-
default 24 if 64BIT
144-
default 17
143+
default 18 if 64BIT
144+
default 13
145145

146146
config ARCH_MMAP_RND_COMPAT_BITS_MAX
147-
default 17
147+
default 13
148148

149149
# unless you want to implement ACPI on PA-RISC ... ;-)
150150
config PM

arch/parisc/include/asm/elf.h

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -349,15 +349,7 @@ struct pt_regs; /* forward declaration... */
349349

350350
#define ELF_HWCAP 0
351351

352-
/* Masks for stack and mmap randomization */
353-
#define BRK_RND_MASK (is_32bit_task() ? 0x07ffUL : 0x3ffffUL)
354-
#define MMAP_RND_MASK (is_32bit_task() ? 0x1fffUL : 0x3ffffUL)
355-
#define STACK_RND_MASK MMAP_RND_MASK
356-
357-
struct mm_struct;
358-
extern unsigned long arch_randomize_brk(struct mm_struct *);
359-
#define arch_randomize_brk arch_randomize_brk
360-
352+
#define STACK_RND_MASK 0x7ff /* 8MB of VA */
361353

362354
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
363355
struct linux_binprm;

arch/parisc/include/asm/processor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747

4848
#ifndef __ASSEMBLY__
4949

50+
struct rlimit;
51+
unsigned long mmap_upper_limit(struct rlimit *rlim_stack);
5052
unsigned long calc_max_stack_size(unsigned long stack_max);
5153

5254
/*

arch/parisc/kernel/sys_parisc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ unsigned long calc_max_stack_size(unsigned long stack_max)
7777
* indicating that "current" should be used instead of a passed-in
7878
* value from the exec bprm as done with arch_pick_mmap_layout().
7979
*/
80-
static unsigned long mmap_upper_limit(struct rlimit *rlim_stack)
80+
unsigned long mmap_upper_limit(struct rlimit *rlim_stack)
8181
{
8282
unsigned long stack_base;
8383

mm/damon/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ static bool __damos_filter_out(struct damon_ctx *ctx, struct damon_target *t,
924924
matched = true;
925925
break;
926926
default:
927-
break;
927+
return false;
928928
}
929929

930930
return matched == filter->matching;

mm/damon/sysfs-schemes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ damon_sysfs_scheme_regions_alloc(void)
162162
struct damon_sysfs_scheme_regions *regions = kmalloc(sizeof(*regions),
163163
GFP_KERNEL);
164164

165+
if (!regions)
166+
return NULL;
167+
165168
regions->kobj = (struct kobject){};
166169
INIT_LIST_HEAD(&regions->regions_list);
167170
regions->nr_regions = 0;
@@ -1823,6 +1826,8 @@ static int damon_sysfs_before_damos_apply(struct damon_ctx *ctx,
18231826
return 0;
18241827

18251828
region = damon_sysfs_scheme_region_alloc(r);
1829+
if (!region)
1830+
return 0;
18261831
list_add_tail(&region->list, &sysfs_regions->regions_list);
18271832
sysfs_regions->nr_regions++;
18281833
if (kobject_init_and_add(&region->kobj,

mm/damon/sysfs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ static int damon_sysfs_update_target(struct damon_target *target,
11721172
struct damon_ctx *ctx,
11731173
struct damon_sysfs_target *sys_target)
11741174
{
1175-
int err;
1175+
int err = 0;
11761176

11771177
if (damon_target_has_pid(ctx)) {
11781178
err = damon_sysfs_update_target_pid(target, sys_target->pid);
@@ -1203,8 +1203,10 @@ static int damon_sysfs_set_targets(struct damon_ctx *ctx,
12031203

12041204
damon_for_each_target_safe(t, next, ctx) {
12051205
if (i < sysfs_targets->nr) {
1206-
damon_sysfs_update_target(t, ctx,
1206+
err = damon_sysfs_update_target(t, ctx,
12071207
sysfs_targets->targets_arr[i]);
1208+
if (err)
1209+
return err;
12081210
} else {
12091211
if (damon_target_has_pid(ctx))
12101212
put_pid(t->pid);

mm/filemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3443,7 +3443,7 @@ static vm_fault_t filemap_map_folio_range(struct vm_fault *vmf,
34433443
* handled in the specific fault path, and it'll prohibit the
34443444
* fault-around logic.
34453445
*/
3446-
if (!pte_none(vmf->pte[count]))
3446+
if (!pte_none(ptep_get(&vmf->pte[count])))
34473447
goto skip;
34483448

34493449
count++;

mm/huge_memory.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2769,13 +2769,15 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
27692769
int nr = folio_nr_pages(folio);
27702770

27712771
xas_split(&xas, folio, folio_order(folio));
2772-
if (folio_test_swapbacked(folio)) {
2773-
__lruvec_stat_mod_folio(folio, NR_SHMEM_THPS,
2774-
-nr);
2775-
} else {
2776-
__lruvec_stat_mod_folio(folio, NR_FILE_THPS,
2777-
-nr);
2778-
filemap_nr_thps_dec(mapping);
2772+
if (folio_test_pmd_mappable(folio)) {
2773+
if (folio_test_swapbacked(folio)) {
2774+
__lruvec_stat_mod_folio(folio,
2775+
NR_SHMEM_THPS, -nr);
2776+
} else {
2777+
__lruvec_stat_mod_folio(folio,
2778+
NR_FILE_THPS, -nr);
2779+
filemap_nr_thps_dec(mapping);
2780+
}
27792781
}
27802782
}
27812783

mm/ksm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ static int break_ksm_pmd_entry(pmd_t *pmd, unsigned long addr, unsigned long nex
468468
page = pfn_swap_entry_to_page(entry);
469469
}
470470
/* return 1 if the page is an normal ksm page or KSM-placed zero page */
471-
ret = (page && PageKsm(page)) || is_ksm_zero_pte(*pte);
471+
ret = (page && PageKsm(page)) || is_ksm_zero_pte(ptent);
472472
pte_unmap_unlock(pte, ptl);
473473
return ret;
474474
}

0 commit comments

Comments
 (0)