[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180206232514.qcy4y3dzfkjo3xdg@treble>
Date: Tue, 6 Feb 2018 17:25:14 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: David Woodhouse <dwmw2@...radead.org>
Cc: Borislav Petkov <bp@...en8.de>, X86 ML <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, tim.c.chen@...ux.intel.com,
pjt@...gle.com, jikos@...nel.org, gregkh@...ux-foundation.org,
dave.hansen@...el.com, riel@...hat.com, luto@...capital.net,
torvalds@...ux-foundation.org, ak@...ux.intel.com,
keescook@...gle.com, peterz@...radead.org
Subject: Re: [PATCH 2/2] x86/speculation: Simplify
indirect_branch_prediction_barrier()
On Tue, Feb 06, 2018 at 07:44:52PM +0000, David Woodhouse wrote:
> On Fri, 2018-01-26 at 21:08 +0100, Borislav Petkov wrote:
> > Make it all a function which does the WRMSR instead of having a hairy
> > inline asm.
>
> ...
>
> > + alternative_input("",
> > + "call __ibp_barrier",
> > + X86_FEATURE_IBPB,
> > + ASM_NO_INPUT_CLOBBER("eax", "ecx", "edx", "memory"));
> > }
>
> Dammit. I know the best time to comment is *before* I add my own sign-
> off to it and before Linus has merged it but... I think this is broken.
>
> If you're calling a C function then you have to mark *all* the call-
> clobbered registers as, well, clobbered.
>
> If you really really really want to *call* something out of line, then
> it would need to be implemented in asm.
Hm. In theory I agree this seems like a bug. On x86_64 I believe we
would need to mark the following registers as clobbered: r8-r11, ax, cx,
dx, si, di, plus "memory" and "cc".
But I'm scratching my head a bit, because we seem to have this bug all
over the kernel. (Grep for ASM_CALL_CONSTRAINT to see them.)
Many of those inline asm calls have been around a long time. So why
hasn't it ever bitten us?
--
Josh
Powered by blists - more mailing lists