[PATCH v5 5/8] sframe: Allow unsorted FDEs

Jens Remus jremus at linux.ibm.com
Thu Apr 30 03:04:07 PDT 2026


On 4/28/2026 8:36 PM, Dylan Hatch wrote:
> The .sframe in kernel modules is built without SFRAME_F_FDE_SORTED set.
> In order to allow sframe PC lookup in modules, add a code path to handle
> unsorted FDE tables by doing a simple linear search.
> 
> Reviewed-by: Jens Remus <jremus at linux.ibm.com>
> Signed-off-by: Dylan Hatch <dylanbhatch at google.com>

Indu suggested that it would be preferable if a module's .sframe FDE
index table could be sorted during loading of the module to enable
binary search instead of having to resort to linear search.  I propose
to drop everything from this patch except for the following, squash
it into the following patch that adds sframe support for modules, and
extend that to sort the .sframe FDE index table.  See my separate
feedback to that patch.

> diff --git a/include/linux/sframe.h b/include/linux/sframe.h

> @@ -28,6 +28,7 @@ struct sframe_section {
>  	unsigned long		fres_start;
>  	unsigned long		fres_end;
>  	unsigned int		num_fdes;
> +	bool			fdes_sorted;
>  
>  	signed char		ra_off;
>  	signed char		fp_off;

> diff --git a/kernel/unwind/sframe.c b/kernel/unwind/sframe.c

> @@ -736,7 +771,6 @@ static int sframe_read_header(struct sframe_section *sec)
>  
>  	if (shdr.preamble.magic != SFRAME_MAGIC ||
>  	    shdr.preamble.version != SFRAME_VERSION_3 ||
> -	    !(shdr.preamble.flags & SFRAME_F_FDE_SORTED) ||
>  	    !(shdr.preamble.flags & SFRAME_F_FDE_FUNC_START_PCREL) ||
>  	    shdr.auxhdr_len) {
>  		dbg_sec("bad/unsupported sframe header\n");
> @@ -766,6 +800,7 @@ static int sframe_read_header(struct sframe_section *sec)
>  		return -EINVAL;
>  	}
>  
> +	sec->fdes_sorted	= shdr.preamble.flags & SFRAME_F_FDE_SORTED;
>  	sec->num_fdes		= num_fdes;
>  	sec->fdes_start		= fdes_start;
>  	sec->fres_start		= fres_start;

Regards,
Jens
-- 
Jens Remus
Linux on Z Development (D3303)
jremus at de.ibm.com / jremus at linux.ibm.com

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/




More information about the linux-arm-kernel mailing list