From 011031528208f7adac0206b7a7cb1ac39c939eab Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Fri, 7 Apr 2006 19:50:00 +0200 Subject: [PATCH] --- yaml --- r: 25335 b: refs/heads/master c: 7bf36bbc5e0c09271f9efe22162f8cc3f8ebd3d2 h: refs/heads/master i: 25333: 9c8a01484d6e6c9f3c48ce7e535a678c9959da6d 25331: ce4a16dbdd4bbc2b3f9f178b1038a4f77d357fdb 25327: 03b4815f57e4f2e62633e0cd7503d5d5ef7a6e95 v: v3 --- [refs] | 2 +- trunk/arch/x86_64/kernel/entry.S | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 7fbbd36a8774..3c510fcdf871 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 553f265fe883a23502ee351845f09334790f18b8 +refs/heads/master: 7bf36bbc5e0c09271f9efe22162f8cc3f8ebd3d2 diff --git a/trunk/arch/x86_64/kernel/entry.S b/trunk/arch/x86_64/kernel/entry.S index 10ec27b607f1..c946e4fe67a7 100644 --- a/trunk/arch/x86_64/kernel/entry.S +++ b/trunk/arch/x86_64/kernel/entry.S @@ -180,6 +180,10 @@ rff_trace: * * XXX if we had a free scratch register we could save the RSP into the stack frame * and report it properly in ps. Unfortunately we haven't. + * + * When user can change the frames always force IRET. That is because + * it deals with uncanonical addresses better. SYSRET has trouble + * with them due to bugs in both AMD and Intel CPUs. */ ENTRY(system_call) @@ -254,7 +258,10 @@ sysret_signal: xorl %esi,%esi # oldset -> arg2 call ptregscall_common 1: movl $_TIF_NEED_RESCHED,%edi - jmp sysret_check + /* Use IRET because user could have changed frame. This + works because ptregscall_common has called FIXUP_TOP_OF_STACK. */ + cli + jmp int_with_check badsys: movq $-ENOSYS,RAX-ARGOFFSET(%rsp) @@ -280,7 +287,8 @@ tracesys: call syscall_trace_leave RESTORE_TOP_OF_STACK %rbx RESTORE_REST - jmp ret_from_sys_call + /* Use IRET because user could have changed frame */ + jmp int_ret_from_sys_call CFI_ENDPROC /*