Re: [PATCH v2] x86: Return to kernel without IRET

From: H. Peter Anvin
Date: Sat May 03 2014 - 02:12:40 EST


On 05/02/2014 09:32 PM, Linus Torvalds wrote:
> On Fri, May 2, 2014 at 4:53 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>> On my box, this saves about 100ns on each interrupt and trap that
>> happens while running in kernel space. This speeds up my kernel_pf
>> microbenchmark by about 17%.
>
> Btw, would you mind _trying_ to do a similar trick for the "return to
> user space" case?
>
> At least as a proof-of-concept, having a code sequence in user mode
> trampoline that does
>
> popq %rsi
> popq %r11
> retq $128
>
> and building up a stack in user space at '%rsp-128' that has the
> values or rsi/r11/rip should allow us to use 'sysret'. Hmm?
>

That would be a security hole if another userspace thread could muck
with the stack.

-hpa


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/