2019-06-13 15:23:48

by Andrey Ryabinin

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] lib/test_kasan: Add bitops tests



On 6/13/19 3:30 PM, Marco Elver wrote:
> This adds bitops tests to the test_kasan module. In a follow-up patch,
> support for bitops instrumentation will be added.
>
> Signed-off-by: Marco Elver <[email protected]>
> Acked-by: Mark Rutland <[email protected]>
> ---

Reviewed-by: Andrey Ryabinin <[email protected]>




> +static noinline void __init kasan_bitops(void)
> +{
> + /*
> + * Allocate 1 more byte, which causes kzalloc to round up to 16-bytes;
> + * this way we do not actually corrupt other memory, in case
> + * instrumentation is not working as intended.

This sound like working instrumentation somehow save us from corrupting memory. In fact it doesn't,
it only reports corruption.

> + */
> + long *bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
> + if (!bits)
> + return;
> +