[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180111095830.GY6176@hirez.programming.kicks-ass.net>
Date: Thu, 11 Jan 2018 10:58:30 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Borislav Petkov <bp@...en8.de>
Cc: "Woodhouse, David" <dwmw@...zon.co.uk>,
"Thomas.Lendacky@....com" <Thomas.Lendacky@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tim.c.chen@...ux.intel.com" <tim.c.chen@...ux.intel.com>,
"Ghitulete, Razvan-alin" <rga@...zon.com>,
"torvalds@...ux-foundation.org" <torvalds@...ux-foundation.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"x86@...nel.org" <x86@...nel.org>,
"riel@...hat.com" <riel@...hat.com>,
"keescook@...gle.com" <keescook@...gle.com>,
"gnomes@...rguk.ukuu.org.uk" <gnomes@...rguk.ukuu.org.uk>,
"pjt@...gle.com" <pjt@...gle.com>,
"dave.hansen@...el.com" <dave.hansen@...el.com>,
"luto@...capital.net" <luto@...capital.net>,
"jikos@...nel.org" <jikos@...nel.org>,
"gregkh@...ux-foundation.org" <gregkh@...ux-foundation.org>
Subject: Re: [PATCH] x86/retpoline: Fill return stack buffer on vmexit
On Thu, Jan 11, 2018 at 10:47:59AM +0100, Borislav Petkov wrote:
> On Thu, Jan 11, 2018 at 10:32:31AM +0100, Peter Zijlstra wrote:
> > can't you do lovely things like:
> >
> > volatile asm ("call __fill_rsb_thunk_%1" : : "r" (dummy))
> >
> > which would still let gcc select the register ?
>
> Calling a function from asm is nasty because you need to pay attention
> to clobbered registers as gcc doesn't see the function.
The point is that this is an asm function, much like the retpoline
thunks, replicated for each register.
And by stuffing the register in the function name and using a dummy
argument you let GCC pick which register to clobber.
Heck we could even pass in the actual stuff-count instead of treating it
as a pure dummy.
Powered by blists - more mailing lists