kasan: support instrumented bitops combined with generic bitops

Currently bitops-instrumented.h assumes that the architecture provides
atomic, non-atomic and locking bitops (e.g. both set_bit and __set_bit).
This is true on x86 and s390, but is not always true: there is a
generic bitops/non-atomic.h header that provides generic non-atomic
operations, and also a generic bitops/lock.h for locking operations.

powerpc uses the generic non-atomic version, so it does not have it's
own e.g. __set_bit that could be renamed arch___set_bit.

Split up bitops-instrumented.h to mirror the atomic/non-atomic/lock
split. This allows arches to only include the headers where they
have arch-specific versions to rename. Update x86 and s390.

(The generic operations are automatically instrumented because they're
written in C, not asm.)

Suggested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Marco Elver <elver@google.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190820024941.12640-1-dja@axtens.net
This commit is contained in:
Daniel Axtens
2019-08-20 12:49:40 +10:00
committed by Michael Ellerman
parent da0c9ea146
commit 81d2c6f819
7 changed files with 317 additions and 266 deletions

View File

@@ -57,7 +57,22 @@ The Linux kernel provides more basic utility functions.
Bit Operations
--------------
.. kernel-doc:: include/asm-generic/bitops-instrumented.h
Atomic Operations
~~~~~~~~~~~~~~~~~
.. kernel-doc:: include/asm-generic/bitops/instrumented-atomic.h
:internal:
Non-atomic Operations
~~~~~~~~~~~~~~~~~~~~~
.. kernel-doc:: include/asm-generic/bitops/instrumented-non-atomic.h
:internal:
Locking Operations
~~~~~~~~~~~~~~~~~~
.. kernel-doc:: include/asm-generic/bitops/instrumented-lock.h
:internal:
Bitmap Operations