[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wgFo8tuZX5gzCfWGdAwGyn_Ar9JFnnMFNuwr9=vtfDV1g@mail.gmail.com>
Date: Thu, 1 Nov 2018 12:10:35 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: dalias@...c.org
Cc: Jann Horn <jannh@...gle.com>, luto@...nel.org,
dave.hansen@...ux.intel.com, sean.j.christopherson@...el.com,
jethro@...tanix.com, jarkko.sakkinen@...ux.intel.com,
fweimer@...hat.com, linux-api@...r.kernel.org, x86@...nel.org,
linux-arch@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>, nhorman@...hat.com,
npmccallum@...hat.com, serge.ayoun@...el.com,
shay.katz-zamir@...el.com, linux-sgx@...r.kernel.org,
andriy.shevchenko@...ux.intel.com, tglx@...utronix.de,
Ingo Molnar <mingo@...hat.com>, bp@...en8.de,
carlos@...hat.com, adhemerval.zanella@...aro.org
Subject: Re: RFC: userspace exception fixups
On Thu, Nov 1, 2018 at 11:52 AM Rich Felker <dalias@...c.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
Powered by blists - more mailing lists