Re: [PATCH 09/11] x86/fault: Rename no_context() to kernelmode_fixup_or_oops()

From: Andy Lutomirski
Date: Wed Feb 03 2021 - 15:15:35 EST


On Wed, Feb 3, 2021 at 12:07 PM Borislav Petkov <bp@xxxxxxxxx> wrote:
>
> On Wed, Feb 03, 2021 at 11:53:03AM -0800, Andy Lutomirski wrote:
> > I feel like that would be more obfuscated — then the function would
> > return without fixing anything for usermode faults, return after
> > fixing it for kernel mode faults, or oops.
>
> You practically pretty much have it already with the WARN_ON_ONCE. And
> you can make the thing return 1 to denote it was in user_mode() and 0
> otherwise. IINMSO, something like this:

Hmm. I'm not convinced this is really much better. Maybe it is. Let
me think about it. I feel like it's somehow too close to the previous
tangle where too many functions did too many different things.