locking/atomic, asm-generic: Add KASAN instrumentation to atomic operations
authorDmitry Vyukov <dvyukov@google.com>
Mon, 29 Jan 2018 17:26:06 +0000 (18:26 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 12 Mar 2018 11:15:35 +0000 (12:15 +0100)
commita35353bb9eb1990a44a0d7585f99e9589bcdb682
tree1e9d221ae599ad730cb047c4e1b99b45bbaba011
parent8bf705d130396e69c04cd8e6e010244ad2ce71f4
locking/atomic, asm-generic: Add KASAN instrumentation to atomic operations

KASAN uses compiler instrumentation to intercept all memory accesses. But it does
not see memory accesses done in assembly code. One notable user of assembly code
is atomic operations. Frequently, for example, an atomic reference decrement is
the last access to an object and a good candidate for a racy use-after-free.

Add manual KASAN checks to atomic operations.

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>,
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>,
Cc: kasan-dev@googlegroups.com
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/2fa6e7f0210fd20fe404e5b67e6e9213af2b69a1.1517246437.git.dvyukov@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/asm-generic/atomic-instrumented.h