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

From: Marco Elver
Date: Thu Jun 13 2019 - 11:24:13 EST


On Thu, 13 Jun 2019 at 14:49, Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> wrote:
>
>
>
> 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 <elver@xxxxxxxxxx>
> > Acked-by: Mark Rutland <mark.rutland@xxxxxxx>
> > ---
>
> Reviewed-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
>
>
>
>
> > +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.

Thanks, I removed the confusing wording. Sent v5.

> > + */
> > + long *bits = kzalloc(sizeof(*bits) + 1, GFP_KERNEL);
> > + if (!bits)
> > + return;
> > +
>
> --
> You received this message because you are subscribed to the Google Groups "kasan-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@xxxxxxxxxxxxxxxxx
> To post to this group, send email to kasan-dev@xxxxxxxxxxxxxxxxx
> To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/6cc5e12d-1492-d9b7-3ea7-6381407439d7%40virtuozzo.com.
> For more options, visit https://groups.google.com/d/optout.