Re: PANIC: double fault in fixup_bad_iret

From: Peter Zijlstra
Date: Tue Jun 02 2020 - 05:42:04 EST


On Mon, Jun 01, 2020 at 02:40:31PM +0200, Marco Elver wrote:
> I think Peter wanted to send a patch to add __no_kcsan to noinstr:
> https://lkml.kernel.org/r/20200529170755.GN706495@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> In the same patch we can add __no_sanitize_address to noinstr. But:
>
> - We're missing a definition for __no_sanitize_undefined and
> __no_sanitize_coverage.

Do those function attributes actually work? Because the last time I
played with some of that I didn't.

Specifically: unmarked __always_inline functions must not generate
instrumentation when they're inlined into a __no_*san function.

(and that fails to build on some GCC versions, and I think fails to
actually work on the rest of them, but I'd have to double check)

> - We still need the above blanket no-instrument for x86 because of
> GCC. We could guard it with "ifdef CONFIG_CC_IS_GCC".

Right; so all of GCC is broken vs that function attribute stuff? Any
plans of getting that fixed? Do we have GCC that care?

Does the GCC plugin approach sound like a viable alternative
implementation of all this?

Anyway, we can make it:

KASAN := SANITIZER_HAS_FUNCTION_ATTRIBUTES

or something, and only make that 'y' when the compiler is sane.

> Not sure what the best strategy is to minimize patch conflicts. For
> now I could send just the patches to add missing definitions. If you'd
> like me to send all patches (including modifying 'noinstr'), let me
> know.

If you're going to do patches anyway, might as well do that :-)