From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83928C433DB for ; Wed, 10 Feb 2021 00:10:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4759C64E40 for ; Wed, 10 Feb 2021 00:10:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235076AbhBJAJu (ORCPT ); Tue, 9 Feb 2021 19:09:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:41378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233899AbhBIUl5 (ORCPT ); Tue, 9 Feb 2021 15:41:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F325B64EAC for ; Tue, 9 Feb 2021 20:10:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612901401; bh=xHJDr/1nD89ckeRCIpjTV/NH06t3sFAkrRdc0f9MThY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=qV8BV13PVpX+G8rd1T5rWrQymjsvQtZt0FpMgDnqj4rOsZl2FtRtxumMeoojFPRBn Zmcx6TqO2ElgeHLZAq8Biet2W4BXGWxA/qQnZLXZaT7D13JRVk8xLI285nIP7q50Mm Hfz/ehrUWrFinSipTQkt+JxMzvbzDFzuCTzfmjdgWWYxpcZ7jXGv/B1CWwY7mjcE6w TsVe37lLSFd6A3aPzEiEhc28EjGn7amOONfRAnwt7iGd1OXq1fjnwRShWKGGtvtnM2 nOtytLjIxmrFHlnqdls9u0QHS3ucdo6nq1IufYq9O+DG/7TN7wm0dfq0bQhmP6fQfA 4Nk+Q145XAmMQ== Received: by mail-ed1-f53.google.com with SMTP id y8so25565004ede.6 for ; Tue, 09 Feb 2021 12:10:00 -0800 (PST) X-Gm-Message-State: AOAM531S7eq3QtswUR0FX+LaXXkEcDRYeOKSPQDN8O2AtnJJqMClEOWi f1RyWor1WJa0NJIL8dJZlTfYRwiCDbavwLSht8ZwMQ== X-Google-Smtp-Source: ABdhPJwptoAG+zSZ8w6RQ0cdk5e5yV6WHEHso2hROrAGsvahllfnPmpRo98ewwya/3n4xuv8Aa5J4uIw3tTay4pM8dI= X-Received: by 2002:a05:6402:31a3:: with SMTP id dj3mr24435566edb.172.1612901399469; Tue, 09 Feb 2021 12:09:59 -0800 (PST) MIME-Version: 1.0 References: <20210203185517.GH13819@zn.tnic> In-Reply-To: <20210203185517.GH13819@zn.tnic> From: Andy Lutomirski Date: Tue, 9 Feb 2021 12:09:48 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 07/11] x86/fault: Split the OOPS code out from no_context() To: Borislav Petkov Cc: Andy Lutomirski , X86 ML , LKML , Dave Hansen , Alexei Starovoitov , Daniel Borkmann , Yonghong Song , Masami Hiramatsu , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 3, 2021 at 10:56 AM Borislav Petkov 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 > > Cc: Peter Zijlstra > > Signed-off-by: Andy Lutomirski > > --- > > 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. I'm going to skip this one, because that code is deleted later in the series, and fixing it here just adds more churn.