i386: another possible singlestep fix
PATCH 1/1 i386: another possible singlestep fix
When entering kernel via int80, TIF_SINGLESTEP is not set when TF has been set in eflags by the user. This patch does that.
To make things symmetrical, something further should be done. Either (a) add to this patch so it clears TF after setting TIF_SINGLESTEP, or (b) change the sysenter path so it sets TF in regs.eflags when it finds TIF_SINGLESTEP was set by do_debug() during kernel entry.
arch/i386/kernel/entry.S +4 -0
@@ -226,6 +226,10 @@ ENTRY(system_call) pushl %eax # save orig_eax SAVE_ALL GET_THREAD_INFO(%ebp) + testl $TF_MASK,EFLAGS(%esp) + jz no_singlestep + orl $_TIF_SINGLESTEP,TI_flags(%ebp) +no_singlestep: # system call tracing in operation / emulation /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */ testw $(_TIF_SYSCALL_EMU|_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
Signature · 2 lines
Chuck "Equations are the Devil's sentences." --Stephen Colbert
Quoted 4 lines · Chuck Ebbert
When entering kernel via int80,
TIF_SINGLESTEPis not set when TF has been set in eflags by the user. This patch does that.
This really shouldn't matter.
When we enter the kernel through "int 0x80", we don't need to do anything about TIF_SINGLESTEP, because unlike the "sysenter" path, the "int" instruction will automatically do the right thing (save old eflags on the stack).
So afaik, this won't actually do anything (except make _the_ most timing-critical path in the kernel slower). Have you actually seen any effects of it?
Linus