Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8673195imu; Tue, 4 Dec 2018 12:12:19 -0800 (PST) X-Google-Smtp-Source: AFSGD/UfqVm+X4kcZ3Sc69N0+gkbBTibIP0PaStpkTGIJYbVYZpk12FIZURh9JP861MfMQs6kRvi X-Received: by 2002:a62:c28e:: with SMTP id w14mr21353245pfk.115.1543954339882; Tue, 04 Dec 2018 12:12:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543954339; cv=none; d=google.com; s=arc-20160816; b=bDuE3JlwNUfMEisUoji6awSckAdSlWlkBaBe2/uhiNB+MWgjdDyJRdRuM/hBU+BY7C 3q5dldeecusUwBaerbQu05PcfqwkWNE2TxKzVvROBvrcxXxTzaU5vjRyakmAlMeOz1aG 3jgqVId5SbCGTH3VW1xjwU3D9iyCAeGgOJ7K/NrZ5rB4NQjrDJWbz9vcjJoIsR6OWE1C IiUY6fyUUfXSXbyTBpY9Oob+zxw4eK/N8mu/RqG+YBo7wxFsRj67A+M0BQMbNtTxJzRe T8K5HjMqM5liTUPifnjsZ11UROcT3a3PdtobCc3UTGV0O9/9sJZabJKy7BJ44hKQkxrf Yq2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+aZpaY5r6cZ7CzvLlN96BvDx5KlTVbOsNXIZwoPBXyM=; b=GEhmw85hi4knXudtNA1W/Zn2EzBSfS++20s+rBwZ+2OwW+RRYd6vWLuXdTTJC5Hrb7 rUtHqRpr29US1UymSvwbYJcZor6oOKyHDi6ss974iOfn5699c5pm/HWT4cOnLXG8YZKC Djmu/0kkawbTmIrPrtidqU5TPOVupzm/FdpROAz9iyiiUj1WfKYmMZvLK0utAhJCtSdz HvfViKNJjcyMbKvocbHncSrRFy6cyjYgqsXf8PtGyHYe5x6aGSwOuX93Div2qjxUzjsb K4dcRdH1FWis4119Ic+Ugtl6/zvRJ36KTYVRM0GgqPA5yspnVoT+CYjDkbkS7IoW/69x 2tRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HPrpv9wF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k12si16219165pgg.382.2018.12.04.12.12.04; Tue, 04 Dec 2018 12:12:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HPrpv9wF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726135AbeLDULU (ORCPT + 99 others); Tue, 4 Dec 2018 15:11:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:58224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725797AbeLDULU (ORCPT ); Tue, 4 Dec 2018 15:11:20 -0500 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E23AC20851 for ; Tue, 4 Dec 2018 20:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543954279; bh=TtPfR0QvZaffYPTc84h47nLX5iJvykdqYEEinZcbiNM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HPrpv9wFc+7di/F6+r+5VhL34V9boJa0rHBzwEE+/wFkpe3IeOp4Cfa62DBUlnm3e o69Tq6AnNhC+MM4tkdvT5xj3qWId7u+fIYyrz54ml49dzoWSnqvDf7vvxugO0ZStXo TpStAfOQtIjuMNIkf8cSP2ql5fc8QoBlt2Izkgmw= Received: by mail-wm1-f49.google.com with SMTP id n190so8501721wmd.0 for ; Tue, 04 Dec 2018 12:11:18 -0800 (PST) X-Gm-Message-State: AA+aEWYi2ADLQ6suCvJN7P1568pOX751+qxA2bIbOf3yTWf6vOqinEXP +QPoDyyDi/Yo5F2bqJ9GUK9zQuSkZeudIE+RZehwwQ== X-Received: by 2002:a7b:ce17:: with SMTP id m23mr14507433wmc.74.1543954277442; Tue, 04 Dec 2018 12:11:17 -0800 (PST) MIME-Version: 1.0 References: <11212acb25980cd1b3030875cd9502414fbb214d.1542841400.git.luto@kernel.org> <20181122084119.GA44720@gmail.com> <20181127153202.GA27075@linux.intel.com> <20181204193346.GD17374@linux.intel.com> <20181204195239.GE17374@linux.intel.com> In-Reply-To: <20181204195239.GE17374@linux.intel.com> From: Andy Lutomirski Date: Tue, 4 Dec 2018 12:11:05 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 6/5] x86/fault: Clean up the page fault oops decoder a bit To: "Christopherson, Sean J" Cc: Andrew Lutomirski , Ingo Molnar , X86 ML , LKML , Yu-cheng Yu , Dave Hansen , Peter Zijlstra , Borislav Petkov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 4, 2018 at 11:52 AM Sean Christopherson wrote: > > On Tue, Dec 04, 2018 at 11:47:10AM -0800, Andy Lutomirski wrote: > > On Tue, Dec 4, 2018 at 11:34 AM Sean Christopherson > > wrote: > > > > > > On Tue, Dec 04, 2018 at 11:22:25AM -0800, Andy Lutomirski wrote: > > > > On Tue, Nov 27, 2018 at 7:32 AM Sean Christopherson > > > > wrote: > > > > > diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c > > > > > index 2ff25ad33233..510e263c256b 100644 > > > > > --- a/arch/x86/mm/fault.c > > > > > +++ b/arch/x86/mm/fault.c > > > > > @@ -660,8 +660,10 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, unsigned long ad > > > > > err_str_append(error_code, err_txt, X86_PF_RSVD, "[RSVD]" ); > > > > > err_str_append(error_code, err_txt, X86_PF_INSTR, "[INSTR]"); > > > > > err_str_append(error_code, err_txt, X86_PF_PK, "[PK]" ); > > > > > - > > > > > - pr_alert("#PF error: %s\n", error_code ? err_txt : "[normal kernel read fault]"); > > > > > + err_str_append(~error_code, err_txt, X86_PF_USER, "[KERNEL]"); > > > > > + err_str_append(~error_code, err_txt, X86_PF_WRITE | X86_PF_INSTR, > > > > > + "[READ]"); > > > > > + pr_alert("#PF error code: %s\n", err_txt); > > > > > > > > > > > > > Seems generally nice, but I would suggest making the bit-not-set name > > > > be another parameter to err_str_append(). I'm also slightly uneasy > > > > about making "KERNEL" look like a bit, but I guess it doesn't bother > > > > me too much. > > > > > > What about "SUPERVISOR" instead of "KERNEL"? It'd be consistent with > > > the SDM and hopefully less likely to be misconstrued as something else. > > > > Or even just [!USER], perhaps. > > I thought about that too, but the pedant in me didn't like the inconsistency > of doing "READ" instead of "[!WRITE] [!INSTR]", and IMO "READ" is a lot more > readable (no pun intended). I also like having completely different text, > makes it harder to miss a single "!" and go down the wrong path. Fair enough. I'm sold.