Received: by 10.223.185.116 with SMTP id b49csp4172219wrg; Mon, 19 Feb 2018 12:30:46 -0800 (PST) X-Google-Smtp-Source: AH8x227e3ZYl7UfBbzZXcy3jwep0JESd/qhnpHIuNTU43cBO1UL0HipSM3dqsakq1LMu7K+LPb3M X-Received: by 10.99.158.84 with SMTP id r20mr12826472pgo.296.1519072246346; Mon, 19 Feb 2018 12:30:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519072246; cv=none; d=google.com; s=arc-20160816; b=DjKzpsvxVUga9NOSZc8jyKqzwG6E4grbFp+yQlOrNd+cDfOm4jdF6DEk+CIcm+tv02 mc+PR8nYLKZ22g4JLKel4uAwa6hKt5jrfH5+7G0nhao+ahEIyA2ynBXWLfnyfh4zi9rk /FSPtHe8Knfn33caHiuoNLY5lm2vTjI+TsypxPw0oPZobmk20JQm56wwf9f0O5QuGQKE tqN9SRDfxXwUjmMuCBC0E8XoS32rbNrZvVjbe/3nibG9FrTDIYo3IIIMZyyaALGM1++u O8masjLVmn8LyPsOI2bUl6HIHHLE/1KDze1dtSzQ5hyXbjJCy6nl0fXdWva2FRt1eGfU Jkrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=zjrAHvldSzMJ9/uFGIfNKWiA8v1zP3houiUs9kJPU+k=; b=lBraBCrw74OkCK95rUAmxwDKP4T1KtrKbZwJBNHy1DPHuXM2yump16u/XSi0xoK1Hv bfWrnrc9fHnDgJTFjQzSGbBSOkmQ6y8FWuwVMU8OUly3k2M86owMGo6o3EBPSvUCe8Jp diWY3rOTuulBn8xFocD64h0GAAZGDFLykI6muTvLfRHi6Ykqo6DP3eLjGAclG6TQCUOH i7TMwbUZBTI/35NODq23znNudJbjtLx0UWXfS9jpDRHEUvDB4EdTv9NSDBmjDfqjI/NH aYBcFpW4LeQNISULlSBpfQVX1mEnrJ/sUwBVzc2dav9FUy+i9jvuVWUFn0ttY792mssH tdQA== 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 c17si2804198pfi.259.2018.02.19.12.30.32; Mon, 19 Feb 2018 12:30:46 -0800 (PST) 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 S932170AbeBSU3q (ORCPT + 99 others); Mon, 19 Feb 2018 15:29:46 -0500 Received: from mail.skyhub.de ([5.9.137.197]:37772 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932133AbeBSU2x (ORCPT ); Mon, 19 Feb 2018 15:28:53 -0500 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id S_quruHglgGu; Mon, 19 Feb 2018 21:28:52 +0100 (CET) Received: from pd.tnic (p200300EC2BC81D00F5823ED58EA92312.dip0.t-ipconnect.de [IPv6:2003:ec:2bc8:1d00:f582:3ed5:8ea9:2312]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 14B6E1EC08BF; Mon, 19 Feb 2018 21:28:52 +0100 (CET) From: Borislav Petkov To: X86 ML Cc: Peter Zijlstra , Josh Poimboeuf , Andy Lutomirski , LKML Subject: [PATCH 4/5] x86/dumpstack: Add loglevel argument to show_opcodes() Date: Mon, 19 Feb 2018 21:28:25 +0100 Message-Id: <20180219202826.19797-5-bp@alien8.de> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20180219202826.19797-1-bp@alien8.de> References: <20180219202826.19797-1-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Will be used in the next patch. Signed-off-by: Borislav Petkov --- arch/x86/include/asm/stacktrace.h | 1 + arch/x86/kernel/dumpstack.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h index 133d9425fced..0630eeb18bbc 100644 --- a/arch/x86/include/asm/stacktrace.h +++ b/arch/x86/include/asm/stacktrace.h @@ -111,4 +111,5 @@ static inline unsigned long caller_frame_pointer(void) return (unsigned long)frame; } +void show_opcodes(u8 *rip, const char *loglvl); #endif /* _ASM_X86_STACKTRACE_H */ diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index aef0d98cc282..17e9f358c42a 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c @@ -388,13 +388,13 @@ static int __init code_bytes_setup(char *s) } __setup("code_bytes=", code_bytes_setup); -static void show_opcodes(u8 *rip) +void show_opcodes(u8 *rip, const char *loglvl) { unsigned int code_prologue = code_bytes * 43 / OPCODE_BUFSIZE; u8 *ip; int i; - printk(KERN_DEFAULT "Code: "); + printk("%sCode: ", loglvl); ip = (u8 *)rip - code_prologue; if (probe_kernel_read(opcodes, ip, code_bytes)) { @@ -432,6 +432,6 @@ void show_regs(struct pt_regs *regs) if (regs->ip < PAGE_OFFSET) pr_cont(" Bad RIP value.\n"); else - show_opcodes((u8 *)regs->ip); + show_opcodes((u8 *)regs->ip, KERN_DEFAULT); } } -- 2.13.0