[PATCH] powerpc: Enable UBSAN support

Michael Ellerman mpe at ellerman.id.au
Tue Dec 15 15:35:50 AEDT 2015


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 at au1.ibm.com>
> CC: Andrey Ryabinin <aryabinin at virtuozzo.com>
> Signed-off-by: Daniel Axtens <dja at axtens.net>
> ---
> 
> 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



More information about the Linuxppc-dev mailing list