[PATCH] Don't call FatalError from the signal handler
Edgar Toernig
froese at gmx.de
Thu May 1 05:57:55 PDT 2008
Peter Hutterer wrote:
>
> > > The attached patch sets up a siglongjmp environment and - in case of a
> > > fatal error during a signal - jumps back to the set up state before
> > > bringing down the server.
> >
> > This won't help at all - the lock is still held. A longjmp doesn't
> > magically unlocks all locks and brings all data structures back into
> > a consistent state. It's really only a jump and the rules which
> > functions are save to be called still apply.
>
> Thanks. Do you have any suggestions to avoid this problem?
Fix the bugs causing the segv ;-)
I guess, the whole "bringing down the server" is about restoring the
video state. An "emergency_shutdown()" callback in the video driver
that does only the minimally necessary (stop DMA and restore video
mode) without using any problematic functions (like malloc/free,
anything from stdio, etc) would IMHO be the most promising solution.
Another more messy way: call the regular FatalError in the hope that
it succeeds but before doing so set an alarm timer to i.e. 2 seconds
and _exit() if it fires off. [Maybe the right place to add this time-
out is in FatalError itself...]
Ciao, ET.
More information about the xorg
mailing list