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