#35 Package libc_malloc_debug
Closed 2 years ago by codonell. Opened 2 years ago by siddhesh.
rpms/ siddhesh/glibc hooks  into  rawhide

Package non-core libraries into glibc-utils
Siddhesh Poyarekar • 2 years ago  
file modified
+23 -12
@@ -111,7 +111,7 @@ 

  Summary: The GNU libc libraries

  Name: glibc

  Version: %{glibcversion}

- Release: 48%{?dist}

+ Release: 49%{?dist}

  

  # In general, GPLv2+ is used by programs, LGPLv2+ is used for

  # libraries.
@@ -1431,12 +1431,21 @@ 

  touch %{glibc_sysroot}/var/{db,run}/nscd/{passwd,group,hosts,services}

  touch %{glibc_sysroot}/var/run/nscd/{socket,nscd.pid}

  

- # Move libpcprofile.so and libmemusage.so into the proper library directory.

+ # Libraries that must go into glibc-utils.

+ utils_libs="libpcprofile.so libmemusage.so libSegFault.so"

+ utils_libs="$utils_libs libc_malloc_debug.so.0"

+ all_utils_libs="$utils_libs libc_malloc_debug.so"

+ 

+ # Move non-core libraries into the proper library directory.

  # They can be moved without any real consequences because users would not use

  # them directly.

  mkdir -p %{glibc_sysroot}%{_libdir}

- mv -f %{glibc_sysroot}/%{_lib}/lib{pcprofile,memusage}.so \

- 	%{glibc_sysroot}%{_libdir}

+ mv_arg=$(echo $utils_libs | \

+ 	  sed "s,\([^ ]\+\),%{glibc_sysroot}/%{_lib}/\\1,g")

+ mv -f $mv_arg %{glibc_sysroot}%{_libdir}

+ 

+ # Update the libc_malloc_debug.so symlink after the move.

+ ln -sf ./libc_malloc_debug.so.0 %{glibc_sysroot}%{_libdir}/libc_malloc_debug.so

  

  # Strip all of the installed object files.

  strip -g %{glibc_sysroot}%{_libdir}/*.o
@@ -1500,6 +1509,9 @@ 

  # * compat-libpthread-nonshared.filelist.

  #	- File list for compat-libpthread-nonshared subpackage.

  

+ utils_libs_regex=$(echo $all_utils_libs | \

+ 		   sed 's~\([^ ]\+\)~-e ''\\,%{_libdir}/\1,d'' ~g')

+ 

  # Create the main file lists. This way we can append to any one of them later

  # wihtout having to create it. Note these are removed at the start of the

  # install phase.
@@ -1555,7 +1567,7 @@ 

        -e '\,.*/share/i18n/locales/.*,d' \

        -e '\,.*/share/i18n/charmaps/.*,d' \

        -e '\,.*/etc/\(localtime\|nsswitch.conf\|ld\.so\.conf\|ld\.so\.cache\|default\|rpc\|gai\.conf\),d' \

-       -e '\,.*/%{_libdir}/lib\(pcprofile\|memusage\)\.so,d' \

+       $utils_libs_regex \

        -e '\,.*/bin/\(memusage\|mtrace\|xtrace\|pcprofiledump\),d'

  } | sort > master.filelist

  
@@ -1608,14 +1620,12 @@ 

  

  # Add specific files:

  # - The nss_files, nss_compat, and nss_db files.

- # - The libmemusage.so and libpcprofile.so used by utils.

  for module in compat files dns; do

      cat master.filelist \

  	| grep -E \

  	-e "/libnss_$module(\.so\.[0-9.]+|-[0-9.]+\.so)$" \

  	>> glibc.filelist

  done

- grep -e "libmemusage.so" -e "libpcprofile.so" master.filelist >> glibc.filelist

  

  ###############################################################################

  # glibc-gconv-extra
@@ -1663,12 +1673,8 @@ 

  grep '%{_libdir}/.*\.o' < master.filelist >> devel.filelist

  grep '%{_libdir}/lib.*\.so' < master.filelist >> devel.filelist

  # The exceptions are:

- # - libmemusage.so and libpcprofile.so in glibc used by utils.

  # - libnss_*.so which are in nss-devel.

- sed -i -e '\,libmemusage.so,d' \

- 	-e '\,libpcprofile.so,d' \

- 	-e '\,/libnss_[a-z]*\.so$,d' \

- 	devel.filelist

+ sed -i -e '\,/libnss_[a-z]*\.so$,d' devel.filelist

  

  %if %{glibc_autorequires}

  mkdir -p %{glibc_sysroot}/%{_rpmconfigdir} %{glibc_sysroot}/%{_fileattrsdir}
@@ -1773,6 +1779,8 @@ 

  %{_prefix}/bin/xtrace

  EOF

  

+ echo $all_utils_libs | sed 's,\([^ ]\+\),%{_libdir}/\1\n,g' >> utils.filelist

+ 

  ###############################################################################

  # nss_db, nss_hesiod

  ###############################################################################
@@ -2241,6 +2249,9 @@ 

  %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared

  

  %changelog

+ * Fri Jul 23 2021 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.33.9000-49

+ - Move non-core libraries to glibc-utils.

+ 

  * Fri Jul 23 2021 Florian Weimer <fweimer@redhat.com> - 2.33.9000-48

  - Auto-sync with upstream branch master,

    commit 9a7ab0769b295cbf5232140401742a8f34bda3de:

This change packages libc_malloc_debug.so.0 and libc_malloc_debug.so
into glibc-devel so that it is not installed by default into
production instances.

An alternative to this is to install the .so.0 into glibc-utils. In
fact, libmemusage and libpcprofile should also go into utils. What would y'all prefer?

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Why doesn't the proceed grep match these lines?

The mtrace tool is glibc-utils, right? Then perhaps the non-development DSO should be there, and the .so file in glibc-devel?

But that would mean that glibc-devel has to depend on glibc-utils. Do we need a new subpackage on which both packages depend? Or are we overthinking it and should this land in the main glibc package for now, with the .so symbolic link in glibc-devel?

The DSO is load-only, so the .so does not need to be in glibc-devel; it can stay in glibc-utils with mtrace. I think it's necessary that it not remain in glibc so that it can be removed to disallow hooks.

Thinking about this a bit more, one could always build a custom glibc and then use that libc_malloc_debug to preload, so moving the DSO from glibc to one of the optional packages is really just a cosmetic change. If you agree then I'll drop this patch and let the debug dso land in glibc.

It should not land in glibc, because downstream RHEL has Application Compatibility Guidelines that specify the glibc binary rpm as containing DSOs that have Compatibility Level 1 guarantees, and I don't want those guarantees anywhere near libc_mallod_debug.so, so it must IMO be outside of glibc rpm.

In that case along with libc_malloc_debug, we must also move libpcprofile. libmemusage, and libSegFault out into glibc-utils since none of them should be supported for level 1 ABI compatibility. There's also libBrokenLocale but at the moment it exports a symbol. I'll first work upstream to deprecate it since it's just a hack for what seems an uncommon case.

rebased onto 761c46a7bc0332813f0634d8c0fca033af435ef0

2 years ago

Here's an updated patch. This one should be ready to pull in if all of us are in sync on the direction.

rebased onto d855e54

2 years ago

I'm closing this after discussion, we want to see a minimal libc_malloc_debug change, namely that the autoprovides are filtered, and we don't ship the *.so to link again.

Pull-Request has been closed by codonell

2 years ago

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Metadata