From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCB9F606A31C for ; Tue, 17 Nov 2026 04:36:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=s4Xv+dpv; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=VoBcTgvD DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:From: Subject:Message-ID:References:Mime-Version:In-Reply-To:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=vDuDdRL8iZneo/phC8IWAHFDoAthrBkjX6kaJXJOz94=; b=s4Xv+dpvhZH85lVy1pwvVpX4Th RY2NZwBgmAv+SVQHuhhUcvtnQntsZ+hkMz+c8T3d118PwVa7dIQTuVkOXm+2RU4onR17xmCkM5XzY k0Ax1cYfY1kCSK9JGBlpN/YEhUz01BEinMXhinZCb/xsfPvR/F0R+nFNx70UT+7GQiPsR5BrFjsQ/ o1dRQ4xkue9g3c2nu+u7JGK4iFIrj9Kvpykk1SKXcjlSl/R4OBsBpL6OWpKDACY0blUQw/AkamfpJ BGEOjdOgXri33KB986Dxt/fOl9xHAtwLFoHyedPFtUetM+oqNVddsIeVv4ZZruPdxsLB6YSeFGpOe XpWgzZ8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTAvC-00000004YIf-0p74; Tue, 17 Nov 2026 04:35:54 +0000 Received: from mail-pl1-x648.google.com ([2607:f8b0:4864:20::648]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTAuh-00000004Xvi-0aKf for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2026 04:35:26 +0000 Received: by mail-pl1-x648.google.com with SMTP id d9443c01a7336-2efd8a0a38dso5491675ad.2 for ; Mon, 16 Nov 2026 20:35:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1794890122; x=1795494922; darn=lists.infradead.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=vDuDdRL8iZneo/phC8IWAHFDoAthrBkjX6kaJXJOz94=; b=VoBcTgvDSzdGHqCgpTcGqOmVkxfHCxkpIpRpf7+wDTWaz8OBF7zyNkQQTPgaAQiuJ9 AMMbiRNciCVqzdiXEiMEwUPF71NkVcwYeOlOoGCijP0/eWWpeFHsTw9+aT5RIBnWC5Ju s9CaZtAHCRei2/OAvp9M0WIfaLkrbt5erK5Ps4V14MUZpSvD0PNW9fMtMBcgo5tmvoz4 Bt/TBtbXjIwUyyWeSUwBdwWqbuG1up+b8CZMIpefOSzGtucwDvr5jgOb9ZB8n9iBpCoL xO8Buduxs0qUuC6R3WLFd0lEFYuKlapIYxHx06h9xCXjPBbdP28RZAQMGtcqnMJjq9fP 8U0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794890122; x=1795494922; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=vDuDdRL8iZneo/phC8IWAHFDoAthrBkjX6kaJXJOz94=; b=T9UHCQmwr4EyTvg9Fpfd5UTQ4KXPi6ufk7XUTnj6YNu5Y7/k5R2yd4eIftz+J0SksB 7R8sWDBGP9i9JmKI1NG+oowd4rW0EAUsZFClcquR7sCtqJbkWYqLFGT6cq40yvKSuhGm LiDp0upqEt1thsrFzxees3qtbEqe9sBGG+tyiTzH//XL7RcOClGbSYNJ+A8xbWpEPk3h 0XU2C5iaOILEzer4xRf9+KFHOesK3SPICEBhO98GpRNu3P4FSO1o+Qr8pIRvZFZgIqqy jMb+eSmKo/FGa+AUNs1U06s1F+wRARwY+sPvEhRTP5sHWov71qy25AFzUbsLZwWSBEd7 9SGw== X-Forwarded-Encrypted: i=1; AL+hErG2GS5NOzLZB2oUd3+Yo2MV+BrPg87ZZ7VSMJwfFwx3ZVKRQfCX1dTk8ujtZmGhfG4l922fKD/Ri7pJpojqDs77@lists.infradead.org X-Gm-Message-State: APuU4Z+IgTELGuwENRbmli2y1yX2Tl1fgsSH8y03pxqdL4BGOf3XnoWB 3xZhs3icIiCeWQUAKLSkJ5TS+PWImpGYd7U0BuI2vesQnc/vsuebHnUeKQAboF8LemeFj/QQ7Tg XjCA2Olf212F7hlgFK8SMilqCWg== X-Received: from plgn9.prod.google.com ([2002:a17:902:f609:b0:2df:4aa4:16d0]) (user=dylanbhatch job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:f8d:b0:2e9:5507:b52c with SMTP id d9443c01a7336-2ee0de03f7dmr125521225ad.34.1794890121819; Mon, 16 Nov 2026 20:35:21 -0800 (PST) Date: Tue, 17 Nov 2026 04:35:02 +0000 In-Reply-To: <20261117043504.1021063-1-dylanbhatch@google.com> X-Archived-By: Mime-Version: 1.0 References: <20261117043504.1021063-1-dylanbhatch@google.com> X-Mailer: git-send-email 2.56.0.679.gc527c65306-goog Message-ID: <20261117043504.1021063-11-dylanbhatch@google.com> Subject: [RFC PATCH 10/12] arm64: entry: add unwind info for call_on_irq_stack() From: Dylan Hatch To: Catalin Marinas , Will Deacon , Mark Rutland Cc: Herbert Xu , "David S . Miller" , Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Weinan Liu , Jens Remus , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-crypto@vger.kernel.org, llvm@lists.linux.dev, Josh Poimboeuf , Steven Rostedt , Ard Biesheuvel , Indu Bhagat , Prasanna Kumar T S M , live-patching@vger.kernel.org, Dylan Hatch Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261116_203523_189431_887405A6 X-CRM114-Status: GOOD ( 12.43 ) X-Spam-Score: -9.5 (---------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-26.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Weinan Liu DWARF CFI (Call Frame Information) specifies how to recover the return address and callee-saved registers at each PC in a given function. Compilers are able to generate the CFI annotations when they compile the code to assembly language. For handcrafted assembly, we need to annotate them by hand. Frame pointers alone are usually sufficient to recover stack frames (without CFI), except at the exception boundary, where more information is needed to determine if the LR is live. Since an exception can be taken from call_on_irq_stack(), annotate it with CFI. The actual entry assembly functions are left untouched, since they are not expected to take exceptions themselves. Signed-off-by: Weinan Liu Suggested-by: Jens Remus Signed-off-by: Dylan Hatch --- arch/arm64/kernel/entry.S | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 8d17f61d1b5b2..aae27ccc0f2c1 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -30,6 +30,13 @@ #include #include +#ifndef CONFIG_UNWIND_TABLES +/* + * Do not generate .eh_frame unless CONFIG_UNWIND_TABLES is enabled. + */ + .cfi_sections .debug_frame +#endif + .macro clear_gp_regs .irp n,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29 mov x\n, xzr @@ -880,8 +887,11 @@ NOKPROBE(ret_from_fork) * void (*func)(struct pt_regs *)); * * Calls func(regs) using this CPU's irq stack and shadow irq stack. + * Open-code SYM_FUNC_START() so .cfi_startproc precedes the BTI landing pad. */ -SYM_FUNC_START(call_on_irq_stack) +SYM_START(call_on_irq_stack, SYM_L_GLOBAL, SYM_A_ALIGN) + .cfi_startproc + bti c save_and_disable_daif x9 #ifdef CONFIG_SHADOW_CALL_STACK get_current_task x16 @@ -892,6 +902,9 @@ SYM_FUNC_START(call_on_irq_stack) /* Create a frame record to save our LR and SP (implicit in FP) */ stp x29, x30, [sp, #-16]! mov x29, sp + .cfi_def_cfa 29, 16 + .cfi_offset 29, -16 + .cfi_offset 30, -8 ldr_this_cpu x16, irq_stack_ptr, x17 @@ -907,9 +920,13 @@ SYM_FUNC_START(call_on_irq_stack) */ mov sp, x29 ldp x29, x30, [sp], #16 + .cfi_restore 29 + .cfi_restore 30 + .cfi_def_cfa 31, 0 scs_load_current restore_irq x9 ret + .cfi_endproc SYM_FUNC_END(call_on_irq_stack) NOKPROBE(call_on_irq_stack) -- 2.56.0.679.gc527c65306-goog