Skip to content

Commit 81d2c6f

Browse files
daxtensmpe
authored andcommitted
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
1 parent da0c9ea commit 81d2c6f

7 files changed

Lines changed: 317 additions & 266 deletions

File tree

‎Documentation/core-api/kernel-api.rst‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,22 @@ The Linux kernel provides more basic utility functions.
5757
Bit Operations
5858
--------------
5959

60-
.. kernel-doc:: include/asm-generic/bitops-instrumented.h
60+
Atomic Operations
61+
~~~~~~~~~~~~~~~~~
62+
63+
.. kernel-doc:: include/asm-generic/bitops/instrumented-atomic.h
64+
:internal:
65+
66+
Non-atomic Operations
67+
~~~~~~~~~~~~~~~~~~~~~
68+
69+
.. kernel-doc:: include/asm-generic/bitops/instrumented-non-atomic.h
70+
:internal:
71+
72+
Locking Operations
73+
~~~~~~~~~~~~~~~~~~
74+
75+
.. kernel-doc:: include/asm-generic/bitops/instrumented-lock.h
6176
:internal:
6277

6378
Bitmap Operations

‎arch/s390/include/asm/bitops.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ static inline void arch___clear_bit_unlock(unsigned long nr,
241241
arch___clear_bit(nr, ptr);
242242
}
243243

244-
#include <asm-generic/bitops-instrumented.h>
244+
#include <asm-generic/bitops/instrumented-atomic.h>
245+
#include <asm-generic/bitops/instrumented-non-atomic.h>
246+
#include <asm-generic/bitops/instrumented-lock.h>
245247

246248
/*
247249
* Functions which use MSB0 bit numbering.

‎arch/x86/include/asm/bitops.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ static __always_inline int fls64(__u64 x)
388388

389389
#include <asm-generic/bitops/const_hweight.h>
390390

391-
#include <asm-generic/bitops-instrumented.h>
391+
#include <asm-generic/bitops/instrumented-atomic.h>
392+
#include <asm-generic/bitops/instrumented-non-atomic.h>
393+
#include <asm-generic/bitops/instrumented-lock.h>
392394

393395
#include <asm-generic/bitops/le.h>
394396

‎include/asm-generic/bitops-instrumented.h‎

Lines changed: 0 additions & 263 deletions
This file was deleted.

0 commit comments

Comments
 (0)