Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp5538625imm; Tue, 26 Jun 2018 13:06:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLVYdRrw+KMtQqFc/EzDwUriI+SoAGbsVUAXPajjNWNa70S1mCXDxlpS1MnktIOf7rYAuVB X-Received: by 2002:a65:6517:: with SMTP id x23-v6mr2623388pgv.268.1530043587922; Tue, 26 Jun 2018 13:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530043587; cv=none; d=google.com; s=arc-20160816; b=LLd5BQ0M5wkyKWa2M73Rua7YJ7TksdMSwU4XiGoa4iO7HUoQXN0PdwZsZ3BJbLVjiH lGDdPooZOHPOFquAdGgqqiaQERqkQeEfeNz0XU+H5T3tXT6hDZQltwyzwbT7e7JcjuvH jPeF06GB8wiHYxcRfvRJKoPABML/I9XD7ZnEnu1bWhK9s53jy+K7mxCGYX7gheMKr08c cmH7y++TAE9RbMLNHjouPgRAiLrwJ8TO24JibT6beYrsJSRUiHOJKie/h8ccDDQfFYTT Z6zWj6WyWwWDJT/qLV8Y0UwJwzKJ00cOX9e0qmWVK5GFLplpjWfPyer1adfBmyySuzkk 1pfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Pv6lexECMMM3oxSXTQ5SSr5EFYRUipJU+boFFIidPxE=; b=XBjXjpOMMv7SeuGUo6L2LSZQKnETsGdPO53OQH2T7GrVVFBK4aQ1nNSvkUcIvQAH/U G9KYqgnJzim9qHoTx2HMPakbVApSw160WJS2LTEzzZT3dpzJbJcMtxsOQ+0SphZlVtvG mti+jI2Rnncn0bgf+lDcPF3n/5DzOvVjIpFPeT5tvKjgIRuhneppUTiga8Y5ATwzwgj5 tXTzmw6CCGtspblPBzDnBG+Y16W+T2YWQpisJYWcLrIKM8JbZh92tyoxJhVZTcM2P8o2 lnmPwCWCsdr03ekCXNWbYb8qkSRbYZv1w4BlTz9/ICarMfYYKyOlBMQXV/7gejgznjRi yNpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jXFolKHR; 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=fail (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 j84-v6si2319002pfj.79.2018.06.26.13.06.13; Tue, 26 Jun 2018 13:06:27 -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=fail header.i=@gmail.com header.s=20161025 header.b=jXFolKHR; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753222AbeFZUFe (ORCPT + 99 others); Tue, 26 Jun 2018 16:05:34 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:34571 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751980AbeFZUFd (ORCPT ); Tue, 26 Jun 2018 16:05:33 -0400 Received: by mail-wm0-f68.google.com with SMTP id l15-v6so16175152wmc.1 for ; Tue, 26 Jun 2018 13:05:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Pv6lexECMMM3oxSXTQ5SSr5EFYRUipJU+boFFIidPxE=; b=jXFolKHR8QQtBk0VbulroIc/Al35se7WD3+hC+nj9d6CZu50MN8OE1TiWyluUnkRNA BB4HVEru7I/7zf5mny4nga4ed1BpWQ1vexFhnzucNw3+4/K6kdJMTb3Ngv347zSlPhRm yLwZcGuqu9UWhpbHvTTNzsYm1JREpRVOUyTbnuk73ppl/LlZcLdSS7RidrqUfstvsKUP NWC5K/13ol0l1F1/Ee6KvzWt3wM4UV2227ZQZWhm5ZAVH4q/JiS69aEDu1cvCiX6VaMc jMbsfcQUv7wMuaZRJuE0zU73nzvy/zq7XVaq8pAWCaNVWaSTroV0fiUMPKLW+5rsSV6J ZMBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Pv6lexECMMM3oxSXTQ5SSr5EFYRUipJU+boFFIidPxE=; b=C7auC7w2oLuC7KZ/qxop/w237PNmeftw3mfyMYGvLfNZs+1I+iI5UOaMYIc2VyymYb fXuRLoYqXL9468hN4+v98YpX7rGbAPh1z9fkxx6CWGr56Jfmc7m8sB0kXbqwfgUk742H f9oFFKXza1paw0o/OymFvFhqlUt2n0VTNt0SFQ4JT7gvZ15mlZ+rDR5Vm8aKzr7ODD4i 0J7t3CKhpDOZskmsl1pMuldUNEGCpUGGxAGYJEtSL1gRy0WI+0hg3JG4ENYXxLI4M0nj nOI1625HC8NmunrHqLE7aH/SnTpSA136vg4B/l75KCbXsPm2YrY6dya8jYxgLOUqQvRI xwsA== X-Gm-Message-State: APt69E1bx4lPUnnHaZjyqYTzXKylLPaYr+LzovoQf4z9x/FrOwxIPB36 zaxBfrLhYHNIWYezZ+NWO+qXgA== X-Received: by 2002:a1c:a8a:: with SMTP id 132-v6mr2813655wmk.44.1530043532222; Tue, 26 Jun 2018 13:05:32 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id x11-v6sm3039478wrm.78.2018.06.26.13.05.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jun 2018 13:05:31 -0700 (PDT) Date: Tue, 26 Jun 2018 22:05:29 +0200 From: Ingo Molnar To: Dmitry Vyukov Cc: tglx@linutronix.de, mingo@redhat.com, x86@kernel.org, linux-kernel@vger.kernel.org, sergey.senozhatsky.work@gmail.com, andy.shevchenko@gmail.com, Dmitry Vyukov Subject: Re: [PATCH v3] arch/x86: get rid of KERN_CONT in show_fault_oops() Message-ID: <20180626200528.GA29307@gmail.com> References: <20180626072843.158906-1-dvyukov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180626072843.158906-1-dvyukov@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * 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? Thanks, Ingo