Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6128410imm; Wed, 27 Jun 2018 02:42:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLaJHSKQ8mXjaLf4HmBDGG/bBrvyrSmp+SRvkLO6s9uLantXiBZ3hXTxzBsoJSTbFIzAZo8 X-Received: by 2002:a65:508c:: with SMTP id r12-v6mr4604137pgp.115.1530092551684; Wed, 27 Jun 2018 02:42:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530092551; cv=none; d=google.com; s=arc-20160816; b=w4c6KqGDYSx3cH0tBWg6ikk/JK3Y8TMc/DF7rdCXHsWSPyF0GXjjvicoxfZG/29Bk9 0l5eg+DckKo2RA0ImAzxP18NEvmPfK/4WCAVLcEVMhPfWyBUjHZQ+85dWZIE9cFBq9mG ISU3uSuZ2wqr5ntSfC2mS5wsvAEK/+24zVyvvwAkrg+3+onBJVdWZu8Dt/PnWJB+3ZkZ D0oA9CQjLJi05E5g1dbiRDr6uq/MhD577v/275v+DkfayFtQ5qZktnMz7ftAIls4H2qY jZFh232TxVpbUi+w2tvyjocU76W2NgZLnI5IrrZCreXwGgP9hNp3tCh2l9R8wTXvEbaE 8J4w== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=PDo6ulZ2KaGqoyxGpMhLetaDc4sWe7w4t1XdflV4QbY=; b=XXxKtjTpu+cgLAS0ZmqqGRfz3siIq4mjsrx+fPyl7tzEgElXFagSmdzqJONKEgLcCZ yoExcrSa9yS3GUFT/rD5caen3F0WH5W6Yo645MX53jDymEaMcIrXexGxRURDEwqebtxI 5iIlEOFkGWmc9y9eGxSONuDhPfQ9J99lGMluRPJKX+0Fx6o0u8LroPfW1N488+nqDv3T GxsW+5cCDRJiGpts7tsuAp7RIxkAwtBos2SF1Am2iJNycqm7Bg1elqevIvzcUewzJct/ sUUMZ/ZpD7tTbrej4KAXZfX6yjy3dTOzAurIUWU95d1lSSrMp8KYuls/z1DSnRgkeM53 aPuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=o1PnExvu; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10-v6si3128516pgq.545.2018.06.27.02.42.14; Wed, 27 Jun 2018 02:42:31 -0700 (PDT) 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=@google.com header.s=20161025 header.b=o1PnExvu; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933915AbeF0JIF (ORCPT + 99 others); Wed, 27 Jun 2018 05:08:05 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:43555 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932187AbeF0JID (ORCPT ); Wed, 27 Jun 2018 05:08:03 -0400 Received: by mail-pf0-f194.google.com with SMTP id y8-v6so686845pfm.10 for ; Wed, 27 Jun 2018 02:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=PDo6ulZ2KaGqoyxGpMhLetaDc4sWe7w4t1XdflV4QbY=; b=o1PnExvuJ50uW9Xp5IILhVy9W0Kp0R4GBCY4+AZxf4EaFc9MGF7QENu02bCZEurIZ+ KgH2Zv3ZyLq3Xf9sXCKC2tkuVRFEKJQUY5/P2GXwSgNdLoOMhs0EYNVYUYFzXYk/TuEV e+6T1i5Mi4UufwFVwq0DzNCLQAuDXjnrUhTZJ4U1kN+IQ2rS11VDfTQV4cUpdJ8d8Hd9 rYwkhrF//3AbNtVuRlm79wk2qMo0HJyDj/buZtNFqzo0M1MjhTs6efjylyZeZWDC9muO GSEjual/W6IiusKweFN7AkXg1VJhzZbVnEyaEvKdbv4+Pm0s13nf/n6hw7FK2x8towEX EuFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=PDo6ulZ2KaGqoyxGpMhLetaDc4sWe7w4t1XdflV4QbY=; b=aDBZsgOFdGzLQfRXFHgTQxKJ9CFuavsY+4Ei61rgLQqOzPDxqNhiWs5iIIonC0Rp/8 49kXqRX3nCWPlMkiWFKribSiGIBrUxnOOJwVATGfs/Yg/ek11pMkgP1zO32bxn5fqyIB ManUAosS539J8GGxUwqlTDISyUYXYjqFDfUVjlOsQCqHu9M9P8Z0pAj8g5EPlffcKQ4l YUlNGRSVKJkyrynoBqjPqHgrkzFZLuWMMY7y+bz4CGocsb7qznFTTaCVzeP3c54PGUr4 2ECbR7/+RWiHfJ5RQeMuhSMq178ZHFJgLE/pL05/lHeDlu4PRw26UuA0MqYIzBYAOdSW PJog== X-Gm-Message-State: APt69E22vGucVszMQhjluF5AgXTh3xwowLY0ic2dp5AKgrunmoYBz0Qd CHwO/AiygR6ywpn/yRkw5ZAVZqjQC/hmSMZqGV7dbQ== X-Received: by 2002:a62:9652:: with SMTP id c79-v6mr5102509pfe.114.1530090482232; Wed, 27 Jun 2018 02:08:02 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:de2:0:0:0:0 with HTTP; Wed, 27 Jun 2018 02:07:41 -0700 (PDT) In-Reply-To: <20180626200528.GA29307@gmail.com> References: <20180626072843.158906-1-dvyukov@gmail.com> <20180626200528.GA29307@gmail.com> From: Dmitry Vyukov Date: Wed, 27 Jun 2018 11:07:41 +0200 Message-ID: Subject: Re: [PATCH v3] arch/x86: get rid of KERN_CONT in show_fault_oops() To: Ingo Molnar Cc: Dmitry Vyukov , Thomas Gleixner , Ingo Molnar , "the arch/x86 maintainers" , LKML , Sergey Senozhatsky , Andy Shevchenko 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, Jun 26, 2018 at 10:05 PM, Ingo Molnar wrote: > > * Dmitry Vyukov wrote: > >> From: Dmitry Vyukov >> >> KERN_CONT leads to split lines in kernel output >> and complicates useful changes to printk like >> printing context before each line. >> >> Only acceptable use of continuations is basically >> boot-time testing. >> >> Get rid of it. >> >> Also tidy up code around as asked by reviewers. >> >> Signed-off-by: Dmitry Vyukov >> Reviewed-by: Sergey Senozhatsky >> >> --- >> >> Changes since v1: >> - use pr_alert() instead of printk(KERN_ALERT) >> >> Changes since v2: >> - drop unnecessary parenthesis >> - remove once used nx_warning and smep_warning >> --- >> arch/x86/mm/fault.c | 21 +++++++-------------- >> 1 file changed, 7 insertions(+), 14 deletions(-) >> >> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c >> index 9a84a0d08727..a73575cacfd9 100644 >> --- a/arch/x86/mm/fault.c >> +++ b/arch/x86/mm/fault.c >> @@ -641,11 +641,6 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address) >> return 0; >> } >> >> -static const char nx_warning[] = KERN_CRIT >> -"kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n"; >> -static const char smep_warning[] = KERN_CRIT >> -"unable to execute userspace code (SMEP?) (uid: %d)\n"; >> - >> static void >> show_fault_oops(struct pt_regs *regs, unsigned long error_code, >> unsigned long address) >> @@ -664,20 +659,18 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, >> pte = lookup_address_in_pgd(pgd, address, &level); >> >> if (pte && pte_present(*pte) && !pte_exec(*pte)) >> - printk(nx_warning, from_kuid(&init_user_ns, current_uid())); >> + pr_crit("kernel tried to execute NX-protected page - exploit attempt? (uid: %d)\n", >> + from_kuid(&init_user_ns, current_uid())); >> if (pte && pte_present(*pte) && pte_exec(*pte) && >> (pgd_flags(*pgd) & _PAGE_USER) && >> (__read_cr4() & X86_CR4_SMEP)) >> - printk(smep_warning, from_kuid(&init_user_ns, current_uid())); >> + pr_crit("unable to execute userspace code (SMEP?) (uid: %d)\n", >> + from_kuid(&init_user_ns, current_uid())); >> } >> >> - printk(KERN_ALERT "BUG: unable to handle kernel "); >> - if (address < PAGE_SIZE) >> - printk(KERN_CONT "NULL pointer dereference"); >> - else >> - printk(KERN_CONT "paging request"); >> - >> - printk(KERN_CONT " at %px\n", (void *) address); >> + pr_alert("BUG: unable to handle kernel %s at %px\n", >> + address < PAGE_SIZE ? "NULL pointer dereference" : >> + "paging request", (void *) address); > > I already applied the last hunk in a bit different way - could you send the rest > as a separate clean-up patch please? Just mailed "arch/x86: cleanup show_fault_oops()".