Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp712562imm; Wed, 20 Jun 2018 05:33:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKID35tZeFRhps9nVtkNgT7tc+Qn4TymjzsRdJ9KZQxiuwysd91/mTEc/ViuHi8s6C5mZSXP X-Received: by 2002:a17:902:292b:: with SMTP id g40-v6mr23837170plb.273.1529497988053; Wed, 20 Jun 2018 05:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529497988; cv=none; d=google.com; s=arc-20160816; b=dkIUfpPPFhy/3D+D9yOZthQo1UPh9oas8dEq+3gvmiuZVsrYQjZ3BKs3mFQVi8JYCZ lLZf/arrWPrC0e4fppvdZWKM8DuOtCf01g47rN3AcLBrWJseAmGXwbahhdfVCrP4e2Wu abPHkpVdKZ5L3eID1kaDU/TmeMLrzFKp+WFMAlrXP6SCToKJhXf8Y6/DewhKETqpZCVV jyciHoA+SnjY3WWB6MWBaO8HkT0Ss9PcwJptqTxrEYJ9wk/mJ300jtt3khLAlz4O+z+l E2ho1aMwaSIIEu0A7men47FM7bNsofS+pXmgwhKPOLAqSzO7ePdZioYdV96mE52N8q0d vWcQ== 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=6cTA+aJb615kZ+SkgPVrIlZbry8vUTdPztmfxvqDUig=; b=sAMAHW70PTmkXKz5x3TOPtqXJ5Yfdva/2vAqhC2cTCk5+ImsTL2QFmNk9IyzD1RozG qk/DyTbaHj2cwlZF7fIldTQoIPPD8EVwBoHaMHIF7I8FucZYAkefXO3Uy8uzlsGHpvOo CLgUnvRKo7EQAVKxb42oTrzaXjSUOgbE9vBSbNW4YDRAcym56KvLLaAxKYAH07RMfcUp 89MAwy2KQqNZYnYGp7B5svjSsdpRoFaVLKxYy1dceoTjLMzIVcS71a9cNYwCEjz/3gEj uOdUcfgIqQxkqgQJckTcsY+VGlq3TdZkzAV//WZ7Dpxncg8WrxmKN7ySL5Ic2esGelps 4aBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fbn7h6TX; 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 61-v6si2264238plf.63.2018.06.20.05.32.52; Wed, 20 Jun 2018 05:33:08 -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=fbn7h6TX; 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 S1752901AbeFTMcO (ORCPT + 99 others); Wed, 20 Jun 2018 08:32:14 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:43898 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751422AbeFTMcM (ORCPT ); Wed, 20 Jun 2018 08:32:12 -0400 Received: by mail-pl0-f66.google.com with SMTP id c41-v6so1690889plj.10 for ; Wed, 20 Jun 2018 05:32:12 -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=6cTA+aJb615kZ+SkgPVrIlZbry8vUTdPztmfxvqDUig=; b=fbn7h6TXYHC6M1tx2nx5kAqapXoY4S0DSwsXVAjVM+QR0Ot8CLpYoeVfB8DgdNKYpe XsiNOS1U++Hc0dVTlFAWIHTh0ts6rffnoQsaCV2VdIoZPxPVjoXzRMlcB82c6gvaHY6y 2n2Pxy1VOErTI8tMFBYNC16/N8tlsMttga/jdGrnVbEsHuCjcTI5Sy9wTM6MdM12QFCB 9nUSF+4V9jZCZu28Dq/q8uTca09vQv6masZO9ARl6OwhwsudebUDyr9O+kM9lfNqiQOK ozuwbfDfcaYMHsi9yloh8bDcZeHvXqDbtMnl9VgtV+HN0tyJcsvzMKv94yovPPdyaycd YheA== 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=6cTA+aJb615kZ+SkgPVrIlZbry8vUTdPztmfxvqDUig=; b=P5JLAJot74sxO6PuEeBesHFdqMWyfjpOWfsD6wLMbYr/cy+6oaP3z5uX43Swv2WkZ+ WmJEej6ISoZ+Lh1qGj4aHZ0s5w02T+G5WBzPVBLXkkKVBb5tEnps+Id7bcZ/HEh/0wgc 4TGntq5GqYSYjt9ETbr0dvpx527dvk3iarl4OuwQgB68+76Wt22Co7R453CORr+str1O Okp4NZxt6ttk59BtQTlkbhjqDH8n+7f++MUU9Ew9U36HJd6BaCGgS4yGZhU6s7i1zcKR a4hixm9cJl6CmNoeXmjtu6gtDxD01mwtIxGlnhZEn7PM/bZOjbUz0Ly15+xs81UpgvHI 2pkg== X-Gm-Message-State: APt69E3kTpYgd3UIr8aNGFHKbzL5L+uEorAdXZmkbINARm1MGZODjfts MdFPBTgm71SZCbF6TZHcsebXAe9d6s4GpQjjlwz3MA== X-Received: by 2002:a17:902:8d85:: with SMTP id v5-v6mr23556198plo.93.1529497932090; Wed, 20 Jun 2018 05:32:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:de2:0:0:0:0 with HTTP; Wed, 20 Jun 2018 05:31:51 -0700 (PDT) In-Reply-To: <20180620113731.y7apmqoh6ke6ar2v@wfg-t540p.sh.intel.com> References: <201805112058.AAB05258.HJQFFOMFOVtOSL@I-love.SAKURA.ne.jp> <20180517112135.GB20796@jagdpanzerIV> <20180518121506.wilixxkznbtskw34@pathway.suse.cz> <20180524021451.GA23443@jagdpanzerIV> <20180620083126.GA477@jagdpanzerIV> <20180620090413.GA444@jagdpanzerIV> <20180620113731.y7apmqoh6ke6ar2v@wfg-t540p.sh.intel.com> From: Dmitry Vyukov Date: Wed, 20 Jun 2018 14:31:51 +0200 Message-ID: Subject: Re: [PATCH] printk: inject caller information into the body of message To: Fengguang Wu Cc: Sergey Senozhatsky , Petr Mladek , Tetsuo Handa , Sergey Senozhatsky , syzkaller , Steven Rostedt , LKML , Linus Torvalds , Andrew Morton 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 Wed, Jun 20, 2018 at 1:37 PM, Fengguang Wu wrote: > On Wed, Jun 20, 2018 at 11:30:05AM +0200, Dmitry Vyukov wrote: >> >> On Wed, Jun 20, 2018 at 11:06 AM, Sergey Senozhatsky >> wrote: >>> >>> Hi Dmitry, >>> >>> On (06/20/18 10:45), Dmitry Vyukov wrote: >>>> >>>> Hi Sergey, >>>> >>>> What are the visible differences between this patch and Tetsuo's >>>> patch? >>> >>> >>> I guess none, and looking at your requirements below I tend to agree >>> that Tetsuo's approach is probably what you need at the end of the day. >>> >>>> The only thing that will matter for syzkaller parsing in the >>>> end is the resulting text format as it appears on console. But you say >>>> "I'm not pushing for this particular message format", so what exactly >>>> do you want me to provide feedback on? >>>> I guess we need to handle pr_cont properly whatever approach we take. >>> >>> >>> Mostly, was wondering about if: >>> a) you need pr_cont() handling >>> b) you need printk_safe() handling >>> >>> The reasons I left those things behind: >>> >>> a) pr_cont() is officially hated. It was never supposed to be used >>> on SMP systems. So I wasn't sure if we need all that effort and >>> add tricky code to handle pr_cont(). Given that syzkaller is >>> probably the only user of that functionality. >> >> >> Well, if I put my syzkaller hat on, then I don't care what exactly >> happens in the kernel, the only thing I care is well-formed output on >> console that can be parsed unambiguously in all cases. > > > +1 for 0day kernel testing. > > I admit that goal may never be 100% achievable -- at least some serial > console logs can sometimes become messy. So we'll have to write dmesg > parsing code in defensive ways. > > But some unnecessary pr_cont() broken-up messages can obviously be > avoided. For example, > > arch/x86/mm/fault.c: > > printk(KERN_ALERT "BUG: unable to handle kernel "); > if (address < PAGE_SIZE) > printk(KERN_CONT "NULL pointer dereference"); > else > printk(KERN_CONT "paging request"); > > I've actually proposed to remove the above KERN_CONT, unfortunately the > patch was silently ignored. I've just cooked this change too, but do you mind reviving your patch? It actually makes the code even shorter, which is nice: --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -671,13 +671,9 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, printk(smep_warning, 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); + printk(KERN_ALERT "BUG: unable to handle kernel %s at %px\n", + (address < PAGE_SIZE ? "NULL pointer dereference" : + "paging request"), (void *) address); dump_pagetable(address); }