[PATCH v3 08/15] kasan: add compiler barriers to KUNIT_EXPECT_KASAN_FAIL

Alexander Potapenko glider at google.com
Fri Jan 15 09:11:40 EST 2021


On Thu, Jan 14, 2021 at 8:36 PM Andrey Konovalov <andreyknvl at google.com> wrote:
>
> It might not be obvious to the compiler that the expression must be
> executed between writing and reading to fail_data. In this case, the
> compiler might reorder or optimize away some of the accesses, and
> the tests will fail.
>
> Add compiler barriers around the expression in KUNIT_EXPECT_KASAN_FAIL
> and use READ/WRITE_ONCE() for accessing fail_data fields.
>
> Link: https://linux-review.googlesource.com/id/I046079f48641a1d36fe627fc8827a9249102fd50
> Reviewed-by: Marco Elver <elver at google.com>
> Signed-off-by: Andrey Konovalov <andreyknvl at google.com>
Reviewed-by: Alexander Potapenko <glider at google.com>



More information about the linux-arm-kernel mailing list