Skip to content

Commit 364a453

Browse files
committed
Merge tag 'mm-hotfixes-stable-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull misc fixes from Andrew Morton: "Seven MM fixes, three of which address issues added in the most recent merge window, four of which are cc:stable. Three non-MM fixes, none very serious" [ And yes, that's a real pull request from Andrew, not me creating a branch from emailed patches. Woo-hoo! ] * tag 'mm-hotfixes-stable-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: MAINTAINERS: add a mailing list for DAMON development selftests: vm: Makefile: rename TARGETS to VMTARGETS mm/kfence: reset PG_slab and memcg_data before freeing __kfence_pool mailmap: add entry for [email protected] arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map procfs: prevent unprivileged processes accessing fdinfo dir mm: mremap: fix sign for EFAULT error return value mm/hwpoison: use pr_err() instead of dump_page() in get_any_page() mm/huge_memory: do not overkill when splitting huge_zero_page Revert "mm/memory-failure.c: skip huge_zero_page in memory_failure()"
2 parents 91bdba8 + 9039b83 commit 364a453

File tree

12 files changed

+70
-22
lines changed

12 files changed

+70
-22
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ Mark Yao <[email protected]> <[email protected]>
251251
252252
253253
254+
Martyna Szapar-Mudlaw <[email protected]> <[email protected]>
254255
Mathieu Othacehe <[email protected]>
255256
256257

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5440,6 +5440,7 @@ F: net/ax25/sysctl_net_ax25.c
54405440

54415441
DATA ACCESS MONITOR
54425442
M: SeongJae Park <[email protected]>
5443+
54435444
54445445
S: Maintained
54455446
F: Documentation/ABI/testing/sysfs-kernel-mm-damon

arch/arm/include/asm/io.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);
440440
#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
441441
extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
442442
extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
443+
extern bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
444+
unsigned long flags);
445+
#define arch_memremap_can_ram_remap arch_memremap_can_ram_remap
443446
#endif
444447

445448
/*

arch/arm/mm/ioremap.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,3 +493,11 @@ void __init early_ioremap_init(void)
493493
{
494494
early_ioremap_setup();
495495
}
496+
497+
bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
498+
unsigned long flags)
499+
{
500+
unsigned long pfn = PHYS_PFN(offset);
501+
502+
return memblock_is_map_memory(pfn);
503+
}

arch/arm64/include/asm/io.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,8 @@ extern void __iomem *ioremap_cache(phys_addr_t phys_addr, size_t size);
192192
extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
193193
extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
194194

195+
extern bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
196+
unsigned long flags);
197+
#define arch_memremap_can_ram_remap arch_memremap_can_ram_remap
198+
195199
#endif /* __ASM_IO_H */

arch/arm64/mm/ioremap.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,11 @@ void __init early_ioremap_init(void)
9999
{
100100
early_ioremap_setup();
101101
}
102+
103+
bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
104+
unsigned long flags)
105+
{
106+
unsigned long pfn = PHYS_PFN(offset);
107+
108+
return pfn_is_map_memory(pfn);
109+
}

fs/proc/fd.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ static int seq_show(struct seq_file *m, void *v)
7272
return 0;
7373
}
7474

75-
static int seq_fdinfo_open(struct inode *inode, struct file *file)
75+
static int proc_fdinfo_access_allowed(struct inode *inode)
7676
{
7777
bool allowed = false;
7878
struct task_struct *task = get_proc_task(inode);
@@ -86,6 +86,16 @@ static int seq_fdinfo_open(struct inode *inode, struct file *file)
8686
if (!allowed)
8787
return -EACCES;
8888

89+
return 0;
90+
}
91+
92+
static int seq_fdinfo_open(struct inode *inode, struct file *file)
93+
{
94+
int ret = proc_fdinfo_access_allowed(inode);
95+
96+
if (ret)
97+
return ret;
98+
8999
return single_open(file, seq_show, inode);
90100
}
91101

@@ -348,12 +358,23 @@ static int proc_readfdinfo(struct file *file, struct dir_context *ctx)
348358
proc_fdinfo_instantiate);
349359
}
350360

361+
static int proc_open_fdinfo(struct inode *inode, struct file *file)
362+
{
363+
int ret = proc_fdinfo_access_allowed(inode);
364+
365+
if (ret)
366+
return ret;
367+
368+
return 0;
369+
}
370+
351371
const struct inode_operations proc_fdinfo_inode_operations = {
352372
.lookup = proc_lookupfdinfo,
353373
.setattr = proc_setattr,
354374
};
355375

356376
const struct file_operations proc_fdinfo_operations = {
377+
.open = proc_open_fdinfo,
357378
.read = generic_read_dir,
358379
.iterate_shared = proc_readfdinfo,
359380
.llseek = generic_file_llseek,

mm/huge_memory.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2495,11 +2495,16 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
24952495
struct address_space *mapping = NULL;
24962496
int extra_pins, ret;
24972497
pgoff_t end;
2498+
bool is_hzp;
24982499

2499-
VM_BUG_ON_PAGE(is_huge_zero_page(head), head);
25002500
VM_BUG_ON_PAGE(!PageLocked(head), head);
25012501
VM_BUG_ON_PAGE(!PageCompound(head), head);
25022502

2503+
is_hzp = is_huge_zero_page(head);
2504+
VM_WARN_ON_ONCE_PAGE(is_hzp, head);
2505+
if (is_hzp)
2506+
return -EBUSY;
2507+
25032508
if (PageWriteback(head))
25042509
return -EBUSY;
25052510

mm/kfence/core.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,16 @@ static bool __init kfence_init_pool_early(void)
621621
* fails for the first page, and therefore expect addr==__kfence_pool in
622622
* most failure cases.
623623
*/
624+
for (char *p = (char *)addr; p < __kfence_pool + KFENCE_POOL_SIZE; p += PAGE_SIZE) {
625+
struct slab *slab = virt_to_slab(p);
626+
627+
if (!slab)
628+
continue;
629+
#ifdef CONFIG_MEMCG
630+
slab->memcg_data = 0;
631+
#endif
632+
__folio_clear_slab(slab_folio(slab));
633+
}
624634
memblock_free_late(__pa(addr), KFENCE_POOL_SIZE - (addr - (unsigned long)__kfence_pool));
625635
__kfence_pool = NULL;
626636
return false;

mm/memory-failure.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ static int get_any_page(struct page *p, unsigned long flags)
12741274
}
12751275
out:
12761276
if (ret == -EIO)
1277-
dump_page(p, "hwpoison: unhandlable page");
1277+
pr_err("Memory failure: %#lx: unhandlable page.\n", page_to_pfn(p));
12781278

12791279
return ret;
12801280
}
@@ -1860,19 +1860,6 @@ int memory_failure(unsigned long pfn, int flags)
18601860
}
18611861

18621862
if (PageTransHuge(hpage)) {
1863-
/*
1864-
* Bail out before SetPageHasHWPoisoned() if hpage is
1865-
* huge_zero_page, although PG_has_hwpoisoned is not
1866-
* checked in set_huge_zero_page().
1867-
*
1868-
* TODO: Handle memory failure of huge_zero_page thoroughly.
1869-
*/
1870-
if (is_huge_zero_page(hpage)) {
1871-
action_result(pfn, MF_MSG_UNSPLIT_THP, MF_IGNORED);
1872-
res = -EBUSY;
1873-
goto unlock_mutex;
1874-
}
1875-
18761863
/*
18771864
* The flag must be set after the refcount is bumped
18781865
* otherwise it may race with THP split.

0 commit comments

Comments
 (0)