Re: [patch] x86: fix ESP corruption CPU bug

Pavel Machek
2005-03-13T20:10:52Z

Hi!

> @@ -257,8 +265,31 @@
> movl TI_flags(%ebp), %ecx
> testw $_TIF_ALLWORK_MASK, %cx # current->work
> jne syscall_exit_work
> +
> restore_all:
> - 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
> + je ldt_ss # returning to user-space with LDT SS

All common linux apps use same %ss, no? Perhaps it would be more
efficient to just check if %ss == 0x7b, and proceed directly to
restore_nocheck if not?

Or perhaps we could only enable this code after application loads
custom ldt?

Pavel

--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!