The untrusted stack is restored from %rbx after the userspace exit handler, but that only works if %rsp is first saved into %rbx... Reported-by: Cedric Xing <cedric.xing@xxxxxxxxx> Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> --- arch/x86/entry/vdso/vsgx_enter_enclave.S | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S index 94f613b53b13..e56737cc9f2c 100644 --- a/arch/x86/entry/vdso/vsgx_enter_enclave.S +++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S @@ -137,6 +137,9 @@ ENTRY(__vdso_sgx_enter_enclave) /* Pass the untrusted RSP (at exit) to the callback via %rcx. */ mov %rsp, %rcx + /* Save the untrusted RSP in %rbx (non-volatile register). */ + mov %rsp, %rbx + /* * Align stack per x86_64 ABI. Note, %rsp needs to be 16-byte aligned * _after_ pushing the three parameters on the stack. -- 2.22.0