Re: [PATCH] ubsan: Require GCC-8+ or Clang to use UBSAN

From: Kees Cook
Date: Tue Feb 09 2021 - 20:58:00 EST


On Wed, Feb 10, 2021 at 02:17:57AM +0300, Andrey Rybainin wrote:
> >>>> Subject: ubsan: Require GCC-8+ or Clang to use UBSAN
> >>>>
> >>>> Just like how we require GCC-8.2 for KASAN due to compiler bugs, require
> >>>> a sane version of GCC for UBSAN.
> >>>>
> >>>> Specifically, before GCC-8 UBSAN doesn't respect -fwrapv and thinks
> >>>> signed arithmetic is buggered.
> >>>
> >>> Actually removing CONFIG_UBSAN_SIGNED_OVERFLOW would give us the same
> >>> effect without restricting GCC versions.
> >>
> >> Is that preferable? Always happy to remove code, just need some
> >> justification behind it.
> >
> > Is Peter's patch acceptable or do you want to do something else?
>
> I do prefer to just remove the code, I'll send the patch shortly.

I have a specific goal of getting both signed and unsigned overflow
detection working sanely, so removing this entirely from the kernel
really makes working on that difficult. :)

I view the primary problem as compiler-specific. I'd much rather we
correctly mask against versions (or better yet, behaviors).

--
Kees Cook