From patchwork Sun Oct 1 00:06:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 9979603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5173E60327 for ; Sun, 1 Oct 2017 00:09:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 448AB27E63 for ; Sun, 1 Oct 2017 00:09:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3955927FA5; Sun, 1 Oct 2017 00:09:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 4D4DB27E63 for ; Sun, 1 Oct 2017 00:09:23 +0000 (UTC) Received: (qmail 5152 invoked by uid 550); 1 Oct 2017 00:09:13 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 32603 invoked from network); 1 Oct 2017 00:07:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=3UZMJN yG//p6u5mNAqirwN5N0yhyPYML04SYVRQmcHU=; b=TZh81paZfK6JRQ5PCjiaFK VHtvRWJck3Smh3XYPghrdJ66xVI7cPpTHDWQV9xva2IrIPh+opi+p6DTKCpAR/rG Lzf4rW2iswMhMwLceCkOCTLWjhYRcrJK+22g9Vukm32ZAR6Nyrr/5Z7rylZTX6nn A1xmi8lRs8yDr6rEtBuQtQHfkoD0fJi/Sm0hJ3hyWGYgATajo+90y5Ry61RV68+k Ja5VwSeYUc6Q678j2Xig/cJokEPrbZXr1TvARlxnmu6BnWaVjuCTXBFyhatx2jn4 hzz4Ht2pyUkw8jKvS+dg3/Gb3kEr7l0/Bafqk+m+Ic7ymLEYXYP7UO/NYLFa+SHw == DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=3UZMJNyG//p6u5mNAqirwN5N0yhyPYML04SYVRQmc HU=; b=LZRNgf6gL8o3JkR5oAYjINZJHPQLLQPreogigo9jtprx5OsEpWfLFWJiZ EPc3CYMnuvr3lxi5yg2S91wquHzj+9PyN5mCLFC4p374bp8gdklY3fAy6gBDcnjp vMMPOgsC7Mv9jHe+P9BE/afzsIrrF77N7VoMgm9/w03ok+Gd5+aZIpr6oZT2YvX+ moDqwYhHvcAJye6k9E01UxxNgNM9CZ+ILpb75J7hoDy98TI7Sf4lAWh6sipuZY8Z fDiGpnErAfTxkzNgrPLLBvj6gCOK3nMW1FFCBMD0DcisHn3sz+EJuL8w9GNOwuIC 4tzurSLQKYs5iSRub2pOZdypFGKCg== X-ME-Sender: X-Sasl-enc: kbhRtTCQ60VjuPxOcxkzASVVjEWDHwsMTXgZrlRccYqS 1506816434 From: "Tobin C. Harding" To: Greg KH , Petr Mladek , Joe Perches , Ian Campbell , Sergey Senozhatsky Cc: "Tobin C. Harding" , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , Steven Rostedt , William Roberts , Chris Fries , Dave Weinstein Date: Sun, 1 Oct 2017 11:06:46 +1100 Message-Id: <1506816410-10230-3-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506816410-10230-1-git-send-email-me@tobin.cc> References: <1506816410-10230-1-git-send-email-me@tobin.cc> Subject: [kernel-hardening] [RFC V2 2/6] lib: vsprintf: whitelist stack traces X-Virus-Scanned: ClamAV using ClamSMTP Use the %pP functionality to explicitly allow kernel pointers to be logged for stack traces. Signed-off-by: Tobin C. Harding --- arch/arm64/kernel/traps.c | 4 ++-- kernel/printk/printk.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index 5ea4b85..fe09660 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -147,7 +147,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) struct stackframe frame; int skip; - pr_debug("%s(regs = %p tsk = %p)\n", __func__, regs, tsk); + pr_debug("%s(regs = %pP tsk = %pP)\n", __func__, regs, tsk); if (!tsk) tsk = current; @@ -233,7 +233,7 @@ static int __die(const char *str, int err, struct pt_regs *regs) print_modules(); __show_regs(regs); - pr_emerg("Process %.*s (pid: %d, stack limit = 0x%p)\n", + pr_emerg("Process %.*s (pid: %d, stack limit = 0x%pP)\n", TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), end_of_stack(tsk)); diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 512f7c2..af0bc8e 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -3142,7 +3142,7 @@ void show_regs_print_info(const char *log_lvl) { dump_stack_print_info(log_lvl); - printk("%stask: %p task.stack: %p\n", + printk("%stask: %pP task.stack: %pP\n", log_lvl, current, task_stack_page(current)); }