From patchwork Sat May 6 04:07:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 9714527 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 420E760234 for ; Sat, 6 May 2017 04:07:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35C5D1FF1E for ; Sat, 6 May 2017 04:07:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28FC220700; Sat, 6 May 2017 04:07:35 +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.2 required=2.0 tests=BAYES_00, 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 0A7421FF1E for ; Sat, 6 May 2017 04:07:33 +0000 (UTC) Received: (qmail 24052 invoked by uid 550); 6 May 2017 04:07:31 -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 Received: (qmail 24018 invoked from network); 6 May 2017 04:07:28 -0000 Date: Fri, 5 May 2017 21:07:09 -0700 From: Greg KH To: kernel-hardening@lists.openwall.com, Petr Mladek , Sergey Senozhatsky Cc: linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , Steven Rostedt , William Roberts , Chris Fries , Dave Weinstein Message-ID: <20170506040709.GC32707@kroah.com> References: <20170506040641.GA32707@kroah.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20170506040641.GA32707@kroah.com> User-Agent: Mutt/1.8.2 (2017-04-18) Subject: [kernel-hardening] [RFC 2/6] lib: vsprintf: whitelist stack traces X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Weinstein Use the %pP functionality to explicitly allow kernel pointers to be logged for stack traces Cc: William Roberts Cc: Chris Fries Signed-off-by: Dave Weinstein Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/traps.c | 4 ++-- include/linux/kallsyms.h | 2 +- kernel/printk/printk.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index e52be6aa44ee..b127be39011a 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -146,7 +146,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) unsigned long irq_stack_ptr; 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; @@ -252,7 +252,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/include/linux/kallsyms.h b/include/linux/kallsyms.h index 6883e197acb9..e4a205debe09 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -122,7 +122,7 @@ static inline void print_symbol(const char *fmt, unsigned long addr) static inline void print_ip_sym(unsigned long ip) { - printk("[<%p>] %pS\n", (void *) ip, (void *) ip); + printk("[<%pP>] %pS\n", (void *) ip, (void *) ip); } #endif /*_LINUX_KALLSYMS_H*/ diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 2984fb0f0257..d32e84e3ab6b 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -3110,7 +3110,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)); }