[2.34] debug: Mark libSegFault.so as NODELETE

Message ID 87cz0mmsn0.fsf@oldenburg.str.redhat.com
State Not applicable
Headers
Series [2.34] debug: Mark libSegFault.so as NODELETE |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch fail Patch failed to apply to master at the time it was sent
redhat-pt-bot/TryBot-32bit fail Patch series failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-arm warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_check--master-arm warning Patch failed to apply
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 warning Patch failed to apply

Commit Message

Florian Weimer July 20, 2023, 4:53 p.m. UTC
  The signal handler installed in the ELF constructor cannot easily
be removed again (because the program may have changed handlers
in the meantime).  Mark the object as NODELETE so that the registered
handler function is never unloaded.

Submitting this for 2.34 because libSegFault.so was removed in 2.35.
Verified using readelf -dW that NODELETE is now set on libSegFault.so.
(Note that there is no lib prefix on the LDFLAGS variable.)

---
 debug/Makefile | 2 ++
 1 file changed, 2 insertions(+)


base-commit: cad3adf4ddeada37912c1c13b59a2ea5dd5d2832
  

Comments

Carlos O'Donell July 21, 2023, 2:33 p.m. UTC | #1
On 7/20/23 12:53, Florian Weimer via Libc-stable wrote:
> The signal handler installed in the ELF constructor cannot easily
> be removed again (because the program may have changed handlers
> in the meantime).  Mark the object as NODELETE so that the registered
> handler function is never unloaded.

Agreed. This is a safe default to take given the usage of this DSO.

LGTM for backport into all stables branches with libSegFault.so.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> Submitting this for 2.34 because libSegFault.so was removed in 2.35.
> Verified using readelf -dW that NODELETE is now set on libSegFault.so.
> (Note that there is no lib prefix on the LDFLAGS variable.)
> 
> ---
>  debug/Makefile | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/debug/Makefile b/debug/Makefile
> index 71248e0d45..9fbc40dc69 100644
> --- a/debug/Makefile
> +++ b/debug/Makefile
> @@ -213,6 +213,8 @@ extra-libs-others = $(extra-libs)
>  
>  libSegFault-routines = segfault
>  libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
> +# libSegFault.so installs a signal handler in its ELF constructor.
> +LDFLAGS-SegFault.so = -Wl,--enable-new-dtags,-z,nodelete
>  
>  libpcprofile-routines = pcprofile
>  libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))
> 
> base-commit: cad3adf4ddeada37912c1c13b59a2ea5dd5d2832
>
  

Patch

diff --git a/debug/Makefile b/debug/Makefile
index 71248e0d45..9fbc40dc69 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -213,6 +213,8 @@  extra-libs-others = $(extra-libs)
 
 libSegFault-routines = segfault
 libSegFault-inhibit-o = $(filter-out .os,$(object-suffixes))
+# libSegFault.so installs a signal handler in its ELF constructor.
+LDFLAGS-SegFault.so = -Wl,--enable-new-dtags,-z,nodelete
 
 libpcprofile-routines = pcprofile
 libpcprofile-inhibit-o = $(filter-out .os,$(object-suffixes))