mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dylan Hatch <dylanbhatch@google.com>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	 Mark Rutland <mark.rutland@arm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S . Miller" <davem@davemloft.net>,
	 Nathan Chancellor <nathan@kernel.org>,
	Nicolas Schier <nsc@kernel.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	 Justin Stitt <justinstitt@google.com>,
	Weinan Liu <wnliu@google.com>,  Jens Remus <jremus@linux.ibm.com>,
	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 <jpoimboe@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	 Ard Biesheuvel <ardb@kernel.org>,
	Indu Bhagat <ibhagatgnu@gmail.com>,
	 Prasanna Kumar T S M <ptsm@linux.microsoft.com>,
	live-patching@vger.kernel.org,
	 Dylan Hatch <dylanbhatch@google.com>
Subject: [RFC PATCH 02/12] arm64: factor .eh_frame parser out of patch-scs.c into <asm/eh_frame.h>
Date: Tue, 17 Nov 2026 04:34:54 +0000	[thread overview]
Message-ID: <20261117043504.1021063-3-dylanbhatch@google.com> (raw)
In-Reply-To: <20261117043504.1021063-1-dylanbhatch@google.com>

Move the DWARF .eh_frame CIE/FDE iterator and opcode stepper out of
arch/arm64/kernel/pi/patch-scs.c into a shared <asm/eh_frame.h> header
so it can be reused by build-time unwind table generation.

Signed-off-by: Dylan Hatch <dylanbhatch@google.com>
---
 arch/arm64/include/asm/eh_frame.h | 329 ++++++++++++++++++++++++++++++
 arch/arm64/include/asm/scs.h      |   7 -
 arch/arm64/kernel/pi/patch-scs.c  | 258 +++--------------------
 3 files changed, 358 insertions(+), 236 deletions(-)
 create mode 100644 arch/arm64/include/asm/eh_frame.h

diff --git a/arch/arm64/include/asm/eh_frame.h b/arch/arm64/include/asm/eh_frame.h
new file mode 100644
index 0000000000000..6c17fed1860f1
--- /dev/null
+++ b/arch/arm64/include/asm/eh_frame.h
@@ -0,0 +1,329 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Minimal DWARF .eh_frame CFI parser for arm64.
+ *
+ * This minimal DWARF CFI parser is partially based on the code in
+ * arch/arc/kernel/unwind.c, and on the document below:
+ * https://refspecs.linuxbase.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
+ */
+#ifndef __ASM_EH_FRAME_H
+#define __ASM_EH_FRAME_H
+
+#include <linux/bits.h>
+#include <linux/compiler.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+
+#ifndef U32_MAX
+#define U32_MAX				((u32)~0U)
+#endif
+
+#define AARCH64_DWARF_LR		30
+
+#define DW_CFA_nop			0x00
+#define DW_CFA_advance_loc1		0x02
+#define DW_CFA_advance_loc2		0x03
+#define DW_CFA_advance_loc4		0x04
+#define DW_CFA_offset_extended		0x05
+#define DW_CFA_restore_extended		0x06
+#define DW_CFA_same_value		0x08
+#define DW_CFA_remember_state		0x0a
+#define DW_CFA_restore_state		0x0b
+#define DW_CFA_def_cfa			0x0c
+#define DW_CFA_def_cfa_register		0x0d
+#define DW_CFA_def_cfa_offset		0x0e
+#define DW_CFA_def_cfa_offset_sf	0x13
+#define DW_CFA_negate_ra_state		0x2d
+
+#define DW_EH_PE_sdata4			0x0b
+#define DW_EH_PE_sdata8			0x0c
+#define DW_EH_PE_pcrel			0x10
+
+enum {
+	EDYNSCS_INVALID_CIE_HEADER		= 1,
+	EDYNSCS_INVALID_CIE_SDATA_SIZE		= 2,
+	EDYNSCS_INVALID_FDE_AUGM_DATA_SIZE	= 3,
+	EDYNSCS_INVALID_CFA_OPCODE		= 4,
+};
+
+struct eh_frame_cfi_state {
+	u64	loc;
+	bool	ra_negated;
+};
+
+struct eh_frame {
+	/*
+	 * The size of this frame if 0 < size < U32_MAX, 0 terminates the list.
+	 */
+	u32	size;
+
+	/*
+	 * The first frame is a Common Information Entry (CIE) frame, followed
+	 * by one or more Frame Description Entry (FDE) frames. In the former
+	 * case, this field is 0, otherwise it is the negated offset relative
+	 * to the associated CIE frame.
+	 */
+	u32	cie_id_or_pointer;
+
+	union {
+		struct { /* CIE */
+			u8	version;
+			char	augmentation_string[3];
+			u8	code_alignment_factor;
+			u8	data_alignment_factor;
+			u8	return_address_register;
+			u8	augmentation_data_size;
+			u8	fde_pointer_format;
+		};
+
+		struct { /* FDE (sdata4) */
+			s32	initial_loc;
+			s32	range;
+			u8	opcodes[];
+		};
+
+		struct { /* FDE (sdata8) */
+			s64	initial_loc64;
+			s64	range64;
+			u8	opcodes64[];
+		};
+	};
+};
+
+struct eh_frame_fde_iter {
+	const u8		*start;
+	const u8		*p;
+	int			size;
+	int			code_align;
+	bool			use_sdata8;
+	const struct eh_frame	*cie;
+	const struct eh_frame	*fde;
+};
+
+#define EH_FRAME_FDE_ITER_INIT(buf, len) \
+	{ .start = (buf), .p = (buf), .size = (len), .code_align = 1 }
+
+/*
+ * Skip one uleb128/sleb128 encoded quantity from the opcode stream. All bytes
+ * except the last one have bit #7 set.
+ */
+static __always_inline int skip_xleb128(const u8 **opcode, int *size)
+{
+	u8 c;
+
+	do {
+		if (*size <= 0)
+			return EDYNSCS_INVALID_CFA_OPCODE;
+		c = *(*opcode)++;
+		(*size)--;
+	} while (c & BIT(7));
+
+	return 0;
+}
+
+static __always_inline int eh_frame_step_opcode(const u8 **opcode, int *size,
+						const struct eh_frame_fde_iter *it,
+						struct eh_frame_cfi_state *st)
+{
+	u8 op;
+
+	if (*size <= 0)
+		return EDYNSCS_INVALID_CFA_OPCODE;
+
+	op = *(*opcode)++;
+	(*size)--;
+	st->ra_negated = false;
+
+	switch (op) {
+	case DW_CFA_nop:
+	case DW_CFA_remember_state:
+	case DW_CFA_restore_state:
+		break;
+
+	case DW_CFA_advance_loc1:
+		if (*size < 1)
+			return EDYNSCS_INVALID_CFA_OPCODE;
+		st->loc += *(*opcode)++ * it->code_align;
+		(*size)--;
+		break;
+
+	case DW_CFA_advance_loc2:
+		if (*size < 2)
+			return EDYNSCS_INVALID_CFA_OPCODE;
+		st->loc += ((*opcode)[0] | ((*opcode)[1] << 8)) *
+			   it->code_align;
+		*opcode += 2;
+		*size -= 2;
+		break;
+
+	case DW_CFA_advance_loc4:
+		if (*size < 4)
+			return EDYNSCS_INVALID_CFA_OPCODE;
+		st->loc += (u64)((*opcode)[0] | ((*opcode)[1] << 8) |
+				 ((*opcode)[2] << 16) |
+				 ((u32)(*opcode)[3] << 24)) *
+			   it->code_align;
+		*opcode += 4;
+		*size -= 4;
+		break;
+
+	case DW_CFA_def_cfa:
+	case DW_CFA_offset_extended:
+		if (skip_xleb128(opcode, size))
+			return EDYNSCS_INVALID_CFA_OPCODE;
+		fallthrough;
+	case DW_CFA_def_cfa_offset:
+	case DW_CFA_def_cfa_offset_sf:
+	case DW_CFA_def_cfa_register:
+	case DW_CFA_same_value:
+	case DW_CFA_restore_extended:
+	case 0x80 ... 0xbf: /* DW_CFA_offset */
+		if (skip_xleb128(opcode, size))
+			return EDYNSCS_INVALID_CFA_OPCODE;
+		break;
+
+	case DW_CFA_negate_ra_state:
+		st->ra_negated = true;
+		break;
+
+	case 0x40 ... 0x7f: /* DW_CFA_advance_loc (delta in low 6 bits) */
+		st->loc += (op & 0x3f) * it->code_align;
+		break;
+
+	case 0xc0 ... 0xff: /* DW_CFA_restore (reg in low 6 bits) */
+		break;
+
+	default:
+		return EDYNSCS_INVALID_CFA_OPCODE;
+	}
+
+	return 0;
+}
+
+static __always_inline int eh_frame_parse_cie(const struct eh_frame *frame,
+					      struct eh_frame_fde_iter *it)
+{
+	if (sizeof(frame->size) + frame->size < sizeof(*frame))
+		return EDYNSCS_INVALID_CIE_HEADER;
+
+	/*
+	 * Require presence of augmentation data (z) with a specifier for the
+	 * size of the FDE initial_loc and range fields (R), and nothing else.
+	 */
+	if (memcmp(frame->augmentation_string, "zR", 3))
+		return EDYNSCS_INVALID_CIE_HEADER;
+
+	/*
+	 * Require single-byte uleb128/sleb128 alignment factors, LR as the
+	 * return address register, and a 1-byte augmentation payload.
+	 */
+	if ((frame->code_alignment_factor & BIT(7)) ||
+	    (frame->data_alignment_factor & BIT(7)) ||
+	    frame->return_address_register != AARCH64_DWARF_LR ||
+	    frame->augmentation_data_size != 1)
+		return EDYNSCS_INVALID_CIE_HEADER;
+
+	it->code_align = frame->code_alignment_factor;
+
+	switch (frame->fde_pointer_format) {
+	case DW_EH_PE_pcrel | DW_EH_PE_sdata4:
+		it->use_sdata8 = false;
+		break;
+	case DW_EH_PE_pcrel | DW_EH_PE_sdata8:
+		it->use_sdata8 = true;
+		break;
+	default:
+		return EDYNSCS_INVALID_CIE_SDATA_SIZE;
+	}
+
+	it->cie = frame;
+	return 0;
+}
+
+static __always_inline int eh_frame_next_fde(struct eh_frame_fde_iter *it)
+{
+	while (it->size > 4) {
+		const struct eh_frame *frame = (const void *)it->p;
+		const struct eh_frame *cie;
+		const u8 *cie_ptr;
+		size_t min_size;
+		int step, ret;
+
+		if (frame->size == 0 || frame->size == U32_MAX ||
+		    frame->size > (u32)(it->size - sizeof(frame->size)))
+			break;
+
+		if (frame->size < sizeof(frame->cie_id_or_pointer))
+			return EDYNSCS_INVALID_CIE_HEADER;
+
+		step = sizeof(frame->size) + frame->size;
+		it->p += step;
+		it->size -= step;
+
+		if (frame->cie_id_or_pointer == 0) {
+			ret = eh_frame_parse_cie(frame, it);
+			if (ret)
+				return ret;
+			continue;
+		}
+
+		cie_ptr = (const u8 *)&frame->cie_id_or_pointer;
+		if (frame->cie_id_or_pointer > (u32)(cie_ptr - it->start))
+			return EDYNSCS_INVALID_CIE_HEADER;
+
+		cie = (const void *)(cie_ptr - frame->cie_id_or_pointer);
+		if (cie != it->cie) {
+			if (cie->cie_id_or_pointer != 0 ||
+			    cie->size == 0 || cie->size == U32_MAX ||
+			    cie->size > (u32)(cie_ptr - (const u8 *)cie -
+					      sizeof(cie->size)))
+				return EDYNSCS_INVALID_CIE_HEADER;
+			ret = eh_frame_parse_cie(cie, it);
+			if (ret)
+				return ret;
+		}
+
+		min_size = it->use_sdata8 ?
+			   offsetof(struct eh_frame, opcodes64) :
+			   offsetof(struct eh_frame, opcodes);
+		if ((size_t)step < min_size)
+			return EDYNSCS_INVALID_FDE_AUGM_DATA_SIZE;
+
+		it->fde = frame;
+		return 0;
+	}
+
+	it->fde = NULL;
+	return 0;
+}
+
+static __always_inline int eh_frame_fde_opcodes(const struct eh_frame *frame,
+						bool use_sdata8,
+						const u8 **opcode_out,
+						int *size_out)
+{
+	size_t hdr_size = use_sdata8 ?
+			  offsetof(struct eh_frame, opcodes64) :
+			  offsetof(struct eh_frame, opcodes);
+	size_t total = sizeof(frame->size) + frame->size;
+	const u8 *opcode = use_sdata8 ? frame->opcodes64 : frame->opcodes;
+	int size, l;
+
+	if (total < hdr_size + 1 || (*opcode & BIT(7)))
+		return EDYNSCS_INVALID_FDE_AUGM_DATA_SIZE;
+
+	size = (int)(total - hdr_size);
+	l = *opcode++;
+	if (l > size - 1)
+		return EDYNSCS_INVALID_FDE_AUGM_DATA_SIZE;
+
+	opcode += l;
+	size -= l + 1;
+
+	*opcode_out = opcode;
+	*size_out = size;
+	return 0;
+}
+
+#endif /* __ASM_EH_FRAME_H */
diff --git a/arch/arm64/include/asm/scs.h b/arch/arm64/include/asm/scs.h
index a15a2968e7b66..f49fc27a8a9b2 100644
--- a/arch/arm64/include/asm/scs.h
+++ b/arch/arm64/include/asm/scs.h
@@ -54,13 +54,6 @@ static inline void dynamic_scs_init(void)
 static inline void dynamic_scs_init(void) {}
 #endif
 
-enum {
-	EDYNSCS_INVALID_CIE_HEADER		= 1,
-	EDYNSCS_INVALID_CIE_SDATA_SIZE		= 2,
-	EDYNSCS_INVALID_FDE_AUGM_DATA_SIZE	= 3,
-	EDYNSCS_INVALID_CFA_OPCODE		= 4,
-};
-
 int __pi_scs_patch(const u8 eh_frame[], int size, bool skip_dry_run);
 
 #endif /* __ASSEMBLER__ */
diff --git a/arch/arm64/kernel/pi/patch-scs.c b/arch/arm64/kernel/pi/patch-scs.c
index 3944ad899021c..b240144f7d80e 100644
--- a/arch/arm64/kernel/pi/patch-scs.c
+++ b/arch/arm64/kernel/pi/patch-scs.c
@@ -9,51 +9,13 @@
 #include <linux/linkage.h>
 #include <linux/types.h>
 
+#include <asm/eh_frame.h>
 #include <asm/scs.h>
 
 #include "pi.h"
 
 bool dynamic_scs_is_enabled;
 
-//
-// This minimal DWARF CFI parser is partially based on the code in
-// arch/arc/kernel/unwind.c, and on the document below:
-// https://refspecs.linuxbase.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
-//
-
-#define DW_CFA_nop                          0x00
-#define DW_CFA_set_loc                      0x01
-#define DW_CFA_advance_loc1                 0x02
-#define DW_CFA_advance_loc2                 0x03
-#define DW_CFA_advance_loc4                 0x04
-#define DW_CFA_offset_extended              0x05
-#define DW_CFA_restore_extended             0x06
-#define DW_CFA_undefined                    0x07
-#define DW_CFA_same_value                   0x08
-#define DW_CFA_register                     0x09
-#define DW_CFA_remember_state               0x0a
-#define DW_CFA_restore_state                0x0b
-#define DW_CFA_def_cfa                      0x0c
-#define DW_CFA_def_cfa_register             0x0d
-#define DW_CFA_def_cfa_offset               0x0e
-#define DW_CFA_def_cfa_expression           0x0f
-#define DW_CFA_expression                   0x10
-#define DW_CFA_offset_extended_sf           0x11
-#define DW_CFA_def_cfa_sf                   0x12
-#define DW_CFA_def_cfa_offset_sf            0x13
-#define DW_CFA_val_offset                   0x14
-#define DW_CFA_val_offset_sf                0x15
-#define DW_CFA_val_expression               0x16
-#define DW_CFA_lo_user                      0x1c
-#define DW_CFA_negate_ra_state              0x2d
-#define DW_CFA_GNU_args_size                0x2e
-#define DW_CFA_GNU_negative_offset_extended 0x2f
-#define DW_CFA_hi_user                      0x3f
-
-#define DW_EH_PE_sdata4                     0x0b
-#define DW_EH_PE_sdata8                     0x0c
-#define DW_EH_PE_pcrel                      0x10
-
 enum {
 	PACIASP		= 0xd503233f,
 	AUTIASP		= 0xd50323bf,
@@ -61,7 +23,7 @@ enum {
 	SCS_POP		= 0xf85f8e5e,
 };
 
-static void __always_inline scs_patch_loc(u64 loc)
+static __always_inline void scs_patch_loc(u64 loc)
 {
 	u32 insn = le32_to_cpup((void *)loc);
 
@@ -91,211 +53,49 @@ static void __always_inline scs_patch_loc(u64 loc)
 		    :: "r"(loc));
 }
 
-/*
- * Skip one uleb128/sleb128 encoded quantity from the opcode stream. All bytes
- * except the last one have bit #7 set.
- */
-static int __always_inline skip_xleb128(const u8 **opcode, int size)
-{
-	u8 c;
-
-	do {
-		c = *(*opcode)++;
-		size--;
-	} while (c & BIT(7));
-
-	return size;
-}
-
-struct eh_frame {
-	/*
-	 * The size of this frame if 0 < size < U32_MAX, 0 terminates the list.
-	 */
-	u32	size;
-
-	/*
-	 * The first frame is a Common Information Entry (CIE) frame, followed
-	 * by one or more Frame Description Entry (FDE) frames. In the former
-	 * case, this field is 0, otherwise it is the negated offset relative
-	 * to the associated CIE frame.
-	 */
-	u32	cie_id_or_pointer;
-
-	union {
-		struct { // CIE
-			u8	version;
-			u8	augmentation_string[3];
-			u8	code_alignment_factor;
-			u8	data_alignment_factor;
-			u8	return_address_register;
-			u8	augmentation_data_size;
-			u8	fde_pointer_format;
-		};
-
-		struct { // FDE
-			s32	initial_loc;
-			s32	range;
-			u8	opcodes[];
-		};
-
-		struct { // FDE
-			s64	initial_loc64;
-			s64	range64;
-			u8	opcodes64[];
-		};
-	};
-};
-
-static int scs_handle_fde_frame(const struct eh_frame *frame,
-				int code_alignment_factor,
-				bool use_sdata8,
+static int scs_handle_fde_frame(const struct eh_frame_fde_iter *it,
 				bool dry_run)
 {
-	int size = frame->size - offsetof(struct eh_frame, opcodes) + 4;
-	u64 loc = (u64)offset_to_ptr(&frame->initial_loc);
-	const u8 *opcode = frame->opcodes;
-	int l;
-
-	if (use_sdata8) {
-		loc = (u64)&frame->initial_loc64 + frame->initial_loc64;
-		opcode = frame->opcodes64;
-		size -= 8;
-	}
-
-	// assume single byte uleb128_t for augmentation data size
-	if (*opcode & BIT(7))
-		return EDYNSCS_INVALID_FDE_AUGM_DATA_SIZE;
+	const struct eh_frame *frame = it->fde;
+	struct eh_frame_cfi_state st = {
+		.loc = it->use_sdata8 ?
+		       (u64)&frame->initial_loc64 + frame->initial_loc64 :
+		       (u64)offset_to_ptr(&frame->initial_loc),
+	};
+	const u8 *opcode;
+	int size, ret;
 
-	l = *opcode++;
-	opcode += l;
-	size -= l + 1;
+	ret = eh_frame_fde_opcodes(frame, it->use_sdata8, &opcode, &size);
+	if (ret)
+		return ret;
 
 	/*
 	 * Starting from 'loc', apply the CFA opcodes that advance the location
 	 * pointer, and identify the locations of the PAC instructions.
 	 */
-	while (size-- > 0) {
-		switch (*opcode++) {
-		case DW_CFA_nop:
-		case DW_CFA_remember_state:
-		case DW_CFA_restore_state:
-			break;
-
-		case DW_CFA_advance_loc1:
-			loc += *opcode++ * code_alignment_factor;
-			size--;
-			break;
-
-		case DW_CFA_advance_loc2:
-			loc += *opcode++ * code_alignment_factor;
-			loc += (*opcode++ << 8) * code_alignment_factor;
-			size -= 2;
-			break;
-
-		case DW_CFA_advance_loc4:
-			loc += *opcode++ * code_alignment_factor;
-			loc += (*opcode++ << 8) * code_alignment_factor;
-			loc += (*opcode++ << 16) * code_alignment_factor;
-			loc += ((u64)*opcode++ << 24) * code_alignment_factor;
-			size -= 4;
-			break;
-
-		case DW_CFA_def_cfa:
-		case DW_CFA_offset_extended:
-			size = skip_xleb128(&opcode, size);
-			fallthrough;
-		case DW_CFA_def_cfa_offset:
-		case DW_CFA_def_cfa_offset_sf:
-		case DW_CFA_def_cfa_register:
-		case DW_CFA_same_value:
-		case DW_CFA_restore_extended:
-		case 0x80 ... 0xbf:
-			size = skip_xleb128(&opcode, size);
-			break;
-
-		case DW_CFA_negate_ra_state:
-			if (!dry_run)
-				scs_patch_loc(loc - 4);
-			break;
+	while (size > 0) {
+		ret = eh_frame_step_opcode(&opcode, &size, it, &st);
+		if (ret)
+			return ret;
 
-		case 0x40 ... 0x7f:
-			// advance loc
-			loc += (opcode[-1] & 0x3f) * code_alignment_factor;
-			break;
-
-		case 0xc0 ... 0xff:
-			break;
-
-		default:
-			return EDYNSCS_INVALID_CFA_OPCODE;
-		}
+		if (st.ra_negated && !dry_run)
+			scs_patch_loc(st.loc - 4);
 	}
 	return 0;
 }
 
 int scs_patch(const u8 eh_frame[], int size, bool skip_dry_run)
 {
-	int code_alignment_factor = 1;
-	bool fde_use_sdata8 = false;
-	const u8 *p = eh_frame;
-
-	while (size > 4) {
-		const struct eh_frame *frame = (const void *)p;
-		int ret;
-
-		if (frame->size == 0 ||
-		    frame->size == U32_MAX ||
-		    frame->size > size)
-			break;
-
-		if (frame->cie_id_or_pointer == 0) {
-			/*
-			 * Require presence of augmentation data (z) with a
-			 * specifier for the size of the FDE initial_loc and
-			 * range fields (R), and nothing else.
-			 */
-			if (strcmp(frame->augmentation_string, "zR"))
-				return EDYNSCS_INVALID_CIE_HEADER;
+	struct eh_frame_fde_iter it = EH_FRAME_FDE_ITER_INIT(eh_frame, size);
+	int ret;
 
-			/*
-			 * The code alignment factor is a uleb128 encoded field
-			 * but given that the only sensible values are 1 or 4,
-			 * there is no point in decoding the whole thing.  Also
-			 * sanity check the size of the data alignment factor
-			 * field, and the values of the return address register
-			 * and augmentation data size fields.
-			 */
-			if ((frame->code_alignment_factor & BIT(7)) ||
-			    (frame->data_alignment_factor & BIT(7)) ||
-			    frame->return_address_register != 30 ||
-			    frame->augmentation_data_size != 1)
-				return EDYNSCS_INVALID_CIE_HEADER;
+	while (!(ret = eh_frame_next_fde(&it)) && it.fde) {
+		ret = scs_handle_fde_frame(&it, !skip_dry_run);
+		if (ret)
+			return ret;
 
-			code_alignment_factor = frame->code_alignment_factor;
-
-			switch (frame->fde_pointer_format) {
-			case DW_EH_PE_pcrel | DW_EH_PE_sdata4:
-				fde_use_sdata8 = false;
-				break;
-			case DW_EH_PE_pcrel | DW_EH_PE_sdata8:
-				fde_use_sdata8 = true;
-				break;
-			default:
-				return EDYNSCS_INVALID_CIE_SDATA_SIZE;
-			}
-		} else {
-			ret = scs_handle_fde_frame(frame, code_alignment_factor,
-						   fde_use_sdata8, !skip_dry_run);
-			if (ret)
-				return ret;
-
-			if (!skip_dry_run)
-				scs_handle_fde_frame(frame, code_alignment_factor,
-						     fde_use_sdata8, false);
-		}
-
-		p += sizeof(frame->size) + frame->size;
-		size -= sizeof(frame->size) + frame->size;
+		if (!skip_dry_run)
+			scs_handle_fde_frame(&it, false);
 	}
-	return 0;
+	return ret;
 }
-- 
2.56.0.679.gc527c65306-goog


  parent reply	other threads:[~2026-11-17  4:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  4:34 [RFC PATCH 00/12] arm64, unwind: add .lr_unwind unwinder for reliable stacktrace Dylan Hatch
2026-11-17  4:34 ` [RFC PATCH 01/12] arm64, unwind: build with .eh_frame and add gen_lr_unwind skeleton Dylan Hatch
2026-11-17  4:34 ` Dylan Hatch [this message]
2026-11-17  4:34 ` [RFC PATCH 03/12] arm64: eh_frame: track CFA and x29/x30 register state in CFI parser Dylan Hatch
2026-11-17  4:34 ` [RFC PATCH 04/12] arm64, unwind: parse .eh_frame into .lr_unwind entries in gen_lr_unwind Dylan Hatch
2026-11-17  4:34 ` [RFC PATCH 05/12] scripts/gen_lr_unwind: emit .lr_unwind_fde and .lr_unwind_ranges Dylan Hatch
2026-11-17  4:34 ` [RFC PATCH 06/12] scripts/gen_lr_unwind: add --dump option to inspect .lr_unwind tables Dylan Hatch
2026-11-17  4:34 ` [RFC PATCH 07/12] scripts/sorttable: sort .lr_unwind_fde by start_offset Dylan Hatch
2026-11-17  4:35 ` [RFC PATCH 08/12] arm64, unwind: add in-kernel .lr_unwind lookup and validation Dylan Hatch
2026-11-17  4:35 ` [RFC PATCH 09/12] arm64/module, unwind: add .lr_unwind support for modules Dylan Hatch
2026-11-17  4:35 ` [RFC PATCH 10/12] arm64: entry: add unwind info for call_on_irq_stack() Dylan Hatch
2026-11-17  4:35 ` [RFC PATCH 11/12] arm64, crypto/lib: annotate leaf functions with CFI info Dylan Hatch
2026-11-17  4:35 ` [RFC PATCH 12/12] unwind: arm64: use .lr_unwind to unwind interrupt frames Dylan Hatch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261117043504.1021063-3-dylanbhatch@google.com \
    --to=dylanbhatch@google.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=ibhagatgnu@gmail.com \
    --cc=jpoimboe@kernel.org \
    --cc=jremus@linux.ibm.com \
    --cc=justinstitt@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mark.rutland@arm.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nsc@kernel.org \
    --cc=ptsm@linux.microsoft.com \
    --cc=rostedt@goodmis.org \
    --cc=will@kernel.org \
    --cc=wnliu@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®