From patchwork Thu Nov 1 14:01:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 12645 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6330423EF7 for ; Thu, 1 Nov 2012 13:57:49 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id ED6ADA19229 for ; Thu, 1 Nov 2012 13:57:48 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so1851019iag.11 for ; Thu, 01 Nov 2012 06:57:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=PKkSxdbaJZzFnzxtvy7Dy53/w9ARfawTC9V2LSW/0oM=; b=UOU5iidnWtDGZ1Q/UaFKBW8IUqRUf5Wboybl614CCWdcoUCXddsP2BrmHVu55+7wIq 4JzRkcP2X83O/xvsfIhoqqRAh4uiKFxrYc5hII2nc6Hv34iQeIq9Lz78nHhH5dyuo/Yj YDIp6/If8WYXaFm6WjiO7B7LJFEq3QYHVWYRCg/ji8bhjzH8PG+Ax0FvJfuhuWGk+BAP Lv5AL4do2S/6IhuTPAARD/PZxTf9Qpm2FF1JabuGF9aXDHl7VAN81/VgFU80OvMogWeA 1ZuYw5LMTsrp+UWsda9F1TF4fGB8C52KKGoFDvoe/VQ9pIXJjh6vdbpY1S7Mo4zHa0QQ w/0g== Received: by 10.50.91.195 with SMTP id cg3mr1283371igb.57.1351778268172; Thu, 01 Nov 2012 06:57:48 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp794666igt; Thu, 1 Nov 2012 06:57:47 -0700 (PDT) Received: by 10.205.118.136 with SMTP id fq8mr11979196bkc.24.1351778266379; Thu, 01 Nov 2012 06:57:46 -0700 (PDT) Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50]) by mx.google.com with ESMTPS id hk18si9548334bkc.12.2012.11.01.06.57.45 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Nov 2012 06:57:46 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) client-ip=209.85.214.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) smtp.mail=dave.martin@linaro.org Received: by mail-bk0-f50.google.com with SMTP id q16so1179432bkw.37 for ; Thu, 01 Nov 2012 06:57:45 -0700 (PDT) Received: by 10.204.10.74 with SMTP id o10mr12515608bko.9.1351778265037; Thu, 01 Nov 2012 06:57:45 -0700 (PDT) Received: from localhost.localdomain ([91.224.175.20]) by mx.google.com with ESMTPS id ia2sm5183212bkc.11.2012.11.01.06.57.43 (version=SSLv3 cipher=OTHER); Thu, 01 Nov 2012 06:57:44 -0700 (PDT) From: Dave Martin To: linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Subject: [PATCH] ARM: stacktrace: Fix return_address() for CONFIG_FRAME_POINTER Date: Thu, 1 Nov 2012 15:01:41 +0100 Message-Id: <1351778501-29924-1-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.5.4 X-Gm-Message-State: ALoCoQndmI5f9DUvMLh07mZl1S9LdVTacdupOdvOjl8Y1eheXAK7cL4zcquEHvXY6h6Z+9FtE3Gu return_address() currently relies on walk_stackframe() setting frame->lr, but walk_stackframe() never sets this field. Setting frame->lr from walk_stackframe() would require walk_stackframe() to unwind one frame beyond the frame being returned, and to track extra state in struct stackframe. The value of this is debatable, so this patch modifies caller_address() to unwind one extra level explicitly and reference frame->pc instead of frame->lr. Signed-off-by: Dave Martin --- arch/arm/kernel/return_address.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c index 8085417..0854b54 100644 --- a/arch/arm/kernel/return_address.c +++ b/arch/arm/kernel/return_address.c @@ -26,7 +26,7 @@ static int save_return_addr(struct stackframe *frame, void *d) struct return_address_data *data = d; if (!data->level) { - data->addr = (void *)frame->lr; + data->addr = (void *)frame->pc; return 1; } else { @@ -41,7 +41,7 @@ void *return_address(unsigned int level) struct stackframe frame; register unsigned long current_sp asm ("sp"); - data.level = level + 1; + data.level = level + 2; frame.fp = (unsigned long)__builtin_frame_address(0); frame.sp = current_sp;