Re: exception handling in kernel code



On Monday 14 August 2006 02:46, Stanislav Sedov wrote:
Hi!

I'm trying to write kernel code where exceptions are unavoidable.
To clarify , I need to recover after GP (general protection) exception
on i386 cpu and return an error in that case.
Unfortunately, looking in trap.c kernel code I can't find any exception
handling mechanism except inserting hooks into trap.c.

So, the question is: how can one recover after exception in kernel
code? AFAIK, linux build special exception table from various __ex_table
sections to allow placing recover code into .fixup section. Does any such
mechanism exists in freebsd?

Thanks!

You can make use of pcb_onfault to recover from a page fault, but that's
about it. Kernel code is expected to not generate exceptions. :)

--
John Baldwin
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: kernel modules and user-level code speed comparison
    ... What happens if your kernel code throws an FPU ... > floating-point unit to always return quiet NaNs instead of signalling ... let alone a floating-point unit. ...
    (comp.os.linux.misc)
  • exception handling in kernel code
    ... I'm trying to write kernel code where exceptions are unavoidable. ... I need to recover after GP exception ... looking in trap.c kernel code I can't find any exception ... If the facts don't fit the theory, ...
    (freebsd-hackers)
  • Re: Remote Windows Kernel Exploitation - Step Into the Ring 0
    ... I think that the CPU specs from AMD can help in this. ... > should throw an exception of some kind)? ... the kernel code pages are R/O by default. ... Manual hacking of the PTE from the kernel module code is the usual way to go. ...
    (NT-Bugtraq)
  • Re: Problem with KITL?
    ... > Enable kernel debugger ... This OK if KdStub stumbling on its own BP. ... Exception in debugger, Addr=0x801AB864 - attempting to recover ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Yet again - closing a thread
    ... effort was involved in adding exception handlers to recover at each level where recovery ... I was able to recover and keep running. ... it is very likely a bug in the program. ... then the Wait will not fail. ...
    (microsoft.public.vc.mfc)