[Devel,RHEL7,COMMIT] ms/mm: prevent KASAN false positives in kmemleak

Submitted by Konstantin Khorenko on May 31, 2017, 1:41 p.m.


Message ID 201705311341.v4VDfWnX018707@finist_cl7.x64_64.work.ct
State New
Series "ms/mm: prevent KASAN false positives in kmemleak"
Headers show

Commit Message

Konstantin Khorenko May 31, 2017, 1:41 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.32.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.32.5
commit bf0630292fd57923fac16db5d73c974b8633ca5d
Author: Dmitry Vyukov <dvyukov@google.com>
Date:   Wed May 31 17:41:32 2017 +0400

    ms/mm: prevent KASAN false positives in kmemleak
    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/1466617631-68387-1-git-send-email-dvyukov@google.com
    Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
    Acked-by: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
    Cc: Alexander Potapenko <glider@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Found during investigating https://jira.sw.ru/browse/PSBM-66617
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
 mm/kmemleak.c | 3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index ea54d1b..db297cd 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,
 		seq_printf(seq, "    %s\n", linebuf);
+	kasan_enable_current();