[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210203185517.GH13819@zn.tnic>
Date: Wed, 3 Feb 2021 19:56:25 +0100
From: Borislav Petkov <bp@...en8.de>
To: Andy Lutomirski <luto@...nel.org>
Cc: x86@...nel.org, LKML <linux-kernel@...r.kernel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Yonghong Song <yhs@...com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH 07/11] x86/fault: Split the OOPS code out from
no_context()
On Sun, Jan 31, 2021 at 09:24:38AM -0800, Andy Lutomirski wrote:
> Not all callers of no_context() want to run exception fixups.
> Separate the OOPS code out from the fixup code in no_context().
>
> Cc: Dave Hansen <dave.hansen@...ux.intel.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Signed-off-by: Andy Lutomirski <luto@...nel.org>
> ---
> arch/x86/mm/fault.c | 116 +++++++++++++++++++++++---------------------
> 1 file changed, 62 insertions(+), 54 deletions(-)
>
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 1939e546beae..6f43d080e1e8 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -618,53 +618,20 @@ static void set_signal_archinfo(unsigned long address,
> }
>
> static noinline void
> -no_context(struct pt_regs *regs, unsigned long error_code,
> - unsigned long address, int signal, int si_code)
> +page_fault_oops(struct pt_regs *regs, unsigned long error_code,
Not sure about this name - it still tries to recover:
efi_recover_from_page_fault().
Judging by where it is called, maybe no_context_tail() or
no_context_oops() or no_context_finish_me_already()...
Yah, I haz no better idea. :-\
...
> @@ -739,6 +692,61 @@ no_context(struct pt_regs *regs, unsigned long error_code,
> oops_end(flags, regs, sig);
> }
>
> +static noinline void
> +no_context(struct pt_regs *regs, unsigned long error_code,
> + unsigned long address, int signal, int si_code)
> +{
> + if (user_mode(regs)) {
> + /*
> + * This is an implicit supervisor-mode access from user
> + * mode. Bypass all the kernel-mode recovery code and just
> + * OOPS.
> + */
> + goto oops;
Just do
return page_fault_oops(...);
here and get rid of the label.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists