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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230123170419.7292-4-george@enfabrica.net>
Date:   Mon, 23 Jan 2023 11:04:13 -0600
From:   George Prekas <george@...abrica.net>
To:     linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc:     Catalin Marinas <catalin.marinas@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Hyeonggon Yoo <42.hyeyoo@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Andy Lutomirski <luto@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        "Liam R. Howlett" <Liam.Howlett@...cle.com>,
        Fenghua Yu <fenghua.yu@...el.com>,
        Andrei Vagin <avagin@...il.com>,
        George Prekas <george@...abrica.net>
Subject: [PATCH 3/9] mm: kmemleak: propagate NO_SCAN flag in delete_object_part

When part of an object is deleted, propagate the OBJECT_NO_SCAN flag to
the 2 new created objects.

Signed-off-by: George Prekas <george@...abrica.net>
---
 mm/kmemleak.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 2b9c9ad68806..5882f60d127c 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -772,7 +772,7 @@ static void delete_object_full(unsigned long ptr)
  */
 static void delete_object_part(unsigned long ptr, size_t size, bool is_phys)
 {
-	struct kmemleak_object *object;
+	struct kmemleak_object *object, *o1 = NULL, *o2 = NULL;
 	unsigned long start, end;
 
 	object = find_and_remove_object(ptr, 1, is_phys);
@@ -792,11 +792,19 @@ static void delete_object_part(unsigned long ptr, size_t size, bool is_phys)
 	start = object->pointer;
 	end = object->pointer + object->size;
 	if (ptr > start)
-		__create_object(start, ptr - start, object->min_count,
-			      GFP_KERNEL, is_phys);
+		o1 = __create_object(start, ptr - start, object->min_count,
+				     GFP_KERNEL, is_phys);
 	if (ptr + size < end)
-		__create_object(ptr + size, end - ptr - size, object->min_count,
-			      GFP_KERNEL, is_phys);
+		o2 = __create_object(ptr + size, end - ptr - size,
+				     object->min_count, GFP_KERNEL, is_phys);
+
+	/* Propagate the NO_SCAN flag */
+	if (object->flags & OBJECT_NO_SCAN) {
+		if (o1)
+			o1->flags |= OBJECT_NO_SCAN;
+		if (o2)
+			o2->flags |= OBJECT_NO_SCAN;
+	}
 
 	__delete_object(object);
 }
-- 
2.37.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ