Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2321191imm; Thu, 7 Jun 2018 08:44:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKiQ0AVo/rKgfAAvnBeDV4ggyP7N2uiY2XLQb92xxjZu32sU7rbaIuMfOL33XMtvMW1NsZt X-Received: by 2002:a65:6250:: with SMTP id q16-v6mr2055078pgv.113.1528386294482; Thu, 07 Jun 2018 08:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528386294; cv=none; d=google.com; s=arc-20160816; b=P2DLwpanRJRDszNvH99KsHsIXKM+y1XOz+ttnsEtnZ1Z4SkwdVVEN2HVqu/UbqoWVu 2ZwW1JKYJRZsRZjlZBsUjP6bcKAZ7wpmo8en7yu8vkOhyJYqse5FMVtoaOjOTIPFfZGY bK7gFy5e+Qw1sn6HhJSx9+2Rs9tJCvkzPh1Lv3KStuxPHdDRaIFnd58m1dLe/ZFNuaJf P7FYlq04ml+AgZ1K7B9ElcUY5heZvwUuiL4Ly9Srh023aLq4ijg7lxmXzHllwo8wpN2f Xf/lZkMz3uwBfVZY98yJCCtZW5RnDepj4janyUKhsVcWutk3BmSZ3TH1uCEWyBXSGvYj xyeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=EkOjYV7TOjQIDASEFiZl7Y/B4uVeBFYvAQ2yhGiUowk=; b=sL7S3wk2svQ53Z9hMgT8sxWhF1qCO10tTPH9WGXF8h1uknCW5kYJMh7YQsstqO0NOn IkW3YEXSk8keJvh1s0+mqhvqIGnAqBeD38nboz29Hi63VX1oCxEmvb6OqCAChPnNb1YX L/3VaWbmAtAKk2SDXJ7eSD+uH0EnZA2t37GE6FqjHgSKSkudjMnPr9mFJHJrk6iaSlJd ULYmG962lqAeEriG8EvlxG8n+xIit1Mi7D73QunlPKN+ksV00SxE8CSznGyUmQcVJLvY XkG8rZPKp+x+jIKAOOW0J2stL/WGsLedVpmY8LAnPRYH2IWPuM/0757U0jcuDZ8drcFN UMaQ== 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 z3-v6si417625pgp.527.2018.06.07.08.44.40; Thu, 07 Jun 2018 08:44:54 -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 S934577AbeFGOl1 (ORCPT + 99 others); Thu, 7 Jun 2018 10:41:27 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40586 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932931AbeFGOlX (ORCPT ); Thu, 7 Jun 2018 10:41:23 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvba-0005Zw-Ja; Thu, 07 Jun 2018 15:09:34 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb8-00035x-VN; Thu, 07 Jun 2018 15:09:06 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Will Deacon" , "Laura Abbott" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 266/410] arm64: traps: Don't print stack or raw PC/LR values in backtraces In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Will Deacon commit a25ffd3a6302a67814280274d8f1aa4ae2ea4b59 upstream. Printing raw pointer values in backtraces has potential security implications and are of questionable value anyway. This patch follows x86's lead and removes the "Exception stack:" dump from kernel backtraces, as well as converting PC/LR values to symbols such as "sysrq_handle_crash+0x20/0x30". Tested-by: Laura Abbott Signed-off-by: Will Deacon [bwh: Backported to 3.16: - Deleted code in dump_mem() and dump_backtrace_entry() is a bit different - Leave dump_backtrace() unchanged, since it doesn't use dump_mem()] Signed-off-by: Ben Hutchings --- --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -198,11 +198,9 @@ void __show_regs(struct pt_regs *regs) } show_regs_print_info(KERN_DEFAULT); - print_symbol("PC is at %s\n", instruction_pointer(regs)); - print_symbol("LR is at %s\n", lr); - printk("pc : [<%016llx>] lr : [<%016llx>] pstate: %08llx\n", - regs->pc, lr, regs->pstate); - printk("sp : %016llx\n", sp); + print_symbol("pc : %s\n", regs->pc); + print_symbol("lr : %s\n", lr); + printk("sp : %016llx pstate : %08llx\n", sp, regs->pstate); for (i = top_reg; i >= 0; i--) { printk("x%-2d: %016llx ", i, regs->regs[i]); if (i % 2 == 0) --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -47,53 +47,9 @@ static const char *handler[]= { int show_unhandled_signals = 1; -/* - * Dump out the contents of some memory nicely... - */ -static void dump_mem(const char *lvl, const char *str, unsigned long bottom, - unsigned long top) -{ - unsigned long first; - mm_segment_t fs; - int i; - - /* - * We need to switch to kernel mode so that we can use __get_user - * to safely read from kernel space. - */ - fs = get_fs(); - set_fs(KERNEL_DS); - - printk("%s%s(0x%016lx to 0x%016lx)\n", lvl, str, bottom, top); - - for (first = bottom & ~31; first < top; first += 32) { - unsigned long p; - char str[sizeof(" 12345678") * 8 + 1]; - - memset(str, ' ', sizeof(str)); - str[sizeof(str) - 1] = '\0'; - - for (p = first, i = 0; i < 8 && p < top; i++, p += 4) { - if (p >= bottom && p < top) { - unsigned int val; - if (__get_user(val, (unsigned int *)p) == 0) - sprintf(str + i * 9, " %08x", val); - else - sprintf(str + i * 9, " ????????"); - } - } - printk("%s%04lx:%s\n", lvl, first & 0xffff, str); - } - - set_fs(fs); -} - static void dump_backtrace_entry(unsigned long where, unsigned long stack) { - print_ip_sym(where); - if (in_exception_text(where)) - dump_mem("", "Exception stack", stack, - stack + sizeof(struct pt_regs)); + printk(" %pS\n", (void *)where); } static void __dump_instr(const char *lvl, struct pt_regs *regs)