From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02961C43334 for ; Mon, 18 Jul 2022 08:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WwcMGpH0GYS+9Kdg72aQs24dypGYFEzNUHiCs5sE9m0=; b=CKUlLmFj+q/sH/ gUkRVnAs5E+XvjieJVFspRKrbbK8EWWFzM5J6lZj3VtflkTDnsvuVdLg52hlLHulLucFHqSC0TUmi bwN9GVwDMQJr9xPrAPI705Q45HWA/C+2Nu+u6f29IRV7xaNd1eL2BGMAiRVYthMc4hoT7eLylXR66 435Lh0w+1yWPpmMoyw7T7FIE9xV3LtL+fvxLkgK4Yz1og2zZd+y7o/ImXPiGjYX94m0SoKo8rvScO yw0QeamyrtH4TKNU0rjewR0gPf95GcghRdQSyq4n7UNh3d2whJOZb6+2KI/u1fPr6wMSs44FSFSRW N8GI2mSKZ8bGBG4y8zgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDMZa-00Bw9Q-Ac; Mon, 18 Jul 2022 08:57:50 +0000 Received: from mail-yb1-xb34.google.com ([2607:f8b0:4864:20::b34]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oDMZW-00Bw6F-GH for linux-arm-kernel@lists.infradead.org; Mon, 18 Jul 2022 08:57:47 +0000 Received: by mail-yb1-xb34.google.com with SMTP id e69so19654397ybh.2 for ; Mon, 18 Jul 2022 01:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E4hcKXeKDY4mZgkkWrO2UJFIB2+YkvdMpf7oiIiz6Vw=; b=UCIHI1H6TeNg0v3uYSbIuL/VieFk1ImiXQDuN/19M2oYbk+kcyRKEEqHGhqSw3eUut BdnC2zIydmA4KpoHM2EtnVw+ahe4W6zoILmUWR59hch4t38x8wPS53oZhJLwySWmW7Z9 vHjEDczIaHH3Qftdg7tdTxUstk77/GJABs7mPAZGyswj7G7P3ikkEgn2C4trLQ+r2mz4 RqM4ConzLpmjisWpgCVxPDvqWjg+e+j8PNmJSPgP7WrNbTU46G4nBXIMkB76x6q+uaFm vhOTUvCGzEGEPAprRntYjRsx1Vk6cQXsB+oJPey+mkXfUzy6e25fNM6/jcy+JAkMGsV+ vVaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=E4hcKXeKDY4mZgkkWrO2UJFIB2+YkvdMpf7oiIiz6Vw=; b=SKDpB/rycU0C5dVDKUMy4LMkuOwn/FbHZrQvtXzy5mhKln6CzsUrXkJFI3xkneQlsq Bnyi3v1lfOY8nUc7RWae8PuF5uZugyMFrT+QAdZBEqirnPVQ04GpKHjKGmO7XMR6c4ZM j4JSBWZxlJpAMhEgSAlLh0Jk9vTeIrYjILLI9a0nDgDf8hvYsbu1YYP/eVtPhtaEctMG 34s3uXoIBItvW/w9ICBpz+ma0p8VMx8j20R1SQbijCmJlIJPmdd/jhFtSUD5vNhclTlV msC5GaGH1LC5AsUeHJnRfFQ6tyF8m7uJ5Mz5Wh8P9nIO8t5yVrb2EGodKUl/8Z4UqdxF L7vw== X-Gm-Message-State: AJIora8cvnqd8+QwSV0VwdXcEAD0eZXtM+6iXzoWz5JtAdwfOt/+sV16 iiMn9MKRsh2vAu0n7Q7KNpbem1sZbpHt9dMxSkwGPg== X-Google-Smtp-Source: AGRyM1uvQuAYd5Xd3CpqPVNwGhgZoalb7/c9+nWogQm4nDzGun/0TtAYRBVk6lqyyRP8T4PC+GMB4hceI7OvjD3faTY= X-Received: by 2002:a5b:9c5:0:b0:66e:cbbf:2904 with SMTP id y5-20020a5b09c5000000b0066ecbbf2904mr24557371ybq.220.1658134663023; Mon, 18 Jul 2022 01:57:43 -0700 (PDT) MIME-Version: 1.0 References: <20220712021527.109921-1-lihuafei1@huawei.com> <20220712021527.109921-2-lihuafei1@huawei.com> In-Reply-To: <20220712021527.109921-2-lihuafei1@huawei.com> From: Linus Walleij Date: Mon, 18 Jul 2022 10:57:31 +0200 Message-ID: Subject: Re: [PATCH 1/5] ARM: stacktrace: Skip frame pointer boundary check for call_with_stack() To: Li Huafei Cc: linux@armlinux.org.uk, rmk+kernel@armlinux.org.uk, ardb@kernel.org, will@kernel.org, mark.rutland@arm.com, broonie@kernel.org, peterz@infradead.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, arnd@arndb.de, rostedt@goodmis.org, nick.hawkins@hpe.com, john@phrozen.org, mhiramat@kernel.org, ast@kernel.org, linyujun809@huawei.com, ndesaulniers@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220718_015746_574798_961CB7FC X-CRM114-Status: GOOD ( 17.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jul 12, 2022 at 4:18 AM Li Huafei wrote: > When using the frame pointer unwinder, it was found that the stack trace > output of stack_trace_save() is incomplete if the stack contains > call_with_stack(): > > [0x7f00002c] dump_stack_task+0x2c/0x90 [hrtimer] > [0x7f0000a0] hrtimer_hander+0x10/0x18 [hrtimer] > [0x801a67f0] __hrtimer_run_queues+0x1b0/0x3b4 > [0x801a7350] hrtimer_run_queues+0xc4/0xd8 > [0x801a597c] update_process_times+0x3c/0x88 > [0x801b5a98] tick_periodic+0x50/0xd8 > [0x801b5bf4] tick_handle_periodic+0x24/0x84 > [0x8010ffc4] twd_handler+0x38/0x48 > [0x8017d220] handle_percpu_devid_irq+0xa8/0x244 > [0x80176e9c] generic_handle_domain_irq+0x2c/0x3c > [0x8052e3a8] gic_handle_irq+0x7c/0x90 > [0x808ab15c] generic_handle_arch_irq+0x60/0x80 > [0x8051191c] call_with_stack+0x1c/0x20 > > For the frame pointer unwinder, unwind_frame() checks stackframe::fp by > stackframe::sp. Since call_with_stack() switches the SP from one stack > to another, stackframe::fp and stackframe: :sp will point to different > stacks, so we can no longer check stackframe::fp by stackframe::sp. Skip > checking stackframe::fp at this point to avoid this problem. > > Signed-off-by: Li Huafei Very nice catch! Took me some time to realize what was going on here. Reviewed-by: Linus Walleij Nitpick below: > + /* > + * call_with_stack() is the only place we allow SP to jump from one > + * stack to another, with FP and SP pointing to different stacks, > + * skipping the FP boundary check at this point. > + */ > + if (pc >= (unsigned long)&call_with_stack && > + pc < (unsigned long)&call_with_stack_end) > + return 0; Can we create a local helper macro to do this, if it needs to happen some other time? #define ARM_PC_IN_FUNCTION(pc, func) (pc >=. ...) Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel