diff mbox series

[-next,1/2] mm: disable KCSAN for kmemleak

Message ID 1583263716-25150-1-git-send-email-cai@lca.pw (mailing list archive)
State New, archived
Headers show
Series [-next,1/2] mm: disable KCSAN for kmemleak | expand

Commit Message

Qian Cai March 3, 2020, 7:28 p.m. UTC
Kmemleak could scan task stacks while plain writes happens to those
stack variables which could results in data races. For example, in
sys_rt_sigaction and do_sigaction(), it could have plain writes in
a 32-byte size. Since the kmemleak does not care about the actual values
of a non-pointer and all do_sigaction() call sites only copy to stack
variables, just disable KCSAN for kmemleak to avoid annotating anything
outside Kmemleak just because Kmemleak scans everything.

Suggested-by: Marco Elver <elver@google.com>
Signed-off-by: Qian Cai <cai@lca.pw>
---
 mm/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

Marco Elver March 3, 2020, 8:20 p.m. UTC | #1
On Tue, 3 Mar 2020 at 20:28, Qian Cai <cai@lca.pw> wrote:
>
> Kmemleak could scan task stacks while plain writes happens to those
> stack variables which could results in data races. For example, in
> sys_rt_sigaction and do_sigaction(), it could have plain writes in
> a 32-byte size. Since the kmemleak does not care about the actual values
> of a non-pointer and all do_sigaction() call sites only copy to stack
> variables, just disable KCSAN for kmemleak to avoid annotating anything
> outside Kmemleak just because Kmemleak scans everything.
>
> Suggested-by: Marco Elver <elver@google.com>
> Signed-off-by: Qian Cai <cai@lca.pw>

Acked-by: Marco Elver <elver@google.com>

Thank you!

> ---
>  mm/Makefile | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/Makefile b/mm/Makefile
> index 946754cc66b6..6e263045f0c2 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -14,6 +14,7 @@ KCSAN_SANITIZE_slab_common.o := n
>  KCSAN_SANITIZE_slab.o := n
>  KCSAN_SANITIZE_slub.o := n
>  KCSAN_SANITIZE_page_alloc.o := n
> +KCSAN_SANITIZE_kmemleak.o := n
>
>  # These files are disabled because they produce non-interesting and/or
>  # flaky coverage that is not a function of syscall inputs. E.g. slab is out of
> --
> 1.8.3.1
>
Catalin Marinas March 11, 2020, 2:18 p.m. UTC | #2
On Tue, Mar 03, 2020 at 02:28:35PM -0500, Qian Cai wrote:
> Kmemleak could scan task stacks while plain writes happens to those
> stack variables which could results in data races. For example, in
> sys_rt_sigaction and do_sigaction(), it could have plain writes in
> a 32-byte size. Since the kmemleak does not care about the actual values
> of a non-pointer and all do_sigaction() call sites only copy to stack
> variables, just disable KCSAN for kmemleak to avoid annotating anything
> outside Kmemleak just because Kmemleak scans everything.
> 
> Suggested-by: Marco Elver <elver@google.com>
> Signed-off-by: Qian Cai <cai@lca.pw>

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

Patch

diff --git a/mm/Makefile b/mm/Makefile
index 946754cc66b6..6e263045f0c2 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -14,6 +14,7 @@  KCSAN_SANITIZE_slab_common.o := n
 KCSAN_SANITIZE_slab.o := n
 KCSAN_SANITIZE_slub.o := n
 KCSAN_SANITIZE_page_alloc.o := n
+KCSAN_SANITIZE_kmemleak.o := n
 
 # These files are disabled because they produce non-interesting and/or
 # flaky coverage that is not a function of syscall inputs. E.g. slab is out of