On Mon, May 08, 2023 at 09:03:15AM +0200, Ard Biesheuvel wrote: > The 32-bit trampoline no longer uses the stack for anything except > performing a long return back to long mode. Currently, this stack is > allocated in the same page that carries the trampoline code, which means > this page must be mapped writable and executable, and the stack is > therefore executable as well. > > So let's do a long jump instead: that way, we can pre-calculate the > return address and poke it into the code before we call it. In a later > patch, we will take advantage of this by removing writable permissions > (and adding executable ones) explicitly when booting via the EFI stub. > > Not playing with the stack pointer also makes it more straight-forward > to call the trampoline code as an ordinary 64-bit function from C code. > > Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx> Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> -- Kiryl Shutsemau / Kirill A. Shutemov