Skip to contentSkip to conversation

incoming

PATCH New Andrew Morton 1 participant 20 messages Aug 21, 2020 – Aug 26, 2020

Subsystems (11)
lore
Share & tools
lore

Andrew Morton

author maintainer
#0 lore raw

11 patches, based on 7eac66d0456fe12a462e5c14c68e97c7460989da.

Subsystems affected by this patch series:

misc
mm/hugetlb
mm/vmalloc
mm/misc
romfs
relay
uprobes
squashfs
mm/cma
mm/pagealloc

Subsystem: misc

Nick Desaulniers <[email protected]>:
mailmap: add Andi Kleen

Subsystem: mm/hugetlb

Xu Wang <[email protected]>:
hugetlb_cgroup: convert comma to semicolon

Hugh Dickins <[email protected]>:
khugepaged: adjust VM_BUG_ON_MM() in __khugepaged_enter()

Subsystem: mm/vmalloc

"Aneesh Kumar K.V" <[email protected]>:
mm/vunmap: add cond_resched() in vunmap_pmd_range

Subsystem: mm/misc

Leon Romanovsky <[email protected]>:
mm/rodata_test.c: fix missing function declaration

Subsystem: romfs

Jann Horn <[email protected]>:
romfs: fix uninitialized memory leak in romfs_dev_read()

Subsystem: relay

Wei Yongjun <[email protected]>:
kernel/relay.c: fix memleak on destroy relay channel

Subsystem: uprobes

Hugh Dickins <[email protected]>:
uprobes: __replace_page() avoid BUG in munlock_vma_page()

Subsystem: squashfs

Phillip Lougher <[email protected]>:
squashfs: avoid bio_alloc() failure with 1Mbyte blocks

Subsystem: mm/cma

Doug Berger <[email protected]>:
mm: include CMA pages in lowmem_reserve at boot

Subsystem: mm/pagealloc

Charan Teja Reddy <[email protected]>:
mm, page_alloc: fix core hung in free_pcppages_bulk()

 .mailmap                |    1 +
 fs/romfs/storage.c      |    4 +---
 fs/squashfs/block.c     |    6 +++++-
 kernel/events/uprobes.c |    2 +-
 kernel/relay.c          |    1 +
 mm/hugetlb_cgroup.c     |    4 ++--
 mm/khugepaged.c         |    2 +-
 mm/page_alloc.c         |    7 ++++++-
 mm/rodata_test.c        |    1 +
 mm/vmalloc.c            |    2 ++
 10 files changed, 21 insertions(+), 9 deletions(-)
author maintainer
#1 lore raw

PATCH 1/11 mailmap: add Andi Kleen

From: Nick Desaulniers <[email protected]>
Subject: mailmap: add Andi Kleen

I keep getting bounce back from the suse.de address.

---

 .mailmap |    1 +
 1 file changed, 1 insertion(+)
.mailmap renamed from .mailmap~mailmap-add-andi-kleen +1 -0
@@ -32,6 +32,7 @@ Alex Shi <[email protected]> <a
 Alex Shi <[email protected]> <[email protected]>
 Al Viro <[email protected]>
 Al Viro <[email protected]>
+Andi Kleen <[email protected]> <[email protected]>
 Andi Shyti <[email protected]> <[email protected]>
 Andreas Herrmann <[email protected]>
 Andrew Morton <[email protected]>

_

author maintainer
#2 lore raw

PATCH 2/11 hugetlb_cgroup: convert comma to semicolon

In reply to Andrew Morton

From: Xu Wang <[email protected]>
Subject: hugetlb_cgroup: convert comma to semicolon

Replace a comma between expression statements by a semicolon.

Fixes faced7e0806cf4 ("mm: hugetlb controller for cgroups v2")
Cc Tejun Heo <[email protected]>
Cc Giuseppe Scrivano <[email protected]>

---

 mm/hugetlb_cgroup.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hugetlb_cgroup.c renamed from mm/hugetlb_cgroup.c~hugetlb_cgroup-convert-comma-to-semicolon +2 -2
@@ -655,7 +655,7 @@ static void __init __hugetlb_cgroup_file
 	snprintf(cft->name, MAX_CFTYPE_NAME, "%s.events", buf);
 	cft->private = MEMFILE_PRIVATE(idx, 0);
 	cft->seq_show = hugetlb_events_show;
-	cft->file_offset = offsetof(struct hugetlb_cgroup, events_file[idx]),
+	cft->file_offset = offsetof(struct hugetlb_cgroup, events_file[idx]);
 	cft->flags = CFTYPE_NOT_ON_ROOT;
 
 	/* Add the events.local file */
@@ -664,7 +664,7 @@ static void __init __hugetlb_cgroup_file
 	cft->private = MEMFILE_PRIVATE(idx, 0);
 	cft->seq_show = hugetlb_events_local_show;
 	cft->file_offset = offsetof(struct hugetlb_cgroup,
-				    events_local_file[idx]),
+				    events_local_file[idx]);
 	cft->flags = CFTYPE_NOT_ON_ROOT;
 
 	/* NULL terminate the last cft */

_

author maintainer
#3 lore raw

PATCH 3/11 khugepaged: adjust VM_BUG_ON_MM() in __khugepaged_enter()

In reply to Andrew Morton

From: Hugh Dickins <[email protected]>
Subject: khugepaged: adjust VM_BUG_ON_MM() in __khugepaged_enter()

syzbot crashes on the VM_BUG_ON_MM(khugepaged_test_exit(mm), mm) in __khugepaged_enter(): yes, when one thread is about to dump core, has set core_state, and is waiting for others, another might do something calling __khugepaged_enter(), which now crashes because I lumped the core_state test (known as "mmget_still_valid") into khugepaged_test_exit(). I still think it's best to lump them together, so just in this exceptional case, check mm->mm_users directly instead of khugepaged_test_exit().

Fixes bbe98f9cadff ("khugepaged: khugepaged_test_exit() check mmget_still_valid()")
Cc "Kirill A. Shutemov" <[email protected]>
Cc Andrea Arcangeli <[email protected]>
Cc Song Liu <[email protected]>
Cc Mike Kravetz <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc <[email protected]> [4.8+]

---

 mm/khugepaged.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/khugepaged.c renamed from mm/khugepaged.c~khugepaged-adjust-vm_bug_on_mm-in-__khugepaged_enter +1 -1
@@ -466,7 +466,7 @@ int __khugepaged_enter(struct mm_struct
 		return -ENOMEM;
 
 	/* __khugepaged_exit() must not run from under us */
-	VM_BUG_ON_MM(khugepaged_test_exit(mm), mm);
+	VM_BUG_ON_MM(atomic_read(&mm->mm_users) == 0, mm);
 	if (unlikely(test_and_set_bit(MMF_VM_HUGEPAGE, &mm->flags))) {
 		free_mm_slot(mm_slot);
 		return 0;

_

author maintainer
#4 lore raw

PATCH 4/11 mm/vunmap: add cond_resched() in vunmap_pmd_range

In reply to Andrew Morton

From: "Aneesh Kumar K.V" <[email protected]>
Subject: mm/vunmap: add cond_resched() in vunmap_pmd_range

Like zap_pte_range add cond_resched so that we can avoid softlockups as reported below. On non-preemptible kernel with large I/O map region (like the one we get when using persistent memory with sector mode), an unmap of the namespace can report below softlockups.

22724.027334] watchdog: BUG: soft lockup - CPU#49 stuck for 23s! [ndctl:50777]
NIP [c0000000000dc224] plpar_hcall+0x38/0x58
LR [c0000000000d8898] pSeries_lpar_hpte_invalidate+0x68/0xb0

 Call Trace:
 [c0000004e87a7780] [c0000004fb197c00] 0xc0000004fb197c00 (unreliable)
 [c0000004e87a7810] [c00000000007f4e4] flush_hash_page+0x114/0x200
 [c0000004e87a7890] [c0000000000833cc] hpte_need_flush+0x2dc/0x540
 [c0000004e87a7950] [c0000000003f5798] vunmap_page_range+0x538/0x6f0
 [c0000004e87a7a70] [c0000000003f76d0] free_unmap_vmap_area+0x30/0x70
 [c0000004e87a7aa0] [c0000000003f7a6c] remove_vm_area+0xfc/0x140
 [c0000004e87a7ad0] [c0000000003f7dd8] __vunmap+0x68/0x270
 [c0000004e87a7b50] [c000000000079de4] __iounmap.part.0+0x34/0x60
 [c0000004e87a7bb0] [c000000000376394] memunmap+0x54/0x70
 [c0000004e87a7bd0] [c000000000881d7c] release_nodes+0x28c/0x300
 [c0000004e87a7c40] [c00000000087a65c] device_release_driver_internal+0x16c/0x280
 [c0000004e87a7c80] [c000000000876fc4] unbind_store+0x124/0x170
 [c0000004e87a7cd0] [c000000000875be4] drv_attr_store+0x44/0x60
 [c0000004e87a7cf0] [c00000000057c734] sysfs_kf_write+0x64/0x90
 [c0000004e87a7d10] [c00000000057bc10] kernfs_fop_write+0x1b0/0x290
 [c0000004e87a7d60] [c000000000488e6c] __vfs_write+0x3c/0x70
 [c0000004e87a7d80] [c00000000048c868] vfs_write+0xd8/0x260
 [c0000004e87a7dd0] [c00000000048ccac] ksys_write+0xdc/0x130
 [c0000004e87a7e20] [c00000000000b588] system_call+0x5c/0x70

---

 mm/vmalloc.c |    2 ++
 1 file changed, 2 insertions(+)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-vunmap-add-cond_resched-in-vunmap_pmd_range +2 -0
@@ -104,6 +104,8 @@ static void vunmap_pmd_range(pud_t *pud,
 		if (pmd_none_or_clear_bad(pmd))
 			continue;
 		vunmap_pte_range(pmd, addr, next, mask);
+
+		cond_resched();
 	} while (pmd++, addr = next, addr != end);
 }
 

_

author maintainer
#5 lore raw

PATCH 5/11 mm/rodata_test.c: fix missing function declaration

In reply to Andrew Morton

From: Leon Romanovsky <[email protected]>
Subject: mm/rodata_test.c: fix missing function declaration

The compilation with CONFIG_DEBUG_RODATA_TEST set produces the following warning due to the missing include.

mm/rodata_test.c:15:6: warning: no previous prototype for 'rodata_test' [-Wmissing-prototypes]
15 | void rodata_test(void)
| ^~~~~~~~~~~

Fixes 2959a5f726f6 ("mm: add arch-independent testcases for RODATA")

---

 mm/rodata_test.c |    1 +
 1 file changed, 1 insertion(+)
mm/rodata_test.c renamed from mm/rodata_test.c~mm-fix-missing-function-declaration +1 -0
@@ -7,6 +7,7 @@
  */
 #define pr_fmt(fmt) "rodata_test: " fmt
 
+#include <linux/rodata_test.h>
 #include <linux/uaccess.h>
 #include <asm/sections.h>
 

_

author maintainer
#6 lore raw

PATCH 6/11 romfs: fix uninitialized memory leak in romfs_dev_read()

In reply to Andrew Morton

From: Jann Horn <[email protected]>
Subject: romfs: fix uninitialized memory leak in romfs_dev_read()

romfs has a superblock field that limits the size of the filesystem; data beyond that limit is never accessed.

romfs_dev_read() fetches a caller-supplied number of bytes from the backing device. It returns 0 on success or an error code on failure; therefore, its API can't represent short reads, it's all-or-nothing.

However, when romfs_dev_read() detects that the requested operation would cross the filesystem size limit, it currently silently truncates the requested number of bytes. This e.g. means that when the content of a file with size 0x1000 starts one byte before the filesystem size limit, ->readpage() will only fill a single byte of the supplied page while leaving the rest uninitialized, leaking that uninitialized memory to userspace.

Fix it by returning an error code instead of truncating the read when the requested read operation would go beyond the end of the filesystem.

Fixes da4458bda237 ("NOMMU: Make it possible for RomFS to use MTD devices directly")
Cc David Howells <[email protected]>

---

 fs/romfs/storage.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/romfs/storage.c renamed from fs/romfs/storage.c~romfs-fix-uninitialized-memory-leak-in-romfs_dev_read +1 -3
@@ -217,10 +217,8 @@ int romfs_dev_read(struct super_block *s
 	size_t limit;
 
 	limit = romfs_maxsize(sb);
-	if (pos >= limit)
+	if (pos >= limit || buflen > limit - pos)
 		return -EIO;
-	if (buflen > limit - pos)
-		buflen = limit - pos;
 
 #ifdef CONFIG_ROMFS_ON_MTD
 	if (sb->s_mtd)

_

author maintainer
#7 lore raw

PATCH 7/11 kernel/relay.c: fix memleak on destroy relay channel

In reply to Andrew Morton

From: Wei Yongjun <[email protected]>
Subject: kernel/relay.c: fix memleak on destroy relay channel

kmemleak report memory leak as follows:

unreferenced object 0x607ee4e5f948 (size 8):
comm "syz-executor.1", pid 2098, jiffies 4295031601 (age 288.468s) hex dump (first 8 bytes):
00 00 00 00 00 00 00 00 ........
backtrace:

[<00000000ca1de2fa>] relay_open kernel/relay.c:583 [inline]
[<00000000ca1de2fa>] relay_open+0xb6/0x970 kernel/relay.c:563
[<0000000038ae5a4b>] do_blk_trace_setup+0x4a8/0xb20 kernel/trace/blktrace.c:557
[<00000000d5e778e9>] __blk_trace_setup+0xb6/0x150 kernel/trace/blktrace.c:597
[<0000000038fdf803>] blk_trace_ioctl+0x146/0x280 kernel/trace/blktrace.c:738
[<00000000ce25a0ca>] blkdev_ioctl+0xb2/0x6a0 block/ioctl.c:613
[<00000000579e47e0>] block_ioctl+0xe5/0x120 fs/block_dev.c:1871
[<00000000b1588c11>] vfs_ioctl fs/ioctl.c:48 [inline]
[<00000000b1588c11>] __do_sys_ioctl fs/ioctl.c:753 [inline]
[<00000000b1588c11>] __se_sys_ioctl fs/ioctl.c:739 [inline]
[<00000000b1588c11>] __x64_sys_ioctl+0x170/0x1ce fs/ioctl.c:739
[<0000000088fc9942>] do_syscall_64+0x33/0x40 arch/x86/entry/common.c:46
[<000000004f6dd57a>] entry_SYSCALL_64_after_hwframe+0x44/0xa9

'chan->buf' is malloced in relay_open() by alloc_percpu() but not free while destroy the relay channel. Fix it by adding free_percpu() before return from relay_destroy_channel().

Fixes 017c59c042d0 ("relay: Use per CPU constructs for the relay channel buffer pointers")
Cc Al Viro <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc David Rientjes <[email protected]>
Cc Michel Lespinasse <[email protected]>
Cc Daniel Axtens <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Akash Goel <[email protected]>

---

 kernel/relay.c |    1 +
 1 file changed, 1 insertion(+)
kernel/relay.c renamed from kernel/relay.c~kernel-relayc-fix-memleak-on-destroy-relay-channel +1 -0
@@ -197,6 +197,7 @@ free_buf:
 static void relay_destroy_channel(struct kref *kref)
 {
 	struct rchan *chan = container_of(kref, struct rchan, kref);
+	free_percpu(chan->buf);
 	kfree(chan);
 }
 

_

author maintainer
#8 lore raw

PATCH 8/11 uprobes: __replace_page() avoid BUG in munlock_vma_page()

In reply to Andrew Morton

From: Hugh Dickins <[email protected]>
Subject: uprobes: __replace_page() avoid BUG in munlock_vma_page()

syzbot crashed on the VM_BUG_ON_PAGE(PageTail) in munlock_vma_page(), when called from uprobes __replace_page(). Which of many ways to fix it? Settled on not calling when PageCompound (since Head and Tail are equals in this context, PageCompound the usual check in uprobes.c, and the prior use of FOLL_SPLIT_PMD will have cleared PageMlocked already).

---

 kernel/events/uprobes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/events/uprobes.c renamed from kernel/events/uprobes.c~uprobes-__replace_page-avoid-bug-in-munlock_vma_page +1 -1
@@ -205,7 +205,7 @@ static int __replace_page(struct vm_area
 		try_to_free_swap(old_page);
 	page_vma_mapped_walk_done(&pvmw);
 
-	if (vma->vm_flags & VM_LOCKED)
+	if ((vma->vm_flags & VM_LOCKED) && !PageCompound(old_page))
 		munlock_vma_page(old_page);
 	put_page(old_page);
 

_

author maintainer
#9 lore raw

PATCH 9/11 squashfs: avoid bio_alloc() failure with 1Mbyte blocks

In reply to Andrew Morton

From: Phillip Lougher <[email protected]>
Subject: squashfs: avoid bio_alloc() failure with 1Mbyte blocks

This is a regression introduced by the patch "migrate from ll_rw_block usage to BIO".

Bio_alloc() is limited to 256 pages (1 Mbyte). This can cause a failure when reading 1 Mbyte block filesystems. The problem is a datablock can be fully (or almost uncompressed), requiring 256 pages, but, because blocks are not aligned to page boundaries, it may require 257 pages to read.

Bio_kmalloc() can handle 1024 pages, and so use this for the edge condition.

Fixes 93e72b3c612a ("squashfs: migrate from ll_rw_block usage to BIO")
Cc Philippe Liard <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Adrien Schildknecht <[email protected]>
Cc Daniel Rosenberg <[email protected]>

---

 fs/squashfs/block.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/squashfs/block.c renamed from fs/squashfs/block.c~squashfs-avoid-bio_alloc-failure-with-1mbyte-blocks +5 -1
@@ -87,7 +87,11 @@ static int squashfs_bio_read(struct supe
 	int error, i;
 	struct bio *bio;
 
-	bio = bio_alloc(GFP_NOIO, page_count);
+	if (page_count <= BIO_MAX_PAGES)
+		bio = bio_alloc(GFP_NOIO, page_count);
+	else
+		bio = bio_kmalloc(GFP_NOIO, page_count);
+
 	if (!bio)
 		return -ENOMEM;
 

_

author maintainer
#10 lore raw

PATCH 10/11 mm: include CMA pages in lowmem_reserve at boot

In reply to Andrew Morton

From: Doug Berger <[email protected]>
Subject: mm: include CMA pages in lowmem_reserve at boot

The lowmem_reserve arrays provide a means of applying pressure against allocations from lower zones that were targeted at higher zones. Its values are a function of the number of pages managed by higher zones and are assigned by a call to the setup_per_zone_lowmem_reserve() function.

The function is initially called at boot time by the function init_per_zone_wmark_min() and may be called later by accesses of the /proc/sys/vm/lowmem_reserve_ratio sysctl file.

The function init_per_zone_wmark_min() was moved up from a module_init to a core_initcall to resolve a sequencing issue with khugepaged. Unfortunately this created a sequencing issue with CMA page accounting.

The CMA pages are added to the managed page count of a zone when cma_init_reserved_areas() is called at boot also as a core_initcall. This makes it uncertain whether the CMA pages will be added to the managed page counts of their zones before or after the call to init_per_zone_wmark_min() as it becomes dependent on link order. With the current link order the pages are added to the managed count after the lowmem_reserve arrays are initialized at boot.

This means the lowmem_reserve values at boot may be lower than the values used later if /proc/sys/vm/lowmem_reserve_ratio is accessed even if the ratio values are unchanged.

In many cases the difference is not significant, but for example an ARM platform with 1GB of memory and the following memory layout

[    0.000000] cma: Reserved 256 MiB at 0x0000000030000000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000000000000-0x000000002fffffff]
[    0.000000]   Normal   empty
[    0.000000]   HighMem  [mem 0x0000000030000000-0x000000003fffffff]

would result in 0 lowmem_reserve for the DMA zone. This would allow userspace to deplete the DMA zone easily. Funnily enough

$ cat /proc/sys/vm/lowmem_reserve_ratio

would fix up the situation because it forces setup_per_zone_lowmem_reserve as a side effect.

This commit breaks the link order dependency by invoking init_per_zone_wmark_min() as a postcore_initcall so that the CMA pages have the chance to be properly accounted in their zone(s) and allowing the lowmem_reserve arrays to receive consistent values.

Fixes bc22af74f271 ("mm: update min_free_kbytes from khugepaged after core initialization")
Cc Jason Baron <[email protected]>
Cc David Rientjes <[email protected]>
Cc "Kirill A. Shutemov" <[email protected]>

---

 mm/page_alloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-include-cma-pages-in-lowmem_reserve-at-boot +1 -1
@@ -7888,7 +7888,7 @@ int __meminit init_per_zone_wmark_min(vo
 
 	return 0;
 }
-core_initcall(init_per_zone_wmark_min)
+postcore_initcall(init_per_zone_wmark_min)
 
 /*
  * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so

_

author maintainer
#11 lore raw

PATCH 11/11 mm, page_alloc: fix core hung in free_pcppages_bulk()

In reply to Andrew Morton

From: Charan Teja Reddy <[email protected]>
Subject: mm, page_alloc: fix core hung in free_pcppages_bulk()

The following race is observed with the repeated online, offline and a delay between two successive online of memory blocks of movable zone.

P1 P2

Online the first memory block in
the movable zone. The pcp struct
values are initialized to default
values,i.e., pcp->high = 0 &
pcp->batch = 1.

Allocate the pages from the movable zone.

Try to Online the second memory
block in the movable zone thus it
entered the online_pages() but yet
to call zone_pcp_update().
This process is entered into the exit path thus it tries to release the order-0 pages to pcp lists through free_unref_page_commit(). As pcp->high = 0, pcp->count = 1 proceed to call the function free_pcppages_bulk().
Update the pcp values thus the
new pcp values are like, say,
pcp->high = 378, pcp->batch = 63.
Read the pcp's batch value using READ_ONCE() and pass the same to free_pcppages_bulk(), pcp values passed here are, batch = 63, count = 1.

Since num of pages in the pcp lists are less than ->batch, then it will stuck in while(list_empty(list)) loop with interrupts disabled thus a core hung.

Avoid this by ensuring free_pcppages_bulk() is called with proper count of pcp list pages.

The mentioned race is some what easily reproducible without [1] because pcp's are not updated for the first memory block online and thus there is a enough race window for P2 between alloc+free and pcp struct values update through onlining of second memory block.

With [1], the race still exists but it is very narrow as we update the pcp struct values for the first memory block online itself.

This is not limited to the movable zone, it could also happen in cases with the normal zone (e.g., hotplug to a node that only has DMA memory, or no other memory yet).

[1]: https://patchwork.kernel.org/patch/11696389/

Fixes 5f8dcc21211a ("page-allocator: split per-cpu list into one-list-per-migrate-type")
Cc Michal Hocko <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Vinayak Menon <[email protected]>
Cc <[email protected]> [2.6+]

---

 mm/page_alloc.c |    5 +++++
 1 file changed, 5 insertions(+)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-fix-core-hung-in-free_pcppages_bulk +5 -0
@@ -1302,6 +1302,11 @@ static void free_pcppages_bulk(struct zo
 	struct page *page, *tmp;
 	LIST_HEAD(head);
 
+	/*
+	 * Ensure proper count is passed which otherwise would stuck in the
+	 * below while (list_empty(list)) loop.
+	 */
+	count = min(pcp->count, count);
 	while (count) {
 		struct list_head *list;
 

_

author maintainer tree notice
#12 lore raw

+ fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix.patch added to -mm tree

In reply to Andrew Morton
The patch titled Subject: fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix has been added to the -mm tree. Its filename is…

The patch titled
Subject: fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix
has been added to the -mm tree. Its filename is
fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Andrew Morton <[email protected]>
Subject: fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix

fix max() warning

---

 fs/binfmt_elf.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/binfmt_elf.c renamed from fs/binfmt_elf.c~fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix +4 -2
@@ -429,10 +429,12 @@ static unsigned long maximum_alignment(s
 
 	for (i = 0; i < nr; i++) {
 		if (cmds[i].p_type == PT_LOAD) {
+			unsigned long p_align = cmds[i].p_align;
+
 			/* skip non-power of two alignments */
-			if (!is_power_of_2(cmds[i].p_align))
+			if (!is_power_of_2(p_align))
 				continue;
-			alignment = max(alignment, cmds[i].p_align);
+			alignment = max(alignment, p_align);
 		}
 	}
 

_

Patches currently in -mm which might be from [email protected] are

mm-slub-re-initialize-randomized-freelist-sequence-in-calculate_sizes-fix.patch mm.patch mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm-fix.patch memblock-make-memblock_debug-and-related-functionality-private-fix.patch mm-vmstat-fix-proc-sys-vm-stat_refresh-generating-false-warnings-fix-2.patch fs-binfmt_elf-use-pt_load-p_align-values-for-suitable-start-address-fix.patch kernel-forkc-export-kernel_thread-to-modules.patch

author maintainer tree notice
#13 lore raw

+ mm-kmemleak-rely-on-rcu-for-task-stack-scanning.patch added to -mm tree

In reply to Andrew Morton
The patch titled Subject: mm/kmemleak: rely on rcu for task stack scanning has been added to the -mm tree. Its filename is mm-kmemleak-rely-on-rcu-for-task-stack-scanning.patch

The patch titled
Subject: mm/kmemleak: rely on rcu for task stack scanning
has been added to the -mm tree. Its filename is
mm-kmemleak-rely-on-rcu-for-task-stack-scanning.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-kmemleak-rely-on-rcu-for-task-stack-scanning.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-kmemleak-rely-on-rcu-for-task-stack-scanning.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Davidlohr Bueso <[email protected]>
Subject: mm/kmemleak: rely on rcu for task stack scanning

kmemleak_scan() currently relies on the big tasklist_lock hammer to stabilize iterating through the tasklist. Instead, this patch proposes simply using rcu along with the rcu-safe for_each_process_thread flavor (without changing scan semantics), which doesn't make use of next_thread/p->thread_group and thus cannot race with exit. Furthermore, any races with fork() and not seeing the new child should be benign as it's not running yet and can also be detected by the next scan.

---

 mm/kmemleak.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
mm/kmemleak.c renamed from mm/kmemleak.c~mm-kmemleak-rely-on-rcu-for-task-stack-scanning +4 -4
@@ -1471,15 +1471,15 @@ static void kmemleak_scan(void)
 	if (kmemleak_stack_scan) {
 		struct task_struct *p, *g;
 
-		read_lock(&tasklist_lock);
-		do_each_thread(g, p) {
+		rcu_read_lock();
+		for_each_process_thread(g, p) {
 			void *stack = try_get_task_stack(p);
 			if (stack) {
 				scan_block(stack, stack + THREAD_SIZE, NULL);
 				put_task_stack(p);
 			}
-		} while_each_thread(g, p);
-		read_unlock(&tasklist_lock);
+		}
+		rcu_read_unlock();
 	}
 
 	/*

_

Patches currently in -mm which might be from [email protected] are

mm-kmemleak-rely-on-rcu-for-task-stack-scanning.patch

author maintainer tree notice
#14 lore raw

+ get_maintainer-exclude-maintainers-files-from-git-fallback.patch added to -mm tree

In reply to Andrew Morton
The patch titled

The patch titled

     Subject: get_maintainer: exclude MAINTAINERS file(s) from --git-fallback

has been added to the -mm tree. Its filename is
get_maintainer-exclude-maintainers-files-from-git-fallback.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/get_maintainer-exclude-maintainers-files-from-git-fallback.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/get_maintainer-exclude-maintainers-files-from-git-fallback.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Joe Perches <[email protected]>
Subject: get_maintainer: exclude MAINTAINERS file(s) from --git-fallback

MAINTAINERS files generally have no specific maintainer but are updated by individuals for subsystems all over the source tree.

Exclude MAINTAINERS file(s) from --git-fallback searches so the unlucky individuals that update the files the most are not shown by default.

---

 scripts/get_maintainer.pl |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
scripts/get_maintainer.pl renamed from scripts/get_maintainer.pl~get_maintainer-exclude-maintainers-files-from-git-fallback +4 -2
@@ -954,8 +954,10 @@ sub get_maintainers {
 
     foreach my $file (@files) {
 	if ($email &&
-	    ($email_git || ($email_git_fallback &&
-			    !$exact_pattern_match_hash{$file}))) {
+	    ($email_git ||
+	     ($email_git_fallback &&
+	      $file !~ /MAINTAINERS$/ &&
+	      !$exact_pattern_match_hash{$file}))) {
 	    vcs_file_signoffs($file);
 	}
 	if ($email && $email_git_blame) {

_

Patches currently in -mm which might be from [email protected] are

checkpatch-test-git_dir-changes.patch get_maintainer-exclude-maintainers-files-from-git-fallback.patch checkpatch-move-repeated-word-test.patch checkpatch-add-test-for-comma-use-that-should-be-semicolon.patch

author maintainer tree notice
#15 lore raw

+ checkpatch-fix-the-usage-of-capture-group.patch added to -mm tree

In reply to Andrew Morton
The patch titled Subject: checkpatch: fix the usage of capture group ( ... ) has been added to the -mm tree. Its filename is checkpatch-fix-the-usage-of-capture-group.patch

The patch titled
Subject: checkpatch: fix the usage of capture group ( ... )
has been added to the -mm tree. Its filename is
checkpatch-fix-the-usage-of-capture-group.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/checkpatch-fix-the-usage-of-capture-group.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-fix-the-usage-of-capture-group.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Mrinal Pandey <[email protected]>
Subject: checkpatch: fix the usage of capture group ( ... )

The usage of "capture group (...)" in the immediate condition after && results in $1 being uninitialized. This issues a warning "Use of uninitialized value $1 in regexp compilation at ./scripts/checkpatch.pl line 2638".

I noticed this bug while running checkpatch on the set of commits from v5.7 to v5.8-rc1 of the kernel on the commits with a diff content in their commit message.

This bug was introduced in the script by commit e518e9a59ec3 ("checkpatch:
emit an error when there's a diff in a changelog"). It has been in the script since then.

The author intended to store the match made by capture group in variable $1. This should have contained the name of the file as [\w/]+ matched. However, this couldn't be accomplished due to usage of capture group and $1 in the same regular expression.

Fix this by placing the capture group in the condition before &&. Thus, $1 can be initialized to the text that capture group matches thereby setting it to the desired and required value.

Fixes e518e9a59ec3 ("checkpatch: emit an error when there's a diff in a changelog")
Cc Joe Perches <[email protected]>

---

 scripts/checkpatch.pl |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatch-fix-the-usage-of-capture-group +2 -2
@@ -2639,8 +2639,8 @@ sub process {
 
 # Check if the commit log has what seems like a diff which can confuse patch
 		if ($in_commit_log && !$commit_log_has_diff &&
-		    (($line =~ m@^\s+diff\b.*a/[\w/]+@ &&
-		      $line =~ m@^\s+diff\b.*a/([\w/]+)\s+b/$1\b@) ||
+		    (($line =~ m@^\s+diff\b.*a/([\w/]+)@ &&
+		      $line =~ m@^\s+diff\b.*a/[\w/]+\s+b/$1\b@) ||
 		     $line =~ m@^\s*(?:\-\-\-\s+a/|\+\+\+\s+b/)@ ||
 		     $line =~ m/^\s*\@\@ \-\d+,\d+ \+\d+,\d+ \@\@/)) {
 			ERROR("DIFF_IN_COMMIT_MSG",

_

Patches currently in -mm which might be from [email protected] are

checkpatch-fix-the-usage-of-capture-group.patch

author maintainer tree notice
#16 lore raw

+ mm-gup_benchmark-update-the-documentation-in-kconfig.patch added to -mm tree

In reply to Andrew Morton
The patch titled Subject: mm/gup_benchmark: update the documentation in Kconfig has been added to the -mm tree. Its filename is mm-gup_benchmark-update-the-documentation-in-kconfig.patch

The patch titled
Subject: mm/gup_benchmark: update the documentation in Kconfig
has been added to the -mm tree. Its filename is
mm-gup_benchmark-update-the-documentation-in-kconfig.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-gup_benchmark-update-the-documentation-in-kconfig.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-gup_benchmark-update-the-documentation-in-kconfig.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Barry Song <[email protected]>
Subject: mm/gup_benchmark: update the documentation in Kconfig

In the beginning, mm/gup_benchmark.c supported get_user_pages_fast() only, but right now, it supports the benchmarking of a couple of get_user_pages() related calls like:

* get_user_pages_fast()
* get_user_pages()
* pin_user_pages_fast()
* pin_user_pages()

The documentation is confusing and needs update.

---

 mm/Kconfig |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/Kconfig renamed from mm/Kconfig~mm-gup_benchmark-update-the-documentation-in-kconfig +2 -2
@@ -831,10 +831,10 @@ config PERCPU_STATS
 	  be used to help understand percpu memory usage.
 
 config GUP_BENCHMARK
-	bool "Enable infrastructure for get_user_pages_fast() benchmarking"
+	bool "Enable infrastructure for get_user_pages() and related calls benchmarking"
 	help
 	  Provides /sys/kernel/debug/gup_benchmark that helps with testing
-	  performance of get_user_pages_fast().
+	  performance of get_user_pages() and related calls.
 
 	  See tools/testing/selftests/vm/gup_benchmark.c
 

_

Patches currently in -mm which might be from [email protected] are

mm-gup_benchmark-update-the-documentation-in-kconfig.patch mm-gup_benchmark-use-pin_user_pages-for-foll_longterm-flag.patch mm-gup-dont-permit-users-to-call-get_user_pages-with-foll_longterm.patch

author maintainer tree notice
#17 lore raw

+ mm-madvise-fix-vma-user-after-free.patch added to -mm tree

In reply to Andrew Morton
The patch titled Subject: mm: madvise: fix vma user-after-free has been added to the -mm tree. Its filename is mm-madvise-fix-vma-user-after-free.patch

The patch titled
Subject: mm: madvise: fix vma user-after-free
has been added to the -mm tree. Its filename is
mm-madvise-fix-vma-user-after-free.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-madvise-fix-vma-user-after-free.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-madvise-fix-vma-user-after-free.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Yang Shi <[email protected]>
Subject: mm: madvise: fix vma user-after-free

The syzbot reported the below use-after-free:

BUG: KASAN: use-after-free in madvise_willneed mm/madvise.c:293 [inline]
BUG: KASAN: use-after-free in madvise_vma mm/madvise.c:942 [inline]
BUG: KASAN: use-after-free in do_madvise.part.0+0x1c8b/0x1cf0 mm/madvise.c:1145
Read of size 8 at addr ffff8880a6163eb0 by task syz-executor.0/9996

CPU: 0 PID: 9996 Comm: syz-executor.0 Not tainted 5.9.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 madvise_willneed mm/madvise.c:293 [inline]
 madvise_vma mm/madvise.c:942 [inline]
 do_madvise.part.0+0x1c8b/0x1cf0 mm/madvise.c:1145
 do_madvise mm/madvise.c:1169 [inline]
 __do_sys_madvise mm/madvise.c:1171 [inline]
 __se_sys_madvise mm/madvise.c:1169 [inline]
 __x64_sys_madvise+0xd9/0x110 mm/madvise.c:1169
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45d4d9
Code: 5d b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 2b b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f04f7464c78 EFLAGS: 00000246 ORIG_RAX: 000000000000001c
RAX: ffffffffffffffda RBX: 0000000000020800 RCX: 000000000045d4d9
RDX: 0000000000000003 RSI: 0000000000600003 RDI: 0000000020000000
RBP: 000000000118d020 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000118cfec
R13: 00007ffc579cce7f R14: 00007f04f74659c0 R15: 000000000118cfec

Allocated by task 9992:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
 slab_post_alloc_hook mm/slab.h:518 [inline]
 slab_alloc mm/slab.c:3312 [inline]
 kmem_cache_alloc+0x138/0x3a0 mm/slab.c:3482
 vm_area_alloc+0x1c/0x110 kernel/fork.c:347
 mmap_region+0x8e5/0x1780 mm/mmap.c:1743
 do_mmap+0xcf9/0x11d0 mm/mmap.c:1545
 vm_mmap_pgoff+0x195/0x200 mm/util.c:506
 ksys_mmap_pgoff+0x43a/0x560 mm/mmap.c:1596
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 9992:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422
 __cache_free mm/slab.c:3418 [inline]
 kmem_cache_free.part.0+0x67/0x1f0 mm/slab.c:3693
 remove_vma+0x132/0x170 mm/mmap.c:184
 remove_vma_list mm/mmap.c:2613 [inline]
 __do_munmap+0x743/0x1170 mm/mmap.c:2869
 do_munmap mm/mmap.c:2877 [inline]
 mmap_region+0x257/0x1780 mm/mmap.c:1716
 do_mmap+0xcf9/0x11d0 mm/mmap.c:1545
 vm_mmap_pgoff+0x195/0x200 mm/util.c:506
 ksys_mmap_pgoff+0x43a/0x560 mm/mmap.c:1596
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

It is because vma is accessed after releasing mmap_lock, but someone else acquired the mmap_lock and the vma is gone.

Releasing mmap_lock after accessing vma should fix the problem.

Fixes 692fe62433d4c ("mm: Handle MADV_WILLNEED through vfs_fadvise()")
Reported-by [email protected]
Cc Jan Kara <[email protected]>
Cc <[email protected]> [5.4+]

---

 mm/madvise.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/madvise.c renamed from mm/madvise.c~mm-madvise-fix-vma-user-after-free +1 -1
@@ -289,9 +289,9 @@ static long madvise_willneed(struct vm_a
 	 */
 	*prev = NULL;	/* tell sys_madvise we drop mmap_lock */
 	get_file(file);
-	mmap_read_unlock(current->mm);
 	offset = (loff_t)(start - vma->vm_start)
 			+ ((loff_t)vma->vm_pgoff << PAGE_SHIFT);
+	mmap_read_unlock(current->mm);
 	vfs_fadvise(file, offset, end - start, POSIX_FADV_WILLNEED);
 	fput(file);
 	mmap_read_lock(current->mm);

_

Patches currently in -mm which might be from [email protected] are

mm-madvise-fix-vma-user-after-free.patch

author maintainer tree notice
#18 lore raw

+ mm-track-page-table-modifications-in-__apply_to_page_range.patch added to -mm tree

In reply to Andrew Morton
The patch titled Subject: mm: track page table modifications in __apply_to_page_range() has been added to the -mm tree. Its filename is mm-track-page-table-modifications-in-__apply_to_page_range.patch

The patch titled
Subject: mm: track page table modifications in __apply_to_page_range()
has been added to the -mm tree. Its filename is
mm-track-page-table-modifications-in-__apply_to_page_range.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/mm-track-page-table-modifications-in-__apply_to_page_range.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/mm-track-page-table-modifications-in-__apply_to_page_range.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Joerg Roedel <[email protected]>
Subject: mm: track page table modifications in __apply_to_page_range()

__apply_to_page_range() is also used to change and/or allocate page-table pages in the vmalloc area of the address space. Make sure these changes get synchronized to other page-tables in the system by calling arch_sync_kernel_mappings() when necessary.

The impact appears limited to x86-32, where apply_to_page_range may miss updating the PMD. That leads to explosions in drivers like

[   24.227844] BUG: unable to handle page fault for address: fe036000
[   24.228076] #PF: supervisor write access in kernel mode
[   24.228294] #PF: error_code(0x0002) - not-present page
[   24.228494] *pde = 00000000
[   24.228640] Oops: 0002 [#1] SMP
[   24.228788] CPU: 3 PID: 1300 Comm: gem_concurrent_ Not tainted 5.9.0-rc1+ #16
[   24.228957] Hardware name:  /NUC6i3SYB, BIOS SYSKLi35.86A.0024.2015.1027.2142 10/27/2015
[   24.229297] EIP: __execlists_context_alloc+0x132/0x2d0 [i915]
[   24.229462] Code: 31 d2 89 f0 e8 2f 55 02 00 89 45 e8 3d 00 f0 ff ff 0f 87 11 01 00 00 8b 4d e8 03 4b 30 b8 5a 5a 5a 5a ba 01 00 00 00 8d 79 04 <c7> 01 5a 5a 5a 5a c7 81 fc 0f 00 00 5a 5a 5a 5a 83 e7 fc 29 f9 81
[   24.229759] EAX: 5a5a5a5a EBX: f60ca000 ECX: fe036000 EDX: 00000001
[   24.229915] ESI: f43b7340 EDI: fe036004 EBP: f6389cb8 ESP: f6389c9c
[   24.230072] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010286
[   24.230229] CR0: 80050033 CR2: fe036000 CR3: 2d361000 CR4: 001506d0
[   24.230385] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[   24.230539] DR6: fffe0ff0 DR7: 00000400
[   24.230675] Call Trace:
[   24.230957]  execlists_context_alloc+0x10/0x20 [i915]
[   24.231266]  intel_context_alloc_state+0x3f/0x70 [i915]
[   24.231547]  __intel_context_do_pin+0x117/0x170 [i915]
[   24.231850]  i915_gem_do_execbuffer+0xcc7/0x2500 [i915]
[   24.232024]  ? __kmalloc_track_caller+0x54/0x230
[   24.232181]  ? ktime_get+0x3e/0x120
[   24.232333]  ? dma_fence_signal+0x34/0x50
[   24.232617]  i915_gem_execbuffer2_ioctl+0xcd/0x1f0 [i915]
[   24.232912]  ? i915_gem_execbuffer_ioctl+0x2e0/0x2e0 [i915]
[   24.233084]  drm_ioctl_kernel+0x8f/0xd0
[   24.233236]  drm_ioctl+0x223/0x3d0
[   24.233505]  ? i915_gem_execbuffer_ioctl+0x2e0/0x2e0 [i915]
[   24.233684]  ? pick_next_task_fair+0x1b5/0x3d0
[   24.233873]  ? __switch_to_asm+0x36/0x50
[   24.234021]  ? drm_ioctl_kernel+0xd0/0xd0
[   24.234167]  __ia32_sys_ioctl+0x1ab/0x760
[   24.234313]  ? exit_to_user_mode_prepare+0xe5/0x110
[   24.234453]  ? syscall_exit_to_user_mode+0x23/0x130
[   24.234601]  __do_fast_syscall_32+0x3f/0x70
[   24.234744]  do_fast_syscall_32+0x29/0x60
[   24.234885]  do_SYSENTER_32+0x15/0x20
[   24.235021]  entry_SYSENTER_32+0x9f/0xf2
[   24.235157] EIP: 0xb7f28559
[   24.235288] Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d 76 00 58 b8 77 00 00 00 cd 80 90 8d 76
[   24.235576] EAX: ffffffda EBX: 00000005 ECX: c0406469 EDX: bf95556c
[   24.235722] ESI: b7e68000 EDI: c0406469 EBP: 00000005 ESP: bf9554d8
[   24.235869] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00000296
[   24.236018] Modules linked in: i915 x86_pkg_temp_thermal intel_powerclamp crc32_pclmul crc32c_intel intel_cstate intel_uncore intel_gtt drm_kms_helper intel_pch_thermal video button autofs4 i2c_i801 i2c_smbus fan
[   24.236336] CR2: 00000000fe036000

It looks like kasan, xen and i915 are vulnerable.

Actual impact is "on thinkpad X60 in 5.9-rc1, screen starts blinking after 30-or-so minutes, and machine is unusable"

---

 mm/memory.c |   36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)
mm/memory.c renamed from mm/memory.c~mm-track-page-table-modifications-in-__apply_to_page_range +23 -13
@@ -83,6 +83,7 @@
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 
+#include "pgalloc-track.h"
 #include "internal.h"
 
 #if defined(LAST_CPUPID_NOT_IN_PAGE_FLAGS) && !defined(CONFIG_COMPILE_TEST)
@@ -2206,7 +2207,8 @@ EXPORT_SYMBOL(vm_iomap_memory);
 
 static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
 				     unsigned long addr, unsigned long end,
-				     pte_fn_t fn, void *data, bool create)
+				     pte_fn_t fn, void *data, bool create,
+				     pgtbl_mod_mask *mask)
 {
 	pte_t *pte;
 	int err = 0;
@@ -2214,7 +2216,7 @@ static int apply_to_pte_range(struct mm_
 
 	if (create) {
 		pte = (mm == &init_mm) ?
-			pte_alloc_kernel(pmd, addr) :
+			pte_alloc_kernel_track(pmd, addr, mask) :
 			pte_alloc_map_lock(mm, pmd, addr, &ptl);
 		if (!pte)
 			return -ENOMEM;
@@ -2235,6 +2237,7 @@ static int apply_to_pte_range(struct mm_
 				break;
 		}
 	} while (addr += PAGE_SIZE, addr != end);
+	*mask |= PGTBL_PTE_MODIFIED;
 
 	arch_leave_lazy_mmu_mode();
 
@@ -2245,7 +2248,8 @@ static int apply_to_pte_range(struct mm_
 
 static int apply_to_pmd_range(struct mm_struct *mm, pud_t *pud,
 				     unsigned long addr, unsigned long end,
-				     pte_fn_t fn, void *data, bool create)
+				     pte_fn_t fn, void *data, bool create,
+				     pgtbl_mod_mask *mask)
 {
 	pmd_t *pmd;
 	unsigned long next;
@@ -2254,7 +2258,7 @@ static int apply_to_pmd_range(struct mm_
 	BUG_ON(pud_huge(*pud));
 
 	if (create) {
-		pmd = pmd_alloc(mm, pud, addr);
+		pmd = pmd_alloc_track(mm, pud, addr, mask);
 		if (!pmd)
 			return -ENOMEM;
 	} else {
@@ -2264,7 +2268,7 @@ static int apply_to_pmd_range(struct mm_
 		next = pmd_addr_end(addr, end);
 		if (create || !pmd_none_or_clear_bad(pmd)) {
 			err = apply_to_pte_range(mm, pmd, addr, next, fn, data,
-						 create);
+						 create, mask);
 			if (err)
 				break;
 		}
@@ -2274,14 +2278,15 @@ static int apply_to_pmd_range(struct mm_
 
 static int apply_to_pud_range(struct mm_struct *mm, p4d_t *p4d,
 				     unsigned long addr, unsigned long end,
-				     pte_fn_t fn, void *data, bool create)
+				     pte_fn_t fn, void *data, bool create,
+				     pgtbl_mod_mask *mask)
 {
 	pud_t *pud;
 	unsigned long next;
 	int err = 0;
 
 	if (create) {
-		pud = pud_alloc(mm, p4d, addr);
+		pud = pud_alloc_track(mm, p4d, addr, mask);
 		if (!pud)
 			return -ENOMEM;
 	} else {
@@ -2291,7 +2296,7 @@ static int apply_to_pud_range(struct mm_
 		next = pud_addr_end(addr, end);
 		if (create || !pud_none_or_clear_bad(pud)) {
 			err = apply_to_pmd_range(mm, pud, addr, next, fn, data,
-						 create);
+						 create, mask);
 			if (err)
 				break;
 		}
@@ -2301,14 +2306,15 @@ static int apply_to_pud_range(struct mm_
 
 static int apply_to_p4d_range(struct mm_struct *mm, pgd_t *pgd,
 				     unsigned long addr, unsigned long end,
-				     pte_fn_t fn, void *data, bool create)
+				     pte_fn_t fn, void *data, bool create,
+				     pgtbl_mod_mask *mask)
 {
 	p4d_t *p4d;
 	unsigned long next;
 	int err = 0;
 
 	if (create) {
-		p4d = p4d_alloc(mm, pgd, addr);
+		p4d = p4d_alloc_track(mm, pgd, addr, mask);
 		if (!p4d)
 			return -ENOMEM;
 	} else {
@@ -2318,7 +2324,7 @@ static int apply_to_p4d_range(struct mm_
 		next = p4d_addr_end(addr, end);
 		if (create || !p4d_none_or_clear_bad(p4d)) {
 			err = apply_to_pud_range(mm, p4d, addr, next, fn, data,
-						 create);
+						 create, mask);
 			if (err)
 				break;
 		}
@@ -2331,8 +2337,9 @@ static int __apply_to_page_range(struct
 				 void *data, bool create)
 {
 	pgd_t *pgd;
-	unsigned long next;
+	unsigned long start = addr, next;
 	unsigned long end = addr + size;
+	pgtbl_mod_mask mask = 0;
 	int err = 0;
 
 	if (WARN_ON(addr >= end))
@@ -2343,11 +2350,14 @@ static int __apply_to_page_range(struct
 		next = pgd_addr_end(addr, end);
 		if (!create && pgd_none_or_clear_bad(pgd))
 			continue;
-		err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create);
+		err = apply_to_p4d_range(mm, pgd, addr, next, fn, data, create, &mask);
 		if (err)
 			break;
 	} while (pgd++, addr = next, addr != end);
 
+	if (mask & ARCH_PAGE_TABLE_SYNC_MASK)
+		arch_sync_kernel_mappings(start, start + size);
+
 	return err;
 }
 

_

Patches currently in -mm which might be from [email protected] are

mm-track-page-table-modifications-in-__apply_to_page_range.patch

author maintainer tree notice
#19 lore raw

+ x86-numa-add-nohmat-option-fix.patch added to -mm tree

In reply to Andrew Morton
The patch titled Subject: x86/numa: fix build when CONFIG_ACPI is not set has been added to the -mm tree. Its filename is x86-numa-add-nohmat-option-fix.patch

The patch titled
Subject: x86/numa: fix build when CONFIG_ACPI is not set
has been added to the -mm tree. Its filename is
x86-numa-add-nohmat-option-fix.patch

This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/x86-numa-add-nohmat-option-fix.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/x86-numa-add-nohmat-option-fix.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Randy Dunlap <[email protected]>
Subject: x86/numa: fix build when CONFIG_ACPI is not set

Fix build errors when CONFIG_ACPI is not set/enabled by adding <acpi/acpi_numa.h> in the #else (!CONFIG_ACPI) block.

../arch/x86/mm/numa.c: In function `numa_setup':
../arch/x86/mm/numa.c:43:3: error: implicit declaration of function disable_srat'; did you mean disable_irq'? [-Werror=implicit-function-declaration]
disable_srat();
^~~~~~~~~~~~
../arch/x86/mm/numa.c:45:3: error: implicit declaration of function disable_hmat'; did you mean disable_dma'? [-Werror=implicit-function-declaration]
disable_hmat();
^~~~~~~~~~~~

---

 include/linux/acpi.h |    2 ++
 1 file changed, 2 insertions(+)
include/linux/acpi.h renamed from include/linux/acpi.h~x86-numa-add-nohmat-option-fix +2 -0
@@ -709,6 +709,8 @@ static inline u64 acpi_arch_get_root_poi
 #define ACPI_HANDLE_FWNODE(fwnode)	(NULL)
 #define ACPI_DEVICE_CLASS(_cls, _msk)	.cls = (0), .cls_msk = (0),
 
+#include <acpi/acpi_numa.h>
+
 struct fwnode_handle;
 
 static inline bool acpi_dev_found(const char *hid)

_

Patches currently in -mm which might be from [email protected] are

fs-ocfs2-delete-repeated-words-in-comments.patch x86-numa-add-nohmat-option-fix.patch fs-configfs-delete-repeated-words-in-comments.patch lib-bitmap-delete-duplicated-words.patch lib-libcrc32c-delete-duplicated-words.patch lib-decompress_bunzip2-delete-duplicated-words.patch lib-devres-delete-duplicated-words.patch lib-dynamic_queue_limits-delete-duplicated-words-fix-typo.patch lib-earlycpio-delete-duplicated-words.patch lib-radix-tree-delete-duplicated-words.patch lib-syscall-delete-duplicated-words.patch lib-test_sysctl-delete-duplicated-words.patch