Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp56881imm; Tue, 17 Jul 2018 13:55:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfHH6ynrqrtyk4TkJ1M36nr3DypFmxrPfzcDshI7zJZdZZAmi9X43n/Dk94QjQV3sS1vCzM X-Received: by 2002:a17:902:88:: with SMTP id a8-v6mr3037398pla.156.1531860940115; Tue, 17 Jul 2018 13:55:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531860940; cv=none; d=google.com; s=arc-20160816; b=DTkbRAL4nzuOw4iY8AnKET8vVMIkRJC3286fKNVeyQEstAnxTQB2tnL9pYKkk6z5cc ZsqVFrJGr7jDCXKGzzIpi0T7b60C8Dcqz+CeYA5f6xLNNgKwHzjruLRyQz9oPTFFmHp9 txjeQOllo3hn1cpQ0z3nfiWv9Z/fF9x8r+aVW1Ce1Zdha+LEa+dDnEc7sGj45eiHfypO 0q6c+dpax/5cty1mCIGb8vJyiYsBW0CZRf0Hym4NNa+XwHgyPWzNo19T3v1KvWZrkwgk ldZkZCmepjuqdqFMa7O47UzrxiRRLB4v18xyreuZ6ALh5jZDJXHjzEdw6M3x5X6nGc7W cl/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=CDnOk0MqygBPvuHuyr3S2FvEQpiK4EB6TDN1qFCejHk=; b=o+vK4mFEtnlDLyCgj99D2sEgXcKcAwfwgGUX9FMR7ComAh1U6B0dy9oXJ1DDciUwMC n6b1gjk+IE8y/1Tee2626lGob1MKwGPzBA1mu/fH5+mVqfcEJEWjc05wZZ/w1yd5A199 zsT7vWHQ3s19ri7ZLIOl3kjtj9PRIcykO8NkZz+Yhvuh6/EQ93k8ukob+/316fQFcQvD ZqfiHmHesSPQbYZYyIWwzTpfcP+lUjeRcZuy+njzYJN1HKFkBDK1dkRFZJVqAkFqHMFK PpuYYTPIDmwClTT9RMxWbncehWakzoZVWffLzphA4VGxCEx4gHai6IfiY0tqRodtnPXv VonQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h66-v6si1833310pfa.238.2018.07.17.13.55.25; Tue, 17 Jul 2018 13:55:40 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730301AbeGQV3A (ORCPT + 99 others); Tue, 17 Jul 2018 17:29:00 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:48314 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729907AbeGQV27 (ORCPT ); Tue, 17 Jul 2018 17:28:59 -0400 Received: from fsav305.sakura.ne.jp (fsav305.sakura.ne.jp [153.120.85.136]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w6HKsVhF030632; Wed, 18 Jul 2018 05:54:31 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav305.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp); Wed, 18 Jul 2018 05:54:31 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav305.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w6HKsPYv030612 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 18 Jul 2018 05:54:31 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] x86: Avoid pr_cont() in show_opcodes() To: Rasmus Villemoes , Ingo Molnar Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, Andy Lutomirski , Borislav Petkov , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Thomas Gleixner References: <1530943625-3288-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> <20180707111209.GA27768@gmail.com> <12409dc4-c10a-d77a-f88d-165aa92b489e@rasmusvillemoes.dk> <218baff7-9473-ac1e-2449-13de98fa6dc9@rasmusvillemoes.dk> From: Tetsuo Handa Message-ID: <2c8fe03e-36f5-5126-283c-cabc358a7d52@i-love.sakura.ne.jp> Date: Wed, 18 Jul 2018 05:54:20 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <218baff7-9473-ac1e-2449-13de98fa6dc9@rasmusvillemoes.dk> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Corrected Signed-off-by: addresses. From 96d9d4d135994a081e54d33d23f5007c53d9b5dd Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Tue, 17 Jul 2018 22:47:11 +0900 Subject: [PATCH v4] x86: Avoid pr_cont() in show_opcodes() Since syzbot is confused by concurrent printk() messages [1], this patch changes show_opcodes() to use %*ph format string. When we start adding prefix to each line of printk() output, we will be able to handle concurrent printk() messages. [1] https://syzkaller.appspot.com/text?tag=CrashReport&x=139d342c400000 Signed-off-by: Tetsuo Handa Signed-off-by: Rasmus Villemoes Cc: Borislav Petkov Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Andy Lutomirski --- arch/x86/kernel/dumpstack.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index 666a284..ffdd484 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c @@ -93,26 +93,15 @@ static void printk_stack_address(unsigned long address, int reliable, */ void show_opcodes(u8 *rip, const char *loglvl) { - unsigned int code_prologue = OPCODE_BUFSIZE * 2 / 3; + const unsigned int prologue = OPCODE_BUFSIZE * 2 / 3; u8 opcodes[OPCODE_BUFSIZE]; - u8 *ip; - int i; - printk("%sCode: ", loglvl); - - ip = (u8 *)rip - code_prologue; - if (probe_kernel_read(opcodes, ip, OPCODE_BUFSIZE)) { - pr_cont("Bad RIP value.\n"); - return; - } - - for (i = 0; i < OPCODE_BUFSIZE; i++, ip++) { - if (ip == rip) - pr_cont("<%02x> ", opcodes[i]); - else - pr_cont("%02x ", opcodes[i]); - } - pr_cont("\n"); + if (probe_kernel_read(opcodes, rip - prologue, OPCODE_BUFSIZE)) + printk("%sCode: Bad RIP value.\n", loglvl); + else + printk("%sCode: %*ph <%02x> %*ph\n", loglvl, prologue, opcodes, + opcodes[prologue], OPCODE_BUFSIZE - prologue - 1, + &opcodes[prologue + 1]); } void show_ip(struct pt_regs *regs, const char *loglvl) -- 1.8.3.1