From: Dmitry Vyukov <[email protected]>

commit 5c335fe020ea287b2b49cc4dfca9f6756b88bb71 upstream.

When kmemleak dumps contents of leaked objects it reads whole objects
regardless of user-requested size.  This upsets KASAN.  Disable KASAN
checks around object dump.

Link: 
http://lkml.kernel.org/r/[email protected]
Signed-off-by: Dmitry Vyukov <[email protected]>
Acked-by: Catalin Marinas <[email protected]>
Cc: Andrey Ryabinin <[email protected]>
Cc: Alexander Potapenko <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>

Found during investigating https://jira.sw.ru/browse/PSBM-66617
Signed-off-by: Andrey Ryabinin <[email protected]>
---
 mm/kmemleak.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index ea54d1bd0eb8..db297cdd7e51 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -299,6 +299,8 @@ static void hex_dump_object(struct seq_file *seq,
                min(object->size, (size_t)(HEX_MAX_LINES * HEX_ROW_SIZE));
 
        seq_printf(seq, "  hex dump (first %d bytes):\n", len);
+       kasan_disable_current();
+
        for (i = 0; i < len; i += HEX_ROW_SIZE) {
                int linelen = min(remaining, HEX_ROW_SIZE);
 
@@ -308,6 +310,7 @@ static void hex_dump_object(struct seq_file *seq,
                                   HEX_ASCII);
                seq_printf(seq, "    %s\n", linebuf);
        }
+       kasan_enable_current();
 }
 
 /*
-- 
2.13.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to