From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C72F239FCC8 for ; Tue, 19 May 2026 06:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779173414; cv=none; b=W8oBehkZr/f/dfP2TF+f8/Pq7xJAq2mxM7mTRQvXpcy0JymbuwVT8sDeo3f9pcT76pgDnTpgUNSbMP1TSFIlXaKvNdF6CxLRhilfFHY6QsfsYm9JX4tTARw81dsFAIvk7EN3XMkevJ2LWVMpC3lmN75YvQ1A9V4jQGWlw2lIQpI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779173414; c=relaxed/simple; bh=QPZlDoBeN5r7i/6i6lVlWNxNy9qNlw6uNRopAySy1HM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=AM7fSo5pvlU8xNHvYDJrXdZ+K+nK24+zO6KcfRiqYDRoToLTe21XJgPjMdJdIBbzx3aBDTvhj89WFA5Bgz38ISmp90wF3D9ywsxSTkOlrOPVaWpbsVUjDTHnlgtd+BsG7CyF1nUw73PBcMT1T9fweaAEc7zawwXgEUoNbC0g968= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--dylanbhatch.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GQ0CpSrh; arc=none smtp.client-ip=209.85.210.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dylanbhatch.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GQ0CpSrh" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-8397b14a689so2236517b3a.2 for ; Mon, 18 May 2026 23:50:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1779173411; x=1779778211; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=086D5frAOVBWnalU1CQBdAMt78W31bnAcSL8E1jh81w=; b=GQ0CpSrhn6Bx56+rEnuQdoVu7POZK19OnFF1nyv9d2Zg2/ZWylIOJJu5XmeGDEd5uH L5etXmJ2foDebr+qbKfpuyKYUlvzCVY8aXGJ5KYqFI2Db/F2L9cWlfeKEBbsUSofmScf SMyDaU62ccxPsazoI8yvzUORIW628zOQo+9sOlt9JQzp0B+KsW+SW/Lqj2c2X4Y+0Fg9 FSbwhKnKbgrnfTajcsvlK0wV9SDPI2rCSPCEDvb/YPD+R9TYJ4K5s/I161RE6vmhJvGK YlYSggfN1BBV9f4d/lqbysTzSvpQVzAPdUp3QNkZ32U1yWX8Z867TpLurdXTameehOxy Nchw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779173411; x=1779778211; h=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; bh=086D5frAOVBWnalU1CQBdAMt78W31bnAcSL8E1jh81w=; b=j9WPbeJ33cu01WBVi1VYRR/kXWio9gqZN0C3mA4u4ox1SKJwyIhw1fSUETndfdnjzZ 6w0+aD6d2cqKrRUNGLtZ3uGNP94uWKncX2VCOTPYO3GDzw9mRNR3nYeqzSJMM0dtKkl7 0sefrfUyBh9v8PCcjQJ4k7+MGUB6jDvQ3Fr5BcRyzeZN/nWRj4Zm90fAnWb6LeKS4jqS pq6uSQQi0paTBATT6abn1RPhsn92ucd0EDQTjRUDB2UUI3fvKXRBy0SpkVAtBUQDio7C Ah8wxn8IBnG/PYSF52PUD+n2uiOBkQUpiZ0MIboZMQD7g0UAE02kqirJNvsm5nGLk3dO y0YQ== X-Forwarded-Encrypted: i=1; AFNElJ+YzyzNYB6mn8jakwIyh5x2D5d2I7ywiQVHfAyoAtW8e8wT84Dzepl7IbQL7UKXstkIcfC/hZPNLt22OnY=@vger.kernel.org X-Gm-Message-State: AOJu0YwW/ohmluiR3IDihZiGq6HliF8m7RQrSmLwLg9Jr0CNmH4QASfI ME6HBWBxPMk2q71dpEClbac485PjwbemDUuAeoBch8TYUGGCdIJSzZ885jNyRuF7/k4pAK8PiLX JP265oqAAGm+0oCAKO4b/AIYJFw== X-Received: from pfoo3.prod.google.com ([2002:a05:6a00:1a03:b0:82f:d8c0:fef8]) (user=dylanbhatch job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:e11:b0:837:a211:4ed0 with SMTP id d2e1a72fcca58-83f33de8025mr17898871b3a.41.1779173410955; Mon, 18 May 2026 23:50:10 -0700 (PDT) Date: Tue, 19 May 2026 06:49:44 +0000 In-Reply-To: <20260519064950.493949-1-dylanbhatch@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260519064950.493949-1-dylanbhatch@google.com> X-Mailer: git-send-email 2.54.0.563.g4f69b47b94-goog Message-ID: <20260519064950.493949-4-dylanbhatch@google.com> Subject: [PATCH v6 3/9] arm64: entry: add unwind info for call_on_irq_stack() From: Dylan Hatch To: Roman Gushchin , Weinan Liu , Will Deacon , Josh Poimboeuf , Indu Bhagat , Peter Zijlstra , Steven Rostedt , Catalin Marinas , Jiri Kosina , Mark Rutland , Jens Remus Cc: Dylan Hatch , Prasanna Kumar T S M , Puranjay Mohan , Song Liu , joe.lawrence@redhat.com, linux-toolchains@vger.kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Randy Dunlap , Mostafa Saleh , Herbert Xu , "David S. Miller" Content-Type: text/plain; charset="UTF-8" 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 Reviewed-by: Jens Remus Signed-off-by: Dylan Hatch --- arch/arm64/kernel/entry.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index e0db14e9c843..5f4172ba4274 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -30,6 +30,12 @@ #include #include +/* + * Do not generate .eh_frame. Only generate .debug_frame and optionally + * .sframe (via assembler option --gsframe[-N]). + */ + .cfi_sections .debug_frame + .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 @@ -870,6 +876,7 @@ NOKPROBE(ret_from_fork) * Calls func(regs) using this CPU's irq stack and shadow irq stack. */ SYM_FUNC_START(call_on_irq_stack) + .cfi_startproc save_and_disable_daif x9 #ifdef CONFIG_SHADOW_CALL_STACK get_current_task x16 @@ -880,6 +887,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 @@ -895,9 +905,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.54.0.563.g4f69b47b94-goog