lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220401182512.249282-1-nogikh@google.com>
Date:   Fri,  1 Apr 2022 18:25:12 +0000
From:   Aleksandr Nogikh <nogikh@...gle.com>
To:     kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org,
        akpm@...ux-foundation.org
Cc:     dvyukov@...gle.com, andreyknvl@...il.com, elver@...gle.com,
        glider@...gle.com, tarasmadan@...gle.com, bigeasy@...utronix.de,
        nogikh@...gle.com
Subject: [PATCH v3] 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.

Signed-off-by: Aleksandr Nogikh <nogikh@...gle.com>
Acked-by: Marco Elver <elver@...gle.com>
---
PATCH v3:
* Adjusted the patch format.

PATCH v2:
* Added a newline at the end of pr_warn_once().
https://lore.kernel.org/all/20220401084333.85616-1-nogikh@google.com/

PATCH v1:
https://lore.kernel.org/all/20220331180501.4130549-1-nogikh@google.com/
---
 kernel/kcov.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/kcov.c b/kernel/kcov.c
index 475524bd900a..b3732b210593 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -475,8 +475,11 @@ static int kcov_mmap(struct file *filep, struct vm_area_struct *vma)
 	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:
-- 
2.35.1.1094.g7c7d902a7c-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ