[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220926100757.783271779@linuxfoundation.org>
Date: Mon, 26 Sep 2022 12:11:21 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Peter Collingbourne <pcc@...gle.com>,
Vlastimil Babka <vbabka@...e.cz>
Subject: [PATCH 5.15 047/148] kasan: call kasan_malloc() from __kmalloc_*track_caller()
From: Peter Collingbourne <pcc@...gle.com>
commit 5373b8a09d6e037ee0587cb5d9fe4cc09077deeb upstream.
We were failing to call kasan_malloc() from __kmalloc_*track_caller()
which was causing us to sometimes fail to produce KASAN error reports
for allocations made using e.g. devm_kcalloc(), as the KASAN poison was
not being initialized. Fix it.
Signed-off-by: Peter Collingbourne <pcc@...gle.com>
Cc: <stable@...r.kernel.org> # 5.15
Signed-off-by: Vlastimil Babka <vbabka@...e.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
mm/slub.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -4920,6 +4920,8 @@ void *__kmalloc_track_caller(size_t size
/* Honor the call site pointer we received. */
trace_kmalloc(caller, ret, size, s->size, gfpflags);
+ ret = kasan_kmalloc(s, ret, size, gfpflags);
+
return ret;
}
EXPORT_SYMBOL(__kmalloc_track_caller);
@@ -4951,6 +4953,8 @@ void *__kmalloc_node_track_caller(size_t
/* Honor the call site pointer we received. */
trace_kmalloc_node(caller, ret, size, s->size, gfpflags, node);
+ ret = kasan_kmalloc(s, ret, size, gfpflags);
+
return ret;
}
EXPORT_SYMBOL(__kmalloc_node_track_caller);
Powered by blists - more mailing lists