Re: [PATCH] [RFC] ubsan: disallow bounds checking with gcov on broken gcc
From: Arnd Bergmann
Date: Thu Jun 01 2023 - 13:51:12 EST
On Thu, Jun 1, 2023, at 18:14, Kees Cook wrote:
> On Thu, Jun 01, 2023 at 05:18:11PM +0200, Arnd Bergmann wrote:
>
> I think more production systems will have CONFIG_UBSAN_BOUNDS enabled
> (e.g. Ubuntu has had it enabled for more than a year now) than GCOV,
> so I'd prefer we maintain all*config coverage for the more commonly
> used config.
Fair enough, I can send that as v2, but let's see what the others
think first.
>> config CC_HAS_UBSAN_BOUNDS_STRICT
>> def_bool $(cc-option,-fsanitize=bounds-strict)
>> + # work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110074
>> + depends on GCC_VERSION > 140000 || !GCOV_PROFILE_ALL
>> help
>> The -fsanitize=bounds-strict option is only available on GCC,
>> but uses the more strict handling of arrays that includes knowledge
>
> Alternatively, how about falling back to -fsanitize=bounds instead, as
> that (which has less coverage) wasn't triggering the stack frame
> warnings?
>
> i.e. fall back through these:
> -fsanitize=array-bounds (Clang)
> -fsanitize=bounds-strict (!GCOV || bug fixed in GCC)
> -fsanitize=bounds
>From what I can tell, -fsanitize=bounds has the same problem
as -fsanitize=bounds-strict, so that would not help.
Arnd