]> err.no Git - linux-2.6/commitdiff
x86 vDSO: ia32 sysenter_return
authorRoland McGrath <roland@redhat.com>
Wed, 30 Jan 2008 12:30:43 +0000 (13:30 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:30:43 +0000 (13:30 +0100)
This changes the 64-bit kernel's support for the 32-bit sysenter
instruction to use stored fields rather than constants for the
user-mode return address, as the 32-bit kernel does.  This adds a
sysenter_return field to struct thread_info, as 32-bit has.  There
is no observable effect from this yet.  It makes the assembly code
independent of the 32-bit vDSO mapping address, paving the way for
making the vDSO address vary as it does on the 32-bit kernel.

[ akpm@linux-foundation.org: build fix on !CONFIG_IA32_EMULATION ]

Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/ia32/ia32entry.S
arch/x86/ia32/syscall32.c
arch/x86/kernel/asm-offsets_64.c
include/asm-x86/thread_info_64.h

index df588f0f76e1c9c3d8027a3baced0089de612832..2499a324feaab9c576692ae6f0933d1d9d14c33b 100644 (file)
@@ -12,7 +12,6 @@
 #include <asm/ia32_unistd.h>   
 #include <asm/thread_info.h>   
 #include <asm/segment.h>
-#include <asm/vsyscall32.h>
 #include <asm/irqflags.h>
 #include <linux/linkage.h>
 
@@ -104,7 +103,7 @@ ENTRY(ia32_sysenter_target)
        pushfq
        CFI_ADJUST_CFA_OFFSET 8
        /*CFI_REL_OFFSET rflags,0*/
-       movl    $VSYSCALL32_SYSEXIT, %r10d
+       movl    8*3-THREAD_SIZE+threadinfo_sysenter_return(%rsp), %r10d
        CFI_REGISTER rip,r10
        pushq   $__USER32_CS
        CFI_ADJUST_CFA_OFFSET 8
@@ -142,6 +141,8 @@ sysenter_do_call:
        andl    $~TS_COMPAT,threadinfo_status(%r10)
        /* clear IF, that popfq doesn't enable interrupts early */
        andl  $~0x200,EFLAGS-R11(%rsp) 
+       movl    RIP-R11(%rsp),%edx              /* User %eip */
+       CFI_REGISTER rip,rdx
        RESTORE_ARGS 1,24,1,1,1,1
        popfq
        CFI_ADJUST_CFA_OFFSET -8
@@ -149,8 +150,6 @@ sysenter_do_call:
        popq    %rcx                            /* User %esp */
        CFI_ADJUST_CFA_OFFSET -8
        CFI_REGISTER rsp,rcx
-       movl    $VSYSCALL32_SYSEXIT,%edx        /* User %eip */
-       CFI_REGISTER rip,rdx
        TRACE_IRQS_ON
        swapgs
        sti             /* sti only takes effect after the next instruction */
index d751d96c2ef2b9d06740e6506dad7f30d9ae08f1..98ff99f5b59a96b281ba97399dde5e548b6dc3ad 100644 (file)
@@ -46,6 +46,10 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
                                      VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
                                      VM_ALWAYSDUMP,
                                      syscall32_pages);
+       if (ret == 0) {
+               current->mm->context.vdso = (void __user *)VSYSCALL32_BASE;
+               current_thread_info()->sysenter_return = VSYSCALL32_SYSEXIT;
+       }
        up_write(&mm->mmap_sem);
        return ret;
 }
index 40f41752c1dfa10c1a2e3adae451a84a2d6f1e30..c27c646214f4183cabffa3ee4ba7bab8e2689bf7 100644 (file)
@@ -46,6 +46,9 @@ int main(void)
        ENTRY(addr_limit);
        ENTRY(preempt_count);
        ENTRY(status);
+#ifdef CONFIG_IA32_EMULATION
+       ENTRY(sysenter_return);
+#endif
        BLANK();
 #undef ENTRY
 #define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
index 1ac23c157231e4561edfe010b5cd2e0390776b8b..c8e7736fc79220d11aa3818f61fd329039f4e5a6 100644 (file)
@@ -33,6 +33,9 @@ struct thread_info {
 
        mm_segment_t            addr_limit;     
        struct restart_block    restart_block;
+#ifdef CONFIG_IA32_EMULATION
+       void __user             *sysenter_return;
+#endif
 };
 #endif