From patchwork Fri Apr 8 00:50:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Masami Hiramatsu (Google)" X-Patchwork-Id: 12805979 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 14C25C433F5 for ; Fri, 8 Apr 2022 00:52:40 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kmsW4Bc2MeYlsa8ablcRTPeoIE0EFmw7Q2AEOiPSocA=; b=f3AqfCDgjdkjDq F9ifoYKALEWTq9vMtWwXGwgmVcBoevjufLOwkOHtrPwKvaU3B51/6nTOkSu6fSG+4EudjUjO3v+H+ JkPAXJSNyJNtFR1YG5HcIGk+TUFGax7wke6boCkM3M7blWqmQOQovjHutu3AUa1TYZrVZcS1QDI2G tTB+qO/1jlV+sGyHZXy4oNWqtS6QMg1GNMmpiqAQY1fY4g3O3spUinXMeAFrc4UP1eTrorw79ZLcr bK7oCTk8gmqtU7qUv4xMDRod70BP9qusLTzuJDZRtxesiEWHYqS4JlWneUS5qArbZEF9pzOYZUyx5 StliYfZxW6x9wtj0abAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nccq6-00ESxp-3G; Fri, 08 Apr 2022 00:51:02 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nccq2-00ESvw-JX for linux-arm-kernel@lists.infradead.org; Fri, 08 Apr 2022 00:51:00 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8841B826CF; Fri, 8 Apr 2022 00:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41A4BC385A4; Fri, 8 Apr 2022 00:50:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649379054; bh=Fnq1dNA08/LWYoTGEL2vJKKrr5mYlJKc9c+6cJld2N0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cnLqp19VtblguBhMSGIxaseONA8r+Rcy9/cwcGcdd80faI2m/zBLxathG3BLtF31m 5jWu7pGSjxdbrBizkNsGJoQjC1d84csnLXM/Z1JiMN2sx2fFUA6jl2i8CKvtAqWo8E c0yL3edWumVdK0k/ExKbh97aW1aLS65EETQgVVIRk81Ig4NXLi9Ce8VxSiIQ4Kf7al ZL/iLEr59ZpuPyO0U4L2/hKptkS3VRPV1I+gA8QtisHxH44S5Fvd8D0Bxw27yAJk48 ylMdDcuEO4NEigfp2aStHDz3DrYIxZQ+7E02TUG6S9FTYC/waGjTvAR6z67tczPpjH 3YFy0tvYvDjuw== From: Masami Hiramatsu To: Alexei Starovoitov , Alexei Starovoitov Cc: Daniel Borkmann , Shubham Bansal , Andrii Nakryiko , Masami Hiramatsu , bpf@vger.kernel.org, kernel-team@fb.com, Jiri Olsa , Steven Rostedt , "Naveen N . Rao" , Anil S Keshavamurthy , "David S . Miller" , linux-kernel@vger.kernel.org, Mark Rutland , Will Deacon , Ard Biesheuvel , Russell King , Catalin Marinas , linux-arm-kernel@lists.infradead.org Subject: [PATCH bpf v2 1/4] ARM: unwind: Initialize the lr_addr field of unwind_ctrl_block Date: Fri, 8 Apr 2022 09:50:47 +0900 Message-Id: <164937904755.1272679.25073555823596728.stgit@devnote2> X-Mailer: git-send-email 2.25.1 In-Reply-To: <164937903547.1272679.7244379141135199176.stgit@devnote2> References: <164937903547.1272679.7244379141135199176.stgit@devnote2> User-Agent: StGit/0.19 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220407_175058_839914_27FC11F9 X-CRM114-Status: GOOD ( 12.33 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since the unwind_ctrl_block::lr_addr is finally passed to stackframe::lr_addr, that value will be exposed unconditionally. Thus it should be initialized. Without this fix, when unwind_frame() doesn't update the unwind_ctrl_block::lr_addr (e.g. 'lr' register is not saved in the target function), stackframe::lr_addr will contain a wrong value. Signed-off-by: Masami Hiramatsu --- Changes in v2: - Initialize pointer by NULL instead of 0. --- arch/arm/kernel/unwind.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c index a37ea6c772cd..c9f719e1b350 100644 --- a/arch/arm/kernel/unwind.c +++ b/arch/arm/kernel/unwind.c @@ -404,6 +404,7 @@ int unwind_frame(struct stackframe *frame) ctrl.vrs[SP] = frame->sp; ctrl.vrs[LR] = frame->lr; ctrl.vrs[PC] = 0; + ctrl.lr_addr = NULL; if (idx->insn == 1) /* can't unwind */