Messages in this thread | | | Date | Mon, 15 May 2023 17:03:03 +0300 | From | "Kirill A. Shutemov" <> | Subject | Re: [PATCH v2 05/20] x86: decompressor: Avoid the need for a stack in the 32-bit trampoline |
| |
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@kernel.org>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
-- Kiryl Shutsemau / Kirill A. Shutemov
| |