Skip to contentSkip to conversation

kcov-dont-generate-a-warning-on-vm_insert_pages-failure.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Apr 22, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The patch titled
Subject: kcov: don't generate a warning on vm_insert_page()'s failure
has been removed from the -mm tree. Its filename was
kcov-dont-generate-a-warning-on-vm_insert_pages-failure.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Aleksandr Nogikh <[email protected]>
Subject: kcov: don't generate a warning on vm_insert_page()'s failure

vm_insert_page()'s failure is not an unexpected condition, so don't do WARN_ONCE() in such a case.

Instead, print a kernel message and just return an error code.

This flaw has been reported under an OOM condition by sysbot
(https://lkml.kernel.org/r/[email protected]).

The message is mainly for the benefit of the test log, in this case the fuzzer's log so that humans inspecting the log can figure out what was going on. KCOV is a testing tool, so I think being a little more chatty when KCOV unexpectedly is about to fail will save someone debugging time.

We don't want the WARN, because it's not a kernel bug that syzbot should report, and failure can happen if the fuzzer tries hard enough (as above).

Fixes b3d7fe86fbd0 ("kcov: properly handle subsequent mmap calls"),
Cc Dmitry Vyukov <[email protected]>
Cc Andrey Konovalov <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Taras Madan <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>

---

 kernel/kcov.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/kcov.c renamed from kernel/kcov.c~kcov-dont-generate-a-warning-on-vm_insert_pages-failure +5 -2
@@ -475,8 +475,11 @@ static int kcov_mmap(struct file *filep,
 	vma->vm_flags |= VM_DONTEXPAND;
 	for (off = 0; off < size; off += PAGE_SIZE) {
 		page = vmalloc_to_page(kcov->area + off);
-		if (vm_insert_page(vma, vma->vm_start + off, page))
-			WARN_ONCE(1, "vm_insert_page() failed");
+		res = vm_insert_page(vma, vma->vm_start + off, page);
+		if (res) {
+			pr_warn_once("kcov: vm_insert_page() failed\n");
+			return res;
+		}
 	}
 	return 0;
 exit:

_

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