Re: [linus:master] BUILD REGRESSION a2e5790d841658485d642196dbb0927303d6c22f

From: Linus Torvalds
Date: Wed Feb 07 2018 - 14:43:43 EST


On Wed, Feb 7, 2018 at 11:28 AM, Borislav Petkov <bp@xxxxxxxxx> wrote:
> On Wed, Feb 07, 2018 at 08:14:51PM +0100, Peter Zijlstra wrote:
>> Then someone went and wrecked it.
>
> Yeah, note says UD0 didn't eat a ModRM byte on old CPUs. But then that
> changed too. Fun stuff changing insn encoding underway.
>
> So if we opt for adding a ModRM byte, could a 0x90 NOP work so that it
> doesn't shit itself on those old CPUs?

We could just also decide that the only thing that the modrm bytes of
UD0 actually *affect* is how the CPU might act for a page-crossing
instruction.

Because I think that's the only semantic difference: if it's a
page-crosser, the instruction could take a page fault before raising
the #UD.

Is there any other decode issue we might want to look out for?

Anyway, then we'd make the rule be:

- we promise to always pad up the following bytes (our extra warning
information etc) so that we never have a missing page afterwards (this
is presumably practically speaking already the case). It might still
be a page-crossing instruction, but we won't take a page fault in
kernel space (due to it being at the end of some text sectoin or
whatever that changes the NX bit or due to DEBUG_PAGEALLOC having
unmapped the next page).

- we special-case the decoder so that we don't get this warning

and then we just ignore the issue entirely.

Hmm?

Linus