Messages in this thread | | | From | Linus Torvalds <> | Date | Thu, 1 Nov 2018 12:10:35 -0700 | Subject | Re: RFC: userspace exception fixups |
| |
On Thu, Nov 1, 2018 at 11:52 AM Rich Felker <dalias@libc.org> wrote: > > There's no need to chain if the handler is specific to the context > where the fault happens. You just replace the handler with the one > relevant to the code you're about to run before you run it.
That's much too expensive to do as a system call.
Maybe an rseq-like "register an area where exception information will be found" and then you can just swap in a pointer there (and nest with previous pointers).
But even that doesn't work. Maybe some library wants to capture page faults because they write-protected some area and want to log writes and then emulate them (or just enable them after logging - statistical logging is a thing).
And then another library (or just nested code) wants to handle the eenter fault, so it overwrites the page handler fault. What do you do if you now get a page fault before you even do the eenter?
The whole "one global error handler" model is broken. It's broken even if the "global" one is just per-thread. Don't do it.
Even signals didn't make *that* bad a mistake, and signals are horrible.
Linus
| |