* [PATCH FIXED] x86: only enable interrupts when kernel state has been set up
@ 2008-03-24 23:43 Jeremy Fitzhardinge
2008-03-25 10:56 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Fitzhardinge @ 2008-03-24 23:43 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Linux Kernel Mailing List
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.
[ Fix since last posting: make sure saved eflags has interrupts enabled. ]
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
arch/x86/kernel/entry_32.S | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
===================================================================
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -290,10 +290,10 @@ ENTRY(ia32_sysenter_target)
movl TSS_sysenter_sp0(%esp),%esp
ENTRY(sysenter_past_esp)
/*
- * No need to follow this irqs on/off section: the syscall
- * disabled irqs and here we enable it straight after entry:
+ * Interrupts are disabled here, but we can't trace it until
+ * 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)
CFI_ADJUST_CFA_OFFSET 4
/*CFI_REL_OFFSET ss, 0*/
@@ -301,6 +301,7 @@ ENTRY(sysenter_past_esp)
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET esp, 0
pushfl
+ orl $X86_EFLAGS_IF, (%esp)
CFI_ADJUST_CFA_OFFSET 4
pushl $(__USER_CS)
CFI_ADJUST_CFA_OFFSET 4
@@ -314,6 +315,11 @@ ENTRY(sysenter_past_esp)
CFI_ADJUST_CFA_OFFSET 4
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.
* Careful about security.
@@ -321,14 +327,12 @@ ENTRY(sysenter_past_esp)
cmpl $__PAGE_OFFSET-3,%ebp
jae syscall_fault
1: movl (%ebp),%ebp
+ movl %ebp,PT_EBP(%esp)
.section __ex_table,"a"
.align 4
.long 1b,syscall_fault
.previous
- pushl %eax
- CFI_ADJUST_CFA_OFFSET 4
- SAVE_ALL
GET_THREAD_INFO(%ebp)
/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
@@ -542,9 +546,6 @@ END(syscall_exit_work)
RING0_INT_FRAME # can't unwind into user space anyway
syscall_fault:
- pushl %eax # save orig_eax
- CFI_ADJUST_CFA_OFFSET 4
- SAVE_ALL
GET_THREAD_INFO(%ebp)
movl $-EFAULT,PT_EAX(%esp)
jmp resume_userspace
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH FIXED] x86: only enable interrupts when kernel state has been set up
2008-03-24 23:43 [PATCH FIXED] x86: only enable interrupts when kernel state has been set up Jeremy Fitzhardinge
@ 2008-03-25 10:56 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-03-25 10:56 UTC (permalink / raw)
To: Jeremy Fitzhardinge; +Cc: Linux Kernel Mailing List
* Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> 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.
>
> [ Fix since last posting: make sure saved eflags has interrupts
> enabled. ]
thanks Jeremy - will give it a shot.
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-25 10:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-24 23:43 [PATCH FIXED] x86: only enable interrupts when kernel state has been set up Jeremy Fitzhardinge
2008-03-25 10:56 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox