linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: prevent KASAN false positives in kmemleak
@ 2016-06-22 17:47 Dmitry Vyukov
  2016-06-23  9:59 ` Catalin Marinas
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Vyukov @ 2016-06-22 17:47 UTC (permalink / raw)
  To: catalin.marinas, linux-mm, akpm
  Cc: linux-kernel, ryabinin.a.a, kasan-dev, glider, Dmitry Vyukov

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.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
---
 mm/kmemleak.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index e642992..04320d3 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -307,8 +307,10 @@ static void hex_dump_object(struct seq_file *seq,
 	len = min_t(size_t, object->size, HEX_MAX_LINES * HEX_ROW_SIZE);
 
 	seq_printf(seq, "  hex dump (first %zu bytes):\n", len);
+	kasan_disable_current();
 	seq_hex_dump(seq, "    ", DUMP_PREFIX_NONE, HEX_ROW_SIZE,
 		     HEX_GROUP_SIZE, ptr, len, HEX_ASCII);
+	kasan_enable_current();
 }
 
 /*
-- 
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] 2+ messages in thread

* Re: [PATCH] mm: prevent KASAN false positives in kmemleak
  2016-06-22 17:47 [PATCH] mm: prevent KASAN false positives in kmemleak Dmitry Vyukov
@ 2016-06-23  9:59 ` Catalin Marinas
  0 siblings, 0 replies; 2+ messages in thread
From: Catalin Marinas @ 2016-06-23  9:59 UTC (permalink / raw)
  To: Dmitry Vyukov
  Cc: linux-mm, akpm, linux-kernel, ryabinin.a.a, kasan-dev, glider

On Wed, Jun 22, 2016 at 07:47:11PM +0200, Dmitry Vyukov wrote:
> 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.
> 
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> ---
>  mm/kmemleak.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index e642992..04320d3 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -307,8 +307,10 @@ static void hex_dump_object(struct seq_file *seq,
>  	len = min_t(size_t, object->size, HEX_MAX_LINES * HEX_ROW_SIZE);
>  
>  	seq_printf(seq, "  hex dump (first %zu bytes):\n", len);
> +	kasan_disable_current();
>  	seq_hex_dump(seq, "    ", DUMP_PREFIX_NONE, HEX_ROW_SIZE,
>  		     HEX_GROUP_SIZE, ptr, len, HEX_ASCII);
> +	kasan_enable_current();
>  }

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

--
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	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-23  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-22 17:47 [PATCH] mm: prevent KASAN false positives in kmemleak Dmitry Vyukov
2016-06-23  9:59 ` Catalin Marinas

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).