[PATCH v6 0/5] glibc: Add SFrame support for stack backtracing
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Jul 2 12:55:09 GMT 2025
On 10/06/25 04:33, claudiu.zissulescu-ianculescu@oracle.com wrote:
> From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>
>
> Hello,
>
> Please find a new update of glibc SFrame stack backtracer support.
>
> What is new:
> - Update SFrame stack backtracer to the latest developments present on binutils.
> - all SFrame stack backtracer errors will trigger Dwarf unwinder.
>
> Older comments:
> - Fix Bigendian handling in 32b systems.
> - Added a new target dependent hook to detect the outermost frame.
> - The SFrame backtracer is falling back to Dwarf unwinder if it
> detects any posibility of a truncate trace.
> - Various typo/text fixes
>
> ABI impact notes:
> * Changes in 'struct dl_find_object'
> - A new member 'void *dlfo_sframe' is inserted to the structure.
>
> - The member '__dlfo_reserved' is changed, removing one element, which
> is a decrease of 64bits.
>
> - The size of the type has not changed, as the new added field (i.e.,
> dlfo_sframe) size is of the same size as of the one element removed
> from struct memeber __dlfo_reserved. For 32bit systems, a padding is
> added to compensate for pointer size change.
>
> - A new macro DLF_SFRAME is introduced. It helps controlling the
> newly introduced flag bit in dlfo_flags member. This may implies
> changing specific ABI tests (e.g. glibc: update
> conform/data/dlfcn.h-data file)
>
> - The function 'dl_find_object' is called within libc' backtrace
> routine using GLRO macro, thus avoinding any PLT calls.
>
> * Possible issues
> - Automatic ABI checkers may mark this change as an ABI change, thus,
> human review and updating of the scripts is required.
>
> - For unknown programs which directly access the '__dlfo_reserved'
> field, this change is incompatible. As note, this field should not
> be used by anyone as it is reserved for further changes of the
> dl_find_object structure.
>
> Other changes and observations:
>
> - The getPC and getSP helper functions are moved to sframe.c file as
> they may require machine dependent changes like for s390.
>
> - The dlfo_sframe member is always present.
>
> - The dlfo_flags member is used, bit 0 signalize the presence of
> sframe information.
>
> - Update sframe_fre_get_cfa_offset and sframe_fre_get_ra_offset
> functions to set an error pointer if return offset is unavailable.
>
> - Updated NEWS file, and other documents.
>
> - Cleanup Aarch64 specific function.
>
> - Compiling the x86 tst-quadmod1.S test file with --gsframe will hit
> binutils' assembler Bug #32879.
>
> - Fixed 32bit compilation issues.
It is not clear to me how this was tested, since there is no regression
tests. Is it because with --enable-sframe the -Wa,--gsframe will be
used by default for all tests and thus the backtrace ones will use
SFRAME?
If it were the case I think we will need to add tests on backtrace for
*both* cases, by disabling -Wa,--gsframe on some and adding
-Wa,--gsframe on another to get full coverage independent whether
--enable-sframe is used.
>
> Thank you,
> Claudiu
>
> Claudiu Zissulescu (5):
> elf: Add SFrame support to _dl_find_object function
> x86: Add SFrame support for x86 architecture
> aarch64: Add SFrame support for aarch64 architecture
> elf: Add SFrame stack tracing
> configure: Add --enable-sframe option
>
> INSTALL | 5 +
> Makeconfig | 8 +-
> NEWS | 4 +
> bits/dl_find_object.h | 3 +
> config.make.in | 1 +
> configure | 129 ++++
> configure.ac | 44 ++
> conform/data/dlfcn.h-data | 3 +
> debug/backtrace.c | 33 +-
> dlfcn/dlfcn.h | 7 +-
> elf/dl-find_object.h | 80 ++-
> manual/dynlink.texi | 25 +-
> manual/install.texi | 5 +
> sysdeps/arm/bits/dl_find_object.h | 1 +
> sysdeps/generic/Makefile | 1 +
> sysdeps/generic/sframe-read.c | 567 ++++++++++++++++++
> sysdeps/generic/sframe-read.h | 106 ++++
> sysdeps/generic/sframe.c | 187 ++++++
> sysdeps/generic/sframe.h | 367 ++++++++++++
> sysdeps/generic/uw-sigframe.h | 17 +
> sysdeps/unix/sysv/linux/aarch64/uw-sigframe.h | 75 +++
> sysdeps/unix/sysv/linux/x86/uw-sigframe.h | 74 +++
> sysdeps/x86/bits/dl_find_object.h | 1 +
> 23 files changed, 1731 insertions(+), 12 deletions(-)
> create mode 100644 sysdeps/generic/sframe-read.c
> create mode 100644 sysdeps/generic/sframe-read.h
> create mode 100644 sysdeps/generic/sframe.c
> create mode 100644 sysdeps/generic/sframe.h
> create mode 100644 sysdeps/generic/uw-sigframe.h
> create mode 100644 sysdeps/unix/sysv/linux/aarch64/uw-sigframe.h
> create mode 100644 sysdeps/unix/sysv/linux/x86/uw-sigframe.h
>
More information about the Libc-alpha
mailing list