From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.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 A83422DF717 for ; Tue, 28 Apr 2026 18:37:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777401436; cv=none; b=rdasLMfzHBbqyvjlX9ev9WNn825IkS6R0hjfsk74OUj5VE2pmEGGCXUO992BSlA1wH/jTlw2GFCXS3hJ6f34CI1zGeYZGwxN9nxoHUPn2tpFBkRZiHaDCzxdzvzNBksQxQ8RTyFPqSSTk7stU4CXBvWNwjQWIQuIZ3n7su79NSo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777401436; c=relaxed/simple; bh=tefadcmVpwT/xUVJDO57dtYdiK3vwLPkO5vSZsjgUdk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Tkf1LC2Q0uIF6F3FvDADbZYAibzNy5IgcXuox5lcFO9ul5qMyhKkbvtmhruWO3WhKr2ofznOFoJWUPSeCg2xMitmfxYs2djzGIAZht/EfHcYhMiEIlLIUAkQasehSXteqseF4gDrvZ1O2PnogcQgbYxuW1wNRKWpwKBWTfMPSPc= 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=rqQx3dAd; arc=none smtp.client-ip=209.85.215.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="rqQx3dAd" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-c76c6280732so13459810a12.0 for ; Tue, 28 Apr 2026 11:37:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777401435; x=1778006235; 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=rEpxSS5AT7sZwZhISlQ7XtXed3JthTvzY7OBT2Phvm0=; b=rqQx3dAd/ZXH5/17SVRgTl/JkHFXzU8byZNT00J97UJk+aU1evq09GDHXvI1yKYyN0 qTALV0aykEdUJcVtkkpWidN39NoE5KzOZvr6aePhQTS7chLF1axB5TVZfU92Foh1mQym 3KAIPenmQI1hO10E5CHsHvzvnsl5Wi8p6rTFigydrqH0yUrTL2a56QBteJSk35XvjkrD vbD4uQjVO1gPS+fep4iW0ea2S3IMERkAh2PE+DYbYisdsSYFvrpWyY+uY8C9G6tUcyle Zc27OpA7jwC3oUnSjtEqJP1/Vs8cjmp57M804JVrUNt140wWAIH293btd/8otWZ3b1VQ lBAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777401435; x=1778006235; 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=rEpxSS5AT7sZwZhISlQ7XtXed3JthTvzY7OBT2Phvm0=; b=lYb1jOJ0jDvVmg2Y4nlsMWUI9n/jxNbCKKj+kIH6MbHqCbmsgdBnCtLhQU//Qzcj7i 9myOlCsRJSehDYB0dE2YR3fVNCmgcBUsSLpA7hpTEoj9TZTh7BzCjZ7t3zoPe9pt/JDD +0E5oUvnTjOcrvMlF3j7fOeX70RGx3ngLV+0c3cSe5ekb8SOqQWAu/stI+rIQW2AXukE 4IcljmbLpJQ446LggyAB21esW3teAQy+CTs5Nd4chHVD34zkNN9xsIKRhHAVJgqXalxF lBl6nuMFd50lqi9HusQ9q/+WvFihnjnVUbtKQWig1pK7k1QYiaVbtwL0w9Daabt83xgU EknA== X-Forwarded-Encrypted: i=1; AFNElJ+PwmhlwuhmDYH/NYap6JH6FEx9G78LQxwJKiBCBxvsYaN/hCxhU7ZwGttqW8wxyaG08erF+PoLSFWuyJ4=@vger.kernel.org X-Gm-Message-State: AOJu0YwA26EXmMZl7tNLg4vnZnf3qZLDJQ+q0SeLXQ/1dbiXKpBuDtc8 8r2K5SCiteiCf5NgHC3AdrdDLXoen1bN8/RzFbA6ke7eomdS4KkmCScE4OyyEhp+vbqRyhzHdjJ Vs2lSpDrY29b+tmU2/psQW7a04g== X-Received: from pfuw1.prod.google.com ([2002:a05:6a00:14c1:b0:82f:a366:f295]) (user=dylanbhatch job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a21:6d89:b0:3a2:ebc1:4620 with SMTP id adf61e73a8af0-3a39c33cdeemr5030967637.38.1777401434645; Tue, 28 Apr 2026 11:37:14 -0700 (PDT) Date: Tue, 28 Apr 2026 18:36:38 +0000 In-Reply-To: <20260428183643.3796063-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: <20260428183643.3796063-1-dylanbhatch@google.com> X-Mailer: git-send-email 2.54.0.545.g6539524ca2-goog Message-ID: <20260428183643.3796063-4-dylanbhatch@google.com> Subject: [PATCH v5 3/8] arm64: entry: add unwind info for various kernel entries From: Dylan Hatch To: Roman Gushchin , Weinan Liu , Will Deacon , Josh Poimboeuf , Indu Bhagat , Peter Zijlstra , Steven Rostedt , Catalin Marinas , Jiri Kosina , Jens Remus Cc: Dylan Hatch , Mark Rutland , 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 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. Annotate minimal CFI to enable stacktracing using SFrame for kernel exception entries through el1*_64_*() paths and irq entries through call_on_irq_stack() Signed-off-by: Weinan Liu Suggested-by: Jens Remus Reviewed-by: Jens Remus Signed-off-by: Dylan Hatch --- arch/arm64/kernel/entry.S | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index f8018b5c1f9a..dc55b0b19cfa 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 @@ -575,7 +581,16 @@ SYM_CODE_START_LOCAL(el\el\ht\()_\regsize\()_\label) .if \el == 0 b ret_to_user .else + /* + * Minimal DWARF CFI for unwinding across the call above. + * Enable unwinding for el1*_64_*() path only. + */ + .cfi_startproc + .cfi_def_cfa_offset PT_REGS_SIZE + .cfi_offset 29, S_FP - PT_REGS_SIZE + .cfi_offset 30, S_LR - PT_REGS_SIZE b ret_to_kernel + .cfi_endproc .endif SYM_CODE_END(el\el\ht\()_\regsize\()_\label) .endm @@ -872,6 +887,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 @@ -882,6 +898,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 @@ -897,9 +916,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.545.g6539524ca2-goog