Gabriel Paubert wrote:
>> I want to write a TSS-based debug exception handler that just does
>> an iret when it gets invoked. For now it looks easier to just keep
>> CR3 up-to-date on every switch.
>
> It seems cr3 is in the same cache line as esp0 for a 32 byte cache line,
> so it's not that big a deal, but I'd still try to avoid this.
There's no easy way of fixing this up in the handler, so that's the plan
for now. It also puts more info in the TSS dump right away.
.> Currently %fs and %gs are lazily cleaned up when switching processes
.> using the standard fixup mechanism, %ds and %es are cleaned up if
.> necessary when popping them off the stack in the return to user
.> mode path (the one which ends up in iret). There is no way to recover
.> from bad user %cs/%ss, the process simply exits in the iret fixup.
Looks like the only clean way is to follow the TSS back link and manually
validate the segment registers before returning:
invalid FS,GS -> 0
" DS,ES -> __USER_DS
CS,SS -> panic?
Bad things can happen if a debug fault happens in certain places... for now
the solution is to only support int3 breakpoints and avoid those places.
Given the above, I hope to be able to put int3 instructions in either
kernel or user code and get snapshots of CPU state in the kernel TSS.
------
Chuck
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:36 EST