[lkml]   [2022]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCHv5 15/30] x86/boot: Port I/O: allow to hook up alternative helpers
On Wed, Mar 02, 2022 at 11:41:53AM -0800, Dave Hansen wrote:
> On 3/2/22 09:42, Josh Poimboeuf wrote:
> > At the very least, please remove the ability for future code to> accidentally bypass 'pio_ops'. Going forward, are we really expected
> to> just remember to always use pio_ops for i/o? Or else TDX will just>
> silently break? That's just not acceptable.
> What did you have in mind here? The in/out() instruction wrappers could
> be moved to a spot where they're impossible to call directly, for instance.

I guess, though why not just put the pio_ops crud in the inb/outb
wrappers themselves?

> I guess we could get really fancy and use objtool to look for any I/O
> instructions that show up outside of the "official" pio_ops copies.
> That would prevent anyone using inline assembly.

Yeah, there's no easy solution for asm and inline asm. We would need
something like objtool to enforce the new "non-direct-i/o" policy in
boot code. But objtool doesn't even validate boot code.

And it looks this patch missed an "outb"?

static inline void io_delay(void)
const u16 DELAY_PORT = 0x80;
asm volatile("outb %%al,%0" : : "dN" (DELAY_PORT));

> In the end, though, TDX *is* a new sub-architecture. There are lots of
> ways it's going to break silently and nobody will notice on bare metal.
> SEV is the same way with things like the C (encryption) bit in the page
> tables. Adding more safeguards sounds like a good idea but, in the end,
> we're going to have to find the non-obvious issues with testing.

Right, but for this case there's no reason to destabilize TDX on


 \ /
  Last update: 2022-03-02 21:02    [W:5.060 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site