Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#729 closed defect (fixed)

Debug exception during SYSENTER panics the kernel

Reported by: Jakub Jermář Owned by:
Priority: major Milestone: 0.7.2
Component: helenos/kernel/ia32 Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also:

Description

As of b277bef17cacdcab109f936194b7f7b6e0d05213, the following instructions executed by userspace panic the kernel:

diff --git a/uspace/lib/c/arch/ia32/src/syscall.S b/uspace/lib/c/arch/ia32/src/syscall.S
index ddf90535d..855fccb16 100644
--- a/uspace/lib/c/arch/ia32/src/syscall.S
+++ b/uspace/lib/c/arch/ia32/src/syscall.S
@@ -77,11 +77,9 @@ FUNCTION_BEGIN(__syscall_fast)
        pushl %ebp
        mov %esp, %ebp
        lea ra, %edi
-       movl 20(%esp), %edx     # First argument.
-       movl 24(%esp), %ecx     # Second argument.
-       movl 28(%esp), %ebx     # Third argument.
-       movl 32(%esp), %esi     # Fourth argument.
-       movl 44(%esp), %eax     # Syscall number.
+       pushf
+       orl $0x100, (%esp)      # Set TF
+       popf
        sysenter
 ra:
        movw %cs, %cx

The panic looks like this:

Program loader at 0xc03c0000
RAM disk at 0x0027a000 (size 12582912 bytes)
Kernel console ready (press any key to activate)

######> Kernel panic on cpu0 due to bad trap 1. <######
Unserviced interrupt: 1.

THE=0x8126e000: pe=0 thread=0x81268214 task=0x81254234 cpu=0x81128c00 as=0x8100104c magic=0xfacefeed
thread="uinit"
task="init:ns"
cs =0x00000008	eip=0x8010a1df	efl=0x00200112	err=0x8126ffd0
ds =0x00000023	es =0x00000023	fs =0x00000023	gs =0x00000030
eax=0x00000000	ebx=0x00411000	ecx=0x00411000	edx=0x00003000
esi=0x00002027	edi=0x0040b641	ebp=0x7ffffd4c	esp=0x8126ffb4

0x8126fe70: generic/src/debug/stacktrace.o:stack_trace()+0x00000013
0x8126fec0: generic/src/debug/panic.o:panic_common()+0x000001a1
0x8126fef0: arch/ia32/src/interrupt.o:nm_fault()
0x8126ff60: generic/src/interrupt/interrupt.o:exc_dispatch()+0x000000c5
0x8126ff8c: arch/ia32/src/asm.o:int_1()+0x00000069
0x7ffffd4c: arch/ia32/src/asm.o:sysenter_handler()
0x7ffffd88: 0x00414000()
0x7ffffdc8: 0x00406dd7()
0x7ffffdd8: 0x0040764b()
0x7ffffe28: 0x0040244f()
0x7ffffe48: 0x004026e8()
0x7fffff48: 0x00404b03()
0x7fffff88: 0x0040273a()
0x7fffffa8: 0x00402523()
0x7fffffc8: 0x004002a0()
0x7fffffec: 0x00400df4()
0x7ffffff8: 0x004000e2()
cpu0: halted

Change History (2)

comment:1 by Jakub Jermář, 6 years ago

Resolution: fixed
Status: newclosed

comment:2 by Jakub Jermář, 6 years ago

Milestone: 0.7.2
Note: See TracTickets for help on using tickets.