Re: crash in entry.S restore_all, 2.6.12-rc2, x86, PAGEALLOC

From: Stas Sergeev
Date: Tue Apr 05 2005 - 14:20:51 EST


Hi Ingo et all.

Ingo Molnar wrote:
the crashes below happen when PAGEALLOC is enabled. It's this instruction:
movb OLDSS(%esp), %ah
I am really sorry about that screwup :(
I can't do too much right now as I am
reading the mail in a batch mode, and
the next time I'll be reading it will
be 24 hours from now.

Attached is a quick fix, which I'll be
testing to death tomorrow at work.
I had DEBUG_PAGEALLOC disabled, so I
haven't noticed that stupid bug while
optimizing my checks...
Let me know how it goes.

--- entry.S.old 2005-04-05 20:08:07.000000000 +0400
+++ entry.S 2005-04-05 22:54:43.000000000 +0400
@@ -244,11 +244,12 @@
jne syscall_exit_work

restore_all:
- movl EFLAGS(%esp), %eax # mix EFLAGS, SS and CS
- movb OLDSS(%esp), %ah
- movb CS(%esp), %al
- andl $(VM_MASK | (4 << 8) | 3), %eax
- cmpl $((4 << 8) | 3), %eax
+ testl $3, CS(%esp)
+ jz restore_nocheck # return to kernel or v86
+ movl EFLAGS(%esp), %eax # mix EFLAGS and SS
+ movb OLDSS(%esp), %al
+ andl $(VM_MASK | 4), %eax
+ cmpl $4, %eax
je ldt_ss # returning to user-space with LDT SS
restore_nocheck:
RESTORE_REGS