[PATCH v5 0/5] glibc: Add SFrame support for stack backtracing

claudiu.zissulescu-ianculescu@oracle.com claudiu.zissulescu-ianculescu@oracle.com
Thu May 29 07:06:53 GMT 2025


From: Claudiu Zissulescu <claudiu.zissulescu-ianculescu@oracle.com>

Hello Indu, Jens,

Please find a new patch series for glibc sframe support.

This is off glibc list and its intent is to spot anything wrong before
send it to the official list in order to maximize its chances to be
accepted by the glibc maintainers asap.

What is new:
 - 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


Older comments:
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.

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                 | 582 ++++++++++++++++++
 sysdeps/generic/sframe-read.h                 | 106 ++++
 sysdeps/generic/sframe.c                      | 186 ++++++
 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, 1745 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

-- 
2.49.0



More information about the Libc-alpha mailing list