提交 d93c870b 编写于 作者: J Jeremy Fitzhardinge 提交者: Ingo Molnar

x86: only enable interrupts when kernel state has been set up

The sysenter path tries to enable interrupts immediately.  Unfortunately
this doesn't work in a paravirt environment, because not enough kernel
state has been set up at that point (namely, pointing %fs to the kernel
percpu data segment).  To fix this, defer ENABLE_INTERRUPTS until after
the kernel state has been set up.

Unfortunately this means that we're running with interrupts disabled
for a while without calling the IRQ tracing code, but that can't be
called without setting up %fs either.
Signed-off-by: NJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 687c8054
...@@ -291,10 +291,10 @@ ENTRY(ia32_sysenter_target) ...@@ -291,10 +291,10 @@ ENTRY(ia32_sysenter_target)
movl TSS_sysenter_sp0(%esp),%esp movl TSS_sysenter_sp0(%esp),%esp
sysenter_past_esp: sysenter_past_esp:
/* /*
* No need to follow this irqs on/off section: the syscall * Interrupts are disabled here, but we can't trace it until
* disabled irqs and here we enable it straight after entry: * enough kernel state to call TRACE_IRQS_OFF can be called - but
* we immediately enable interrupts at that point anyway.
*/ */
ENABLE_INTERRUPTS(CLBR_NONE)
pushl $(__USER_DS) pushl $(__USER_DS)
CFI_ADJUST_CFA_OFFSET 4 CFI_ADJUST_CFA_OFFSET 4
/*CFI_REL_OFFSET ss, 0*/ /*CFI_REL_OFFSET ss, 0*/
...@@ -302,6 +302,7 @@ sysenter_past_esp: ...@@ -302,6 +302,7 @@ sysenter_past_esp:
CFI_ADJUST_CFA_OFFSET 4 CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET esp, 0 CFI_REL_OFFSET esp, 0
pushfl pushfl
orl $X86_EFLAGS_IF, (%esp)
CFI_ADJUST_CFA_OFFSET 4 CFI_ADJUST_CFA_OFFSET 4
pushl $(__USER_CS) pushl $(__USER_CS)
CFI_ADJUST_CFA_OFFSET 4 CFI_ADJUST_CFA_OFFSET 4
...@@ -315,6 +316,11 @@ sysenter_past_esp: ...@@ -315,6 +316,11 @@ sysenter_past_esp:
CFI_ADJUST_CFA_OFFSET 4 CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET eip, 0 CFI_REL_OFFSET eip, 0
pushl %eax
CFI_ADJUST_CFA_OFFSET 4
SAVE_ALL
ENABLE_INTERRUPTS(CLBR_NONE)
/* /*
* Load the potential sixth argument from user stack. * Load the potential sixth argument from user stack.
* Careful about security. * Careful about security.
...@@ -322,14 +328,12 @@ sysenter_past_esp: ...@@ -322,14 +328,12 @@ sysenter_past_esp:
cmpl $__PAGE_OFFSET-3,%ebp cmpl $__PAGE_OFFSET-3,%ebp
jae syscall_fault jae syscall_fault
1: movl (%ebp),%ebp 1: movl (%ebp),%ebp
movl %ebp,PT_EBP(%esp)
.section __ex_table,"a" .section __ex_table,"a"
.align 4 .align 4
.long 1b,syscall_fault .long 1b,syscall_fault
.previous .previous
pushl %eax
CFI_ADJUST_CFA_OFFSET 4
SAVE_ALL
GET_THREAD_INFO(%ebp) GET_THREAD_INFO(%ebp)
/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */ /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
...@@ -543,9 +547,6 @@ END(syscall_exit_work) ...@@ -543,9 +547,6 @@ END(syscall_exit_work)
RING0_INT_FRAME # can't unwind into user space anyway RING0_INT_FRAME # can't unwind into user space anyway
syscall_fault: syscall_fault:
pushl %eax # save orig_eax
CFI_ADJUST_CFA_OFFSET 4
SAVE_ALL
GET_THREAD_INFO(%ebp) GET_THREAD_INFO(%ebp)
movl $-EFAULT,PT_EAX(%esp) movl $-EFAULT,PT_EAX(%esp)
jmp resume_userspace jmp resume_userspace
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册