lkml.org 
[lkml]   [2021]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 07/11] x86/fault: Split the OOPS code out from no_context()
Date


> On Feb 3, 2021, at 10:56 AM, Borislav Petkov <bp@alien8.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@linux.intel.com>
>> Cc: Peter Zijlstra <peterz@infradead.org>
>> Signed-off-by: Andy Lutomirski <luto@kernel.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

\
 
 \ /
  Last update: 2021-02-03 20:31    [W:0.100 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site