AMD DC graphics display code enables -mhard-float, -msse, -msse2 without any visible FPU state protection

Jann Horn jannh at google.com
Thu Apr 2 14:50:19 UTC 2020


On Thu, Apr 2, 2020 at 11:36 AM Thomas Gleixner <tglx at linutronix.de> wrote:
> Jann Horn <jannh at google.com> writes:
> > On Thu, Apr 2, 2020 at 9:34 AM Christian König <christian.koenig at amd.com> wrote:
> >> Am 02.04.20 um 04:34 schrieb Jann Horn:
> >> > [x86 folks in CC so that they can chime in on the precise rules for
> >> > this stuff]
>
> They are pretty simple.
>
> Any code using FPU needs to be completely isolated from regular code
> either by using inline asm or by moving it to a different compilation
> unit. The invocations need fpu_begin/end() of course.
[...]
> We really need objtool support to validate that.
>
> Peter, now that we know how to do it (noinstr, clac/stac) we can emit
> annotations (see patch below) and validate that any FPU instruction is
> inside a safe region. Hmm?

One annoying aspect is that for the "move it to a different
compilation unit" method, objtool needs to know at compile time
(before linking) which functions are in FPU-enabled object files,
right? So we'd need to have some sort of function annotation that gets
plumbed from the function declaration in a header file through the
compiler into the ELF file, and then let objtool verify that calls to
FPU-enabled methods occur only when the FPU is available? (Ideally
something that covers indirect calls... but this would probably get
really complicated unless we can get the compiler to include that
annotation in its type checking.)


More information about the amd-gfx mailing list