Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2228559imm; Thu, 7 Jun 2018 07:23:20 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI0jytDddFWxGIp9xWaNUd/O2mvWGRNRrYhURGebHRp3bdGFZ0RM3tfbNqRHbAKi4rSas06 X-Received: by 2002:a65:5b8b:: with SMTP id i11-v6mr1779460pgr.225.1528381400528; Thu, 07 Jun 2018 07:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528381400; cv=none; d=google.com; s=arc-20160816; b=0JLlKGxLNw8R2D9EUK0RhELnpev0CcQmk74fgpmm1uWfzlHNRy/3lmhAAbQUtjgHIY U/1bRbxPuRQEB6vl2zZXijAfmgkCo2r/cutbqnz3b9z3mlzz7LdYr7EQ135qmgTN0Nw7 ryGb/Fr217zUI/rJwGSFlIDUHcEYro/1fHKwb6ZEqcunpTB14EiTNgHn8CvFs2DSOkea 1s3WhXjvnNfCKFE1ocGtE/eSu0HZhWVHbwqIUnK86r6oBIrVke6cE9AFLNm8se9UVwkB 1p109LwYyTETA2xP2858e+H95sIEeazR3ouUJrQ+LWYOWiuLRSz2Cucy5KALsaYa2B98 PxXQ== 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=IPYtzPZf+j873S+N3EgQV+2BhCI4gnGRWOL4qB/s+Ik=; b=eeY52Q4p8yCw2WxKkKw6rYdloMB1e13/AkbjVC/8WKP9dMpubpWNMWlz+eg0Ir2EJr hrWfabD2gbN7k/6Jvwld7wxuuuMKWefSu5uoGKKcWxOAtCMtepeT02Mp9xZVBnpSxkLL DRXnAZcd/X5zIAQFWF7OmG4duurEb8yylMtCOZNuno8RA7phqL509ubVRQaYOsxZIAnB MXuJRDsI2oYA1BWtNwiGtj25Af5Wu6YEwdzLxoj7SuK1N4CYY2XxNLS18n66Fad6WOzT Fh6COm00EyRiW7s4TZbgQuaG4RVgybd99lTl9h7HreIHmAagial9aug8Xcloszpnt974 1bqQ== 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 f13-v6si8049558pgo.265.2018.06.07.07.23.06; Thu, 07 Jun 2018 07:23:20 -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 S933299AbeFGOV4 (ORCPT + 99 others); Thu, 7 Jun 2018 10:21:56 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39435 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933071AbeFGOJK (ORCPT ); Thu, 7 Jun 2018 10:09:10 -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-0005hO-8K; Thu, 07 Jun 2018 15:09:08 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb9-00036J-5Q; Thu, 07 Jun 2018 15:09:07 +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, "NCSC Security" , "Will Deacon" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 270/410] arm64: __show_regs: Only resolve kernel symbols when running at EL1 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 a06f818a70de21b4b3b4186816094208fc7accf9 upstream. __show_regs pretty prints PC and LR by attempting to map them to kernel function names to improve the utility of crash reports. Unfortunately, this mapping is applied even when the pt_regs corresponds to user mode, resulting in a KASLR oracle. Avoid this issue by only looking up the function symbols when the register state indicates that we're actually running at EL1. Reported-by: NCSC Security Signed-off-by: Will Deacon [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- arch/arm64/kernel/process.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -197,8 +197,15 @@ void __show_regs(struct pt_regs *regs) } show_regs_print_info(KERN_DEFAULT); - printk("pc : %pS\n", (void *)regs->pc); - printk("lr : %pS\n", (void *)lr); + + if (!user_mode(regs)) { + printk("pc : %pS\n", (void *)regs->pc); + printk("lr : %pS\n", (void *)lr); + } else { + printk("pc : %016llx\n", regs->pc); + printk("lr : %016llx\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]);