Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8651008imu; Tue, 4 Dec 2018 11:49:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/WUb1FYDKWWyn3xQw5HGVLxOVxKm9aaMseiimxw2bU6SuErYMBq3pR1+Rn0N4MGINGk/zvO X-Received: by 2002:a62:75d1:: with SMTP id q200mr21328342pfc.254.1543952976468; Tue, 04 Dec 2018 11:49:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543952976; cv=none; d=google.com; s=arc-20160816; b=sST3hRFV9L/D/6fhQAbisCF94S5etXIv53e6jtwA7EezAyo6rQwS/q3irKdBmCSKxZ 9HxiktTALu594uTozriENCDnRkG6VpjzNg+bRLuwMR86B/gohaMT1ChsOf4GM0oQbMJl z41IeSOngEJfwsNot2WNuacLO2fa9WhQrDaFI53wnaco7rIAjAV7+aoFLC4waeWPkNaM BAKcwqpHg5j6FCq8zeGkqvka/jUUdoXLa/TIK9mBJ1JMvXIudppL2Vzz9ds7NUDlOt27 /QVUMS3XVMCAeVD/f09L/oGipJrdYf1iW2fRvnj2vf2scI9Mvet4+f/wsuKLwM7pvWeg FiEQ== 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=dGuRsg4u9JkTs3RNjZUwTtV6ZE+N0HCq1ortkO9Lhj4=; b=ssq/3cZaBdnwumIXxD9IQ8uH/BSi6bVXewT7bN7CVTYddHnA3dUFl5BEbbSZWpWo5U iIxtjGHFDpgPVWGWtMJ6FOs5lQ4udmpDzA4pUFSwEkhj/t2D8hTcHlRDwZ3VRtRnjMgX V6Fw8R9RDYmHgasSI9RqAxbWpps2ly0hz4MVFnJezy+2uPKRN6iCmt6bea+OjvEo9mDg 6ECJm8thu6WFo86MLyaP2gi/D7zJ6s1TbNYcbMXNc7k2JAayXpXWl4AnYGrazo4Gxs+8 pIbc2D0uWmgKY9i1CKleGM+r5kfuXrnetTS19jIH2whKamx79PyWA4wRefkSfHxFa+up mqgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zT1jvbyd; 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 p12si16047125pgj.56.2018.12.04.11.49.21; Tue, 04 Dec 2018 11:49:36 -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=zT1jvbyd; 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 S1726076AbeLDTrZ (ORCPT + 99 others); Tue, 4 Dec 2018 14:47:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:46400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725859AbeLDTrZ (ORCPT ); Tue, 4 Dec 2018 14:47:25 -0500 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 3860420850 for ; Tue, 4 Dec 2018 19:47:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543952844; bh=W6gez/Hs3OA9TbJaJpi8UNN02LY+OmYwMWwWxmASGbA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=zT1jvbydiom//0k63c5OfTYefg5ok5pZJ2FGIYkGsA7UitpD2Yz4wyjxrvW3Brzzh dni8a0p4l31VNSSTTYAuuiM7ax3dCJu8XWWI/UalGjKmDPmuYra/dLGjzcwi8sm3Hu QyuwyCB1QE4cRUG12JtN2FlYOPPETAWLU6AtpJ9g= Received: by mail-wm1-f45.google.com with SMTP id s14so10916155wmh.1 for ; Tue, 04 Dec 2018 11:47:24 -0800 (PST) X-Gm-Message-State: AA+aEWb5hGglOEsEFwyzQa8J4i+8AdGs89YmWc/szvObrtllbUhf+5WR BC/U6Aj+EDnHmi9tcsLTLhcMizgtwZSTD1kxDhuInQ== X-Received: by 2002:a7b:ce17:: with SMTP id m23mr14445497wmc.74.1543952842744; Tue, 04 Dec 2018 11:47:22 -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> In-Reply-To: <20181204193346.GD17374@linux.intel.com> From: Andy Lutomirski Date: Tue, 4 Dec 2018 11:47:10 -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: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.