linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mm, kasan: don't call kasan_krealloc() from ksize().
@ 2016-04-13 11:20 Alexander Potapenko
  2016-04-13 11:20 ` [PATCH v2 2/2] mm, kasan: add a ksize() test Alexander Potapenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexander Potapenko @ 2016-04-13 11:20 UTC (permalink / raw)
  To: adech.fo, dvyukov, cl, akpm, ryabinin.a.a, kcc
  Cc: kasan-dev, linux-kernel, linux-mm

Instead of calling kasan_krealloc(), which replaces the memory allocation
stack ID (if stack depot is used), just unpoison the whole memory chunk.

Signed-off-by: Alexander Potapenko <glider@google.com>
---
v2: - splitted v1 into two patches
---
 mm/slab.c | 2 +-
 mm/slub.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 17e2848..de46319 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4324,7 +4324,7 @@ size_t ksize(const void *objp)
 	/* We assume that ksize callers could use the whole allocated area,
 	 * so we need to unpoison this area.
 	 */
-	kasan_krealloc(objp, size, GFP_NOWAIT);
+	kasan_unpoison_shadow(objp, size);
 
 	return size;
 }
diff --git a/mm/slub.c b/mm/slub.c
index 4dbb109e..62194e2 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3635,8 +3635,9 @@ size_t ksize(const void *object)
 {
 	size_t size = __ksize(object);
 	/* We assume that ksize callers could use whole allocated area,
-	   so we need unpoison this area. */
-	kasan_krealloc(object, size, GFP_NOWAIT);
+	 * so we need to unpoison this area.
+	 */
+	kasan_unpoison_shadow(object, size);
 	return size;
 }
 EXPORT_SYMBOL(ksize);
-- 
2.8.0.rc3.226.g39d4020

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-28 11:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13 11:20 [PATCH v2 1/2] mm, kasan: don't call kasan_krealloc() from ksize() Alexander Potapenko
2016-04-13 11:20 ` [PATCH v2 2/2] mm, kasan: add a ksize() test Alexander Potapenko
2016-04-15 15:59   ` Andrey Ryabinin
2016-04-15 15:58 ` [PATCH v2 1/2] mm, kasan: don't call kasan_krealloc() from ksize() Andrey Ryabinin
2016-04-22 21:32 ` Andrew Morton
2016-04-28 11:31   ` Alexander Potapenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).