Skip to content

Commit 475356f

Browse files
thejhakpm00
authored andcommitted
kasan/test: fix protection against compiler elision
The kunit test is using assignments to "static volatile void *kasan_ptr_result" to prevent elision of memory loads, but that's not working: In this variable definition, the "volatile" applies to the "void", not to the pointer. To make "volatile" apply to the pointer as intended, it must follow after the "*". This makes the kasan_memchr test pass again on my system. The kasan_strings test is still failing because all the definitions of load_unaligned_zeropad() are lacking explicit instrumentation hooks and ASAN does not instrument asm() memory operands. Link: https://lkml.kernel.org/r/[email protected] Fixes: 5f1c810 ("mm:kasan: fix sparse warnings: Should it be static?") Signed-off-by: Jann Horn <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Konovalov <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Dmitriy Vyukov <[email protected]> Cc: Jann Horn <[email protected]> Cc: Nihar Chaithanya <[email protected]> Cc: Vincenzo Frascino <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 6bcdbd6 commit 475356f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/kasan/kasan_test_c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static struct {
4747
* Some tests use these global variables to store return values from function
4848
* calls that could otherwise be eliminated by the compiler as dead code.
4949
*/
50-
static volatile void *kasan_ptr_result;
50+
static void *volatile kasan_ptr_result;
5151
static volatile int kasan_int_result;
5252

5353
/* Probe for console output: obtains test_status lines of interest. */

0 commit comments

Comments
 (0)