Message ID | 20191011004059.28581-2-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/vdso: sgx: Bug fixes | expand |
diff --git a/arch/x86/entry/vdso/vsgx_enter_enclave.S b/arch/x86/entry/vdso/vsgx_enter_enclave.S index fc5622dcd2fa..b63091818df1 100644 --- a/arch/x86/entry/vdso/vsgx_enter_enclave.S +++ b/arch/x86/entry/vdso/vsgx_enter_enclave.S @@ -135,10 +135,12 @@ ENTRY(__vdso_sgx_enter_enclave) .Linvoke_userspace_handler: /* * Align stack per x86_64 ABI. Save the original %rsp in %rbx to be - * restored after the callback returns. + * restored after the callback returns. Note, %rsp needs to be 16-byte + * aligned _after_ pushing the three parameters on the stack. */ mov %rsp, %rbx and $-0x10, %rsp + sub $0x8, %rsp /* Push @e, u_rsp and @tcs as parameters to the callback. */ push 0x18(%rbp)
Fix a recently introduced bug where an odd number of 8-byte parameters are pushed on the stack prior to invoking the userspace callback, which causes the CALL to execute with an unaligned stack and violate the x86_64 ABI. Reported-by: Cedric Xing <cedric.xing@intel.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> --- arch/x86/entry/vdso/vsgx_enter_enclave.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)