Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp656466imm; Wed, 20 Jun 2018 04:38:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLbqUpj968nHk3jvU7pR4xlneX1u3L9cumoTdwON/pDVxHXsYz8LD0ozTEUIYM6YPbGDpGj X-Received: by 2002:a62:aa18:: with SMTP id e24-v6mr22308147pff.72.1529494712549; Wed, 20 Jun 2018 04:38:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529494712; cv=none; d=google.com; s=arc-20160816; b=vCVO4WrWeAgmIJvhxOGmUjszQFVPcEAi/cdVaJ3YrxK5EUe53wZCu6O29kkIp6SYRr ytpFxZOCu15ZWv3eYJpN1YsrBB7GDnV+tZ0ELn4ZQOm8Vig7BOYEyBKX1MKP7YNQSRVI Rq/Cm4NbRIKTciPFAXqcBpKza8y+z7PvTZOEJ3KSBjKWgidQ/ZMXS2WGoh1iOj2VUpQl xaFq/NiLiqPOdsKSfXH0fwoJRaiEBtdje1N/PNF6to5Z/vVZLXTaB0v0XR75ngjNy3dF AQiXU7487FYu9/4xZmtXApXkirUmASXdLeMcRmi/VEXyZDVLJVD3jrglZI6LSCxfE9pg SV/w== 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:arc-authentication-results; bh=PITZZfLSVhejgTMtXfOartctWzaK430H0HQ6TVJCE1A=; b=CEeY+KBHlPSPywk6fZMhIbJ8PG0c9sZSFZJoGhAUos2axwtkYlboJ7g5j3rgt83WLv 5siJ2CNQNyG08WdUlOU2oMkG8r/0ULb++q1vsfecWUkPz2csMtIMiyPtUZMIKVkWilRU K+/zVSGV8wMrFreSeQHpkiKGFCSSQmYBP8UA5FdoUaxN/TXvFBfypGatVUgXnS/+ykLR +Tervy8Mehlc3FPtvPgjyDI9SGAoISxe/5LNYKsMy6sk32XbOgHwd6vG0juCEJgA05zd 4X5TBeqrE9Dj7pkLLx0U6bADRKbiTCB/ocQZq1LYkqNDgtcSp2ee+nVHpxvBTYq1VMY9 IpUA== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si2187171plk.191.2018.06.20.04.38.18; Wed, 20 Jun 2018 04:38:32 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754027AbeFTLhk (ORCPT + 99 others); Wed, 20 Jun 2018 07:37:40 -0400 Received: from mga14.intel.com ([192.55.52.115]:41107 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751841AbeFTLhh (ORCPT ); Wed, 20 Jun 2018 07:37:37 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2018 04:37:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,247,1526367600"; d="scan'208";a="60772215" Received: from dengy1x-mobl1.ccr.corp.intel.com (HELO wfg-t570.sh.intel.com) ([10.254.213.248]) by orsmga003.jf.intel.com with ESMTP; 20 Jun 2018 04:37:31 -0700 Received: from wfg by wfg-t570.sh.intel.com with local (Exim 4.89) (envelope-from ) id 1fVbQZ-0000jw-4Q; Wed, 20 Jun 2018 19:37:31 +0800 Date: Wed, 20 Jun 2018 19:37:31 +0800 From: Fengguang Wu To: Dmitry Vyukov Cc: Sergey Senozhatsky , Petr Mladek , Tetsuo Handa , Sergey Senozhatsky , syzkaller , Steven Rostedt , LKML , Linus Torvalds , Andrew Morton Subject: Re: [PATCH] printk: inject caller information into the body of message Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) 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 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. >From this point of view I guess pr_cont is actually syzkaller's worst >enemy. If pr_const is officially hated, and it causes corrupted crash >reports, then we can resolve it by just getting rid of more pr_cont's. >So potentially we do not need any support for pr_cont in this patch. >However, we also need to be practical and if there are tons of >pr_cont's then we need some intermediate support of them, just because >we won't be able to get rid of all of them overnight. > >But even if we attach context to pr_cont, it still causes problems for >crash parsing, because today we see: > >BUG: unable to handle >... 10 lines ... >kernel >... 10 lines ... >paging request >... 10 lines ... >at ADDR > >Which is not too friendly for parsing regardless of contexts. We met exactly the same issue and ended up with special handling in https://github.com/intel/lkp-tests/blob/master/lib/dmesg.rb: /(BUG: unable to handle kernel)/, /(BUG: unable to handle kernel) NULL pointer dereference/, /(BUG: unable to handle kernel) paging request/, >So I am leaning towards to getting rid of pr_cont's as the solution to >the problem. +1 for reducing unnecessary pr_cont() uses. Thanks, Fengguang