On Sun, Apr 13, 2014, at 1:31, H. Peter Anvin wrote: > >>> d. Trampoline in user space > >>> > >>> A return to the vdso with values set up in registers r8-r15 would enable > >>> a trampoline in user space. Unfortunately there is no way > >>> to do a far JMP entirely with register state so this would require > >>> touching user space memory, possibly in an unsafe manner. > > > > d.2. trampoline in user space via long mode > > > > Return from the kernel to a user space trampoline via long mode. > > The kernel changes the stack frame just before executing the iret > > instruction. (the CS and RIP slots are set to run the trampoline code, > > where CS is a long mode segment.) The trampoline code in userspace > > is set up to this single instruction: a far jump to the final CS:EIP > > (compatibility mode). > > This still requires user space memory that the kernel can write to. > Long mode is actually exactly identical to what I was suggesting above, > except that I would avoid using self-modifying code in favor of just > parameterization using the high registers.
No self modifying code... The far jump must be in the indirect form anyhow. The CS:EIP must be accessible from user mode, but not necessarily from compatibility mode. So the trampoline (the jump) and data (CS:EIP) can live pretty much anywhere in virtual memory. But indeed, I see what you meant now. Greetings, Alexander > > -hpa > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/