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: tip-bot for Dave Martin X-Patchwork-Id: 1685141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id BD186DFE75 for ; Thu, 1 Nov 2012 13:59:44 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TTvHL-0008Og-OF; Thu, 01 Nov 2012 13:57:51 +0000 Received: from mail-bk0-f49.google.com ([209.85.214.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TTvHI-0008OC-5k for linux-arm-kernel@lists.infradead.org; Thu, 01 Nov 2012 13:57:48 +0000 Received: by mail-bk0-f49.google.com with SMTP id j4so1001265bkw.36 for ; Thu, 01 Nov 2012 06:57:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=PKkSxdbaJZzFnzxtvy7Dy53/w9ARfawTC9V2LSW/0oM=; b=Lh0ElXE1Kn9tYofQ1ZwpFROlcOOPyVp5w2IbY+y/AKioyljGK6LdwFPv3r2dtg3iIx 6LD8kYhoSLoGB9lgIr73uTNPbHkIuiMC3eCvhs//WmzYv80XOnc/xeB5pgawTMwq1Uy4 PoYb4K3pVxSVu3YNNtTfpGYHIyuXMEqwwvTOBUg4p7Hrz2uhkiqfnqg/GpNXOFH3ZHDI yE99qsPfuur2kvxSuz2S6dJY23LuA+mlW6jNgptTwtD63wjAnY1PwmFLpPgqZiZ42jCH MjenRxDk/NS9qIHHRTbMAyAx7LDE9PTqSYXP9ns7zZhYTqcRXShFK0fj0ZJZPZFidCMd mjXA== 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 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: ALoCoQmYdntfs8AdWTB8DjuiUUx6Lj6Wa8amWnSaUZ7OUC0RXe8j5wh3j+gtG3R/paDvDN7ED7iI X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121101_095748_422332_1E23FD8B X-CRM114-Status: GOOD ( 13.62 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.49 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org 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;