tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: T_TRCTRAP handling

Le 07/02/2018 à 10:37, Dimitris Karagkasidis a écrit :

Currently, the handling of the Trace trap on amd64 and i386 architectures is
problematic under certain conditions. More specifically, on kernels compiled
without DDB and KGDB support, Trace traps within supervisor mode result in
kernel panic.

I encountered this issue while working on a kernel with the aforementioned
configuration on qemu and its built-in gdbserver.

In the following patches I propose a more graceful way of handling T_TRCTRAP.
Instead of panicking the kernel upon encountering a trace trap that wasn't
addressed by DDB or KGDB, ignore it by clearing the TF in EFLAGS/RFLAGS and
resume execution.


Your patch as it is right now is not correct.

If a T_TRCTRAP exception comes in for no reason, that's a _bug_ in the kernel,
and it shouldn't be ignored.

When it comes to Qemu's GDB, I'm not sure what would be the correct solution.
Probably detect the hypervisor (by reading its CPUID leaf if it has one - not
sure Qemu does), and then behave differently. But the default behavior should
still be to panic.


Home | Main Index | Thread Index | Old Index