[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <78B808CF-16E2-4C41-B680-0AFD1428ED4A@amacapital.net>
Date: Wed, 3 Feb 2021 11:29:39 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Borislav Petkov <bp@...en8.de>
Cc: Andy Lutomirski <luto@...nel.org>, 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 Feb 3, 2021, at 10:56 AM, Borislav Petkov <bp@...en8.de> wrote:
>
> 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().
>
That function is a lie. It tries to keep the system alive but it doesn’t return if it “recovers”. Maybe I should add a comment?
> 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