|
KHB: Failure-oblivious computingKHB: Failure-oblivious computingPosted Jun 29, 2006 18:09 UTC (Thu) by cventers (subscriber, #31465)In reply to: KHB: Failure-oblivious computing by cventers Parent article: KHB: Failure-oblivious computing
I apologize to the readers and editors about the volume of my comments replying to myself, but I think we need a longjmp() that is safe to use as an exit from a signal handler. Then my above code could be: int handle (int sig)
{
struct jmp_buf buf;
if (sig == SIGSEGV) {
if (fork() == 0) raise(SIGABRT);
pop_jmp_buf_from_tls_stack(&buf);
longjmp_after_sig(&buf, sig);
}
}
...then strategically place: // Prepare an exception context
if (save_context_in_tls_stack() == SIGSEGV) {
// operation failed
}
do_something_possibly_unsafe();
// Forget about that context
pop_jmp_buf_from_tls_stack(NULL);
Comments?
(Log in to post comments)
KHB: Failure-oblivious computing Posted Jun 29, 2006 21:34 UTC (Thu) by nix (subscriber, #2304) [Link] Throwing from certain signal handlers is safe in the presence of -fasynchronous-unwind-tables, but I sort of doubt that SIGSEGV is necessarily one of them (what if, e.g., the unwinder segfaults, something which is not unknown?)
Joe Buck would know for sure, I'd guess. :)
|
Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.