Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1523734imu; Mon, 5 Nov 2018 23:20:22 -0800 (PST) X-Google-Smtp-Source: AJdET5eADU2ZttpmW+5k8733GvtL99sf4Dnsg1+qWwd2GXhGQS6v0y7ycY9iM58jm1WQLTPpZM2k X-Received: by 2002:a63:8549:: with SMTP id u70mr22825319pgd.401.1541488822672; Mon, 05 Nov 2018 23:20:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541488822; cv=none; d=google.com; s=arc-20160816; b=Kt4hYGeCsZ3TVekcKaxu01QaAJtQ57Ubm+UWoqIc/QvqsPFNfeHuArV8NeKc6zRvha dHfcV+AaXmIKqRp/9mTobKTPhfuHCR5DZ9WPHu57+jiF94XrJ4xemMruWAlBQubY+eqJ tlbNIlV9P6MP/+GgX1YUAjYXusQowuIA/je/twDRIIGHdU0bytOtbyGVCEzpr/jt5/VD 7BgSTYn4Q6JpRrIqMyyizf9Xl4ncnjRv6QcJgWN8wjNkC463NvZrAdRynpvp7yvl/Ksv lQLpGJQ2Dg0vaoeEbOw7LDybkXHsRUXT0gaPHXeqBCq1n1hQPK/IGrgI7H/Q4GQVMfHa 4rIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=VhqwiRJVewsvjrVYgT58Eqm7HsVp4xYXZ9L9ccRvD+s=; b=G6wJ2USMZbq9sNbeIMKf90ZagNzE5f0XvjqtSumC/D1IDEnDUakayBIO+oZapz/XrC e3qnFxDzUGPG1ZPotiNxn1nMF19Wqt+A6WR5YemMvPzKedyGJ8Fo48Gn7GdwWzc7M6X2 3ay8ke6aaQTnqoj0BK7swJA20ipPm15+o549TR4RbgTZZLdCE9pwEXxbrlddeHGwCyIm 9lGVs66HXpyktEiHt7JoUvH4YnaITU57oHHoDdEGlCXgUgi8Dg9HVqTYkDXbW2E10Vwb tvoHlTPfFU7bJlODYapEtg1STO1ocZ1TBJ4cYENVNrgnfbxgLNILsrD7U95DYm5I9/io K2bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="oRAhz7/T"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 207-v6si46121635pgb.298.2018.11.05.23.20.06; Mon, 05 Nov 2018 23:20:22 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="oRAhz7/T"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387527AbeKFQne (ORCPT + 99 others); Tue, 6 Nov 2018 11:43:34 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:43128 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387397AbeKFQne (ORCPT ); Tue, 6 Nov 2018 11:43:34 -0500 Received: by mail-pg1-f196.google.com with SMTP id n10-v6so5400125pgv.10 for ; Mon, 05 Nov 2018 23:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=VhqwiRJVewsvjrVYgT58Eqm7HsVp4xYXZ9L9ccRvD+s=; b=oRAhz7/T7M1VHZYu71FDZWupZoEIrBV9xXtJgQF2muXgZ5i6ZDu8p1c5Lt17EWv+5y Jbwhz1cSANOyuF8lapVlaHJ8Er0dmZmcD+t6Yh2tf5lMJD82/Pn5JrkBHWnEpqTtdIXS Om8srcjQ1IN3CP/rULsq4m2WcDywEQQqEMj/9ijqCLOsTAwOaqMQDpA2t9VH5DoslVO6 NDz99J1lMwHOgvqYkcjSJDzZae7a1xDhmVYGkE/Hc/zSxxG8lz6KHTkt5ht+I8Mk0MvV SRezzTV0QBm4AXb/IW+srz3e0lkI7zLZhJ+LPJPEnOGm2/i9mV7YIjiyiKqL1mSABThX Y91A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=VhqwiRJVewsvjrVYgT58Eqm7HsVp4xYXZ9L9ccRvD+s=; b=cjT2exrtqVeLO2o7TRIMWeUXFYnXyzEn6DBtHjn2xw2pswoZxZHWCrj6kcbelTX0oC 6HghQNRnZ+MJYiLpglHbsDp2uYGBgukzeYLmjDdQhRYJPQg7O3SskLSqwODi1+18yL2Y BCh1RKFyPovslL/IJuAG0SndYuixGTwEjzUvWsIeLGRih3F2WinKbJqWHAsm3kFSaQsr jyOJrlL4dySS7i7x2ckLCvgYhHNpd0fJdAOm5SPkWwaw9nxg4LxQSzxoT5vzfCZpj99e ce6Tw8eMYdaqVI2yHZWuHqBDCxX7ws5Ju+1Me1Kw1rqwUNdsLOxyuSJKnz/wdxPxMUun ZaOQ== X-Gm-Message-State: AGRZ1gJRiia9gTBMB4uwurhAHDkfHOwcAW7xLY5Q/5Qyog64hcMkP9bE A5pWw7hVM2rjViFxE/wru/PBnYdf X-Received: by 2002:a62:5e83:: with SMTP id s125-v6mr10679627pfb.232.1541488783752; Mon, 05 Nov 2018 23:19:43 -0800 (PST) Received: from bj03382pcu.spreadtrum.com ([117.18.48.82]) by smtp.gmail.com with ESMTPSA id o27-v6sm60832337pfk.85.2018.11.05.23.19.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 23:19:43 -0800 (PST) From: Zhaoyang Huang To: Catalin Marinas , Will Deacon , Dave Martin , Michael Weiser , Mark Rutland , James Morse , linux-kernel@vger.kernel.org Subject: [PATCH] arch/arm64 : fix error in dump_backtrace Date: Tue, 6 Nov 2018 15:19:35 +0800 Message-Id: <1541488775-29610-1-git-send-email-huangzhaoyang@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhaoyang Huang In some cases, the instruction of "bl foo1" will be the last one of the foo2[1], which will cause the lr be the first instruction of the adjacent foo3[2]. Hence, the backtrace will show the weird result as bellow[3]. The patch will fix it by miner 4 of the lr when dump_backtrace [1] 0xffffff80081e6b04 : adrp x0, 0xffffff8008ca8000 0xffffff80081e6b08 : add x0, x0, #0x5a8 0xffffff80081e6b0c : bl 0xffffff80081b0ca0 0xffffff80081e6b10 : stp x29, x30, [sp,#-64]! 0xffffff80081e6b14 : mov x29, sp [2] crash_arm64> rd ffffffc02eec3bd0 2 ffffffc02eec3bd0: ffffffc02eec3cb0 ffffff80081e6b10 [3] wrong: [] panic+0xf0/0x24c [] access_remote_vm+0x0/0x5c [] do_page_fault+0x290/0x3b8 [] do_mem_abort+0x64/0xdc correct: [ffffffc02eec3bd0] panic at ffffff80081b0da4 [ffffffc02eec3cb0] handle_mm_fault at ffffff80081e6b0c [ffffffc02eec3d80] do_page_fault at ffffff800809d7ac [ffffffc02eec3df0] do_mem_abort at ffffff800808156c Signed-off-by: Zhaoyang Huang --- arch/arm64/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c index d399d45..7a097cc 100644 --- a/arch/arm64/kernel/traps.c +++ b/arch/arm64/kernel/traps.c @@ -113,7 +113,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) if (tsk == current) { frame.fp = (unsigned long)__builtin_frame_address(0); - frame.pc = (unsigned long)dump_backtrace; + frame.pc = (unsigned long)dump_backtrace + 4; } else { /* * task blocked in __switch_to @@ -130,7 +130,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk) do { /* skip until specified stack frame */ if (!skip) { - dump_backtrace_entry(frame.pc); + dump_backtrace_entry(frame.pc - 4); } else if (frame.fp == regs->regs[29]) { skip = 0; /* -- 1.9.1