From 6335f79866442fdead1bd0b74eba1c54fbf93555c64a4612524f7e7bca82fad3 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 14 Mar 2023 13:07:50 +0000 Subject: [PATCH 1/2] Accepting request 1070777 from home:gbelinassi - Enable livepatching support on x86_64. OBS-URL: https://build.opensuse.org/request/show/1070777 OBS-URL: https://build.opensuse.org/package/show/Base:System/libxcrypt?expand=0&rev=40 --- libxcrypt.changes | 5 +++++ libxcrypt.spec | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/libxcrypt.changes b/libxcrypt.changes index c3aa167..d1f3076 100644 --- a/libxcrypt.changes +++ b/libxcrypt.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Mar 10 20:29:48 UTC 2023 - Giuliano Belinassi + +- Enable livepatching support on x86_64. + ------------------------------------------------------------------- Wed Nov 30 15:02:10 UTC 2022 - Andreas Schwab diff --git a/libxcrypt.spec b/libxcrypt.spec index ea1611c..31b4ec6 100644 --- a/libxcrypt.spec +++ b/libxcrypt.spec @@ -1,7 +1,7 @@ # # spec file for package libxcrypt # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -29,6 +29,13 @@ Source2: https://github.com/besser82/libxcrypt/releases/download/v%{versi Source3: baselibs.conf BuildRequires: pkgconfig +# Enable support for livepatching. +%ifarch x86_64 +%bcond_without livepatching 1 +%else +%bcond_with livepatching 0 +%endif + %description libxcrypt is a modern library for one-way hashing of passwords. It supports DES, MD5, SHA-2-256, SHA-2-512, and bcrypt-based password @@ -94,6 +101,7 @@ is highly discouraged. # Disable LTO due to symbol versioning (boo#1138833): # (https://en.opensuse.org/openSUSE:LTO#Symbol_versioning). %define _lto_cflags %{nil} + %configure \ --disable-silent-rules \ --enable-shared \ @@ -101,9 +109,38 @@ is highly discouraged. --enable-obsolete-api=suse \ --enable-hashes=all \ --with-pkgconfigdir=%{_libdir}/pkgconfig + +%if %{with livepatching} +%make_build CFLAGS="$CFLAGS -fpatchable-function-entry=16,14 -fdump-ipa-clones" +%else %make_build +%endif %install + +%if %{with livepatching} +%define tar_basename libxcrypt-livepatch-%{version}-%{release} +%define tar_package_name %{tar_basename}.%{_arch}.tar.xz +%define clones_dest_dir %{tar_basename}/%{_arch} + +# Ipa-clones are files generated by gcc which logs changes made across +# functions, and we need to know such changes to build livepatches +# correctly. These files are intended to be used by the livepatch +# developers and may be retrieved by using `osc getbinaries`. +# +# Create ipa-clones destination folder and move clones there. +mkdir -p ipa-clones/%{clones_dest_dir} +find . -name "*.ipa-clones" ! -empty \ + -exec cp -t ipa-clones/%{clones_dest_dir} --parents {} + + +# Create tarball with ipa-clones. +tar -cJf %{tar_package_name} -C ipa-clones \ + --owner root --group root --sort name %{tar_basename} + +# Copy tarball to the OTHER folder to store it as artifact. +cp %{tar_package_name} %{_topdir}/OTHER +%endif + %make_install rm -v %{buildroot}%{_libdir}/*.la From e25db31efec366fa6e01c5e221d6902c0d462b797953be0633c5819ad527e147 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 14 Mar 2023 13:08:34 +0000 Subject: [PATCH 2/2] OBS-URL: https://build.opensuse.org/package/show/Base:System/libxcrypt?expand=0&rev=41 --- libxcrypt.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libxcrypt.spec b/libxcrypt.spec index 31b4ec6..fcd93a8 100644 --- a/libxcrypt.spec +++ b/libxcrypt.spec @@ -31,9 +31,9 @@ BuildRequires: pkgconfig # Enable support for livepatching. %ifarch x86_64 -%bcond_without livepatching 1 +%bcond_without livepatching %else -%bcond_with livepatching 0 +%bcond_with livepatching %endif %description