Received: by 10.223.164.221 with SMTP id h29csp515971wrb; Tue, 24 Oct 2017 04:50:02 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QHxcxL76dkUa9FmzIG2Fwvup1wG4AiQfHILpMNI9lziJFCxH3dT5NaoCdBrkjYYdwCL7/q X-Received: by 10.98.147.23 with SMTP id b23mr16537522pfe.5.1508845802168; Tue, 24 Oct 2017 04:50:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508845802; cv=none; d=google.com; s=arc-20160816; b=npil84lRT4K9EhlGGpJYuI5keXOExFUYazBhz2IZaUmIO2b63MnZTYj6IbZNEFVS9J 5yFfTI+JN4UGomYv7S/m5v353EgVQTOjy/6739dzCOh2EEDNJHmginWtJMVQ+nB4qt1H QxVaG0Ur8gpkUUoOj6rGU5ga+fIF4fOi4Qdrq6gB3bHD3uW34Uqg3gciOh4VzKDeVEQW fBxBxS9reZ6RVGQtpfF7OJ0lxZ99tpIRngHyCq+LRjs11MUN6ViR2v0IngN9lT1WKgU9 Dhj1NibqteCFa9UgQ32h5RXpTXzgAvYSnc5of5d6D3LDsB/p+XErfk4kNgI1SKIrLChc hs/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type:message-id :date:subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=lbAZTOZAvIBJvBgqYUl4VOtGoCK8agh14kMlcSqnd1A=; b=NtvfF2KITv2tUfD/6rQUcc224IOmlE9jqnskMFlH15U8gBotGDCBSUxgdlKjMOy30B h0YmfiVKpztmkq1tS2Rrm0gt8IU3keIbcsbjBm500PjiEKf7n0a3EzhnsdbQTWVSM2nF gf7AR+HJun1DhFkeLZg6NT+DcsAPRg8gdEyY3ijrqEgPJHjZV/Px82CecRl4m8SXsUmo F7Rw4Vf7hUZBVYhKlMx6S4zPLGSARDlUXZo/FrXQ2ej/GKMe3vnRdUqLIqdVIQ4bJ39w 4d2y8TDF2m3FvF3tb4tnRMLRhLNbKIchKI8HpFDvsrvYYR03c6xCDqZ0VLsCcL2VrzMj TJ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kRgm2a0o; 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=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x23si38710pgc.683.2017.10.24.04.49.48; Tue, 24 Oct 2017 04:50:02 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kRgm2a0o; 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=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752093AbdJXLs6 (ORCPT + 99 others); Tue, 24 Oct 2017 07:48:58 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:40881 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751825AbdJXLs4 (ORCPT ); Tue, 24 Oct 2017 07:48:56 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20171024114854epoutp031465406c85f9b95a409213733158b5e8~wfzN-97Pp2234222342epoutp03V for ; Tue, 24 Oct 2017 11:48:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20171024114854epoutp031465406c85f9b95a409213733158b5e8~wfzN-97Pp2234222342epoutp03V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1508845734; bh=lbAZTOZAvIBJvBgqYUl4VOtGoCK8agh14kMlcSqnd1A=; h=From:To:Cc:Subject:Date:References:From; b=kRgm2a0o9GC/2OwZgCABmyiwvjDGsJcAwT3ZMWx0bNSPvLD5y+lNHNnq2Zch0s/lC yKRti/Vi1nkHyxs9dLVFid8hzhB8gR8hetGO2UWeYMKToS6SUBJ4mTf24XFNFZGZbA GTx4Zyeo6xV4Kwjf1GmMob+LSUyXPV3dbc/6fgSg= Received: from epsmges5p3new.samsung.com (unknown [182.195.40.74]) by epcas5p4.samsung.com (KnoxPortal) with ESMTP id 20171024114854epcas5p4df9d59ee7c1bccbb5f8716e458394ea2~wfzNuz7O81450814508epcas5p4s; Tue, 24 Oct 2017 11:48:54 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p3new.samsung.com (Symantec Messaging Gateway) with SMTP id F3.83.04390.5A82FE95; Tue, 24 Oct 2017 20:48:53 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20171024114852epcas5p199ffd8d75fc57e46d46025e12180c156~wfzMjLa4R1792617926epcas5p1a; Tue, 24 Oct 2017 11:48:52 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20171024114852epsmtrp2335265ec0fca379f4ece395684cd25e7~wfzMh0nTR1312113121epsmtrp2k; Tue, 24 Oct 2017 11:48:52 +0000 (GMT) X-AuditID: b6c32a4b-f03ff70000001126-dd-59ef28a552ad Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 8F.11.03948.4A82FE95; Tue, 24 Oct 2017 20:48:52 +0900 (KST) Received: from localhost.localdomain (unknown [107.108.92.210]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20171024114850epsmtip24a490183b8ccb398c82fc114f3069e10~wfzK5D6kB0620306203epsmtip20; Tue, 24 Oct 2017 11:48:50 +0000 (GMT) From: Maninder Singh To: linux@armlinux.org.uk, mingo@kernel.org, will.deacon@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pankaj.m@samsung.com, a.sahrawat@samsung.com, Maninder Singh , Vaneet Narang Subject: [PATCH 1/1] arm/stacktrace: stop unwinding after an invalid address. Date: Tue, 24 Oct 2017 17:16:42 +0530 Message-Id: <1508845602-33508-1-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7bCmuu5SjfeRBucnWltc3J1qsenxNVaL y7vmsFkcmrqX0eLw/DYWi9X/TjFa3Huzlcni0Mm5jBYvP55gceD0WDNvDaPH5WsXmT02repk 89i8pN6jb8sqRo/Pm+QC2KJSbTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPIS c1NtlVx8AnTdMnOAblJSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CpFGxoa6RkamOsZGRnp mZjGWhmZApUkpGa0THnOXPCBt+LzpCusDYynuLsYOTgkBEwkjsyw6mLk5BAS2M0o8XUXM4T9 iVHi6B7PLkYuIPsbo0Tb/4tgCZD6Gc2d7BCJvYwS109/g3K+MEo8X3CPFaSKTUBPYtWuPSwg toiAg8SVw1OZQYqYBU4wSpzsfQqWEBbwl+jet5AdxGYRUJX4dH8j2ApeAXeJSY82MEKsk5M4 eWwyK0izhMAMNonW7XOYIBIuEv///2aFsIUlXh3fwg5hS0l8freXDaKhm1Fi2eknTFDdjBIr 7t2D+sJe4sGNo+ygEGAW0JRYv0sfImwr0fLsNBuIzSzAJ9H7G6QXFEi8Eh1tQhAlqhItNzdA 7fWQOHlqGtQ9jhLNB98zg5QLCcRKLPvoOIFRdhbC/AWMjK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3ydTMZI5p5ypPLXHeWvO8usvovirjRK4jsd5HGKOUWIozEg21 mIuKEwElW7X7LQIAAA== X-CMS-MailID: 20171024114852epcas5p199ffd8d75fc57e46d46025e12180c156 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-MTR: 20171024114852epcas5p199ffd8d75fc57e46d46025e12180c156 CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20171024114852epcas5p199ffd8d75fc57e46d46025e12180c156 X-RootMTR: 20171024114852epcas5p199ffd8d75fc57e46d46025e12180c156 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch stops unwinding backtrace in case of below 2 cases. (Issue observed while porting stackdepot on ARM, duplicate entries created in stackdepot reference patch for workaround in stackdepot:- https://lkml.org/lkml/2017/10/11/353 ). 1. If address belongs to irq/exception code, ignore it. save_stack+0x40/0xec __set_page_owner+0x2c/0x64 .... .... __handle_domain_irq+0x9c/0x130 gic_handle_irq+0x40/0x80 __irq_usr+0x4c/0x60 0xb6507818 ^^^^^^^ 2. If address belongs to junk entry, ignore it kmem_cache_alloc_trace+0x1e8/0x21c rb_allocate_cpu_buffer+0xf0/0x25c __ring_buffer_alloc+0xf8/0x1e0 trace_init+0xe0/0x2cc start_kernel+0x30c/0x448 0x400080a0 ^^^^^^^ Signed-off-by: Maninder Singh Signed-off-by: Vaneet Narang --- arch/arm/kernel/stacktrace.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index 3a2fa20..80e953e 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -82,6 +82,9 @@ static int save_trace(struct stackframe *frame, void *d) return 0; } + if (!__kernel_text_address(addr)) + return 1; + trace->entries[trace->nr_entries++] = addr; if (trace->nr_entries >= trace->max_entries) @@ -98,12 +101,8 @@ static int save_trace(struct stackframe *frame, void *d) data->last_pc = frame->pc; if (!in_exception_text(addr)) return 0; - - regs = (struct pt_regs *)frame->sp; - - trace->entries[trace->nr_entries++] = regs->ARM_pc; - - return trace->nr_entries >= trace->max_entries; + else + return 1; } /* This must be noinline to so that our skip calculation works correctly */ -- 1.9.1 From 1584155558793943372@xxx Wed Nov 15 17:54:29 +0000 2017 X-GM-THRID: 1584155558793943372 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread