Re: [PATCH] powerpc: Enable UBSAN support

From: Michael Ellerman
Date: Mon Dec 14 2015 - 23:35:57 EST


Hi Daniel,

Great work thanks for getting this going.

On Tue, 2015-12-15 at 14:46 +1100, Daniel Axtens wrote:

> This hooks up UBSAN support for PowerPC.
>
> So far it's found some interesting cases where we don't properly sanitise
> input to shifts, including one in our futex handling. It's also found an
> out of bounds read in an array. Nothing critical, but worth fixing.
>
> Tested-by: Andrew Donnellan <andrew.donnellan@xxxxxxxxxxx>
> CC: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>
> Signed-off-by: Daniel Axtens <dja@xxxxxxxxxx>
> ---
>
> RFC -> v1:
> - Update patch to use fixed spelling of SANITIZE.
> - Include tested by tag from Andrew - Thanks!
>
> This applies on top of next with Andrey's patches:
> 1) https://patchwork.kernel.org/patch/7761341/
> 2) https://patchwork.kernel.org/patch/7761351/
> 3) https://patchwork.kernel.org/patch/7761361/
> 4) https://patchwork.kernel.org/patch/7785791/
> 5) https://patchwork.kernel.org/patch/7819661/
>
> -mm and therefore -next have these patches, and the RFC of this
> patch.
>
> This has now been tested on LE and BE 64bit, on pseries, bml and
> PowerNV.


Have you tried running with KVM?

I'm wondering if we should be excluding some of the KVM code that runs in real mode, eg:

arch/powerpc/kvm/book3s_hv_rm_mmu.c
arch/powerpc/kvm/book3s_hv_rm_xics.c

And maybe some other bits.

Also the early setup code, a/p/k/setup*.c might be dicey.

In all of the above it's probably OK unless you actually hit a warning at the
wrong point, so testing will probably not find problems. Although I guess we
could add some deliberatly incorrect code at certain points and check we
survive the warning.

Is there an easy way to spot the calls to UBSAN in the generated code?

cheers

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/