From 3f46537371a5c848e5a2b06fb15fe6071b56a878 Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Tue, 26 Nov 2024 19:48:18 +0300 Subject: [PATCH] import zstd-1.5.5-8.el10 --- .gitignore | 1 + .zstd.metadata | 1 + SOURCES/bti.patch | 67 +++++++++ SOURCES/pzstd.1.patch | 17 +++ SPECS/zstd.spec | 323 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 409 insertions(+) create mode 100644 .gitignore create mode 100644 .zstd.metadata create mode 100644 SOURCES/bti.patch create mode 100644 SOURCES/pzstd.1.patch create mode 100644 SPECS/zstd.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13f4102 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/zstd-1.5.5.tar.gz diff --git a/.zstd.metadata b/.zstd.metadata new file mode 100644 index 0000000..6af787b --- /dev/null +++ b/.zstd.metadata @@ -0,0 +1 @@ +4479ecc74300d23391d99fbebf2fddd47aed9b28 SOURCES/zstd-1.5.5.tar.gz diff --git a/SOURCES/bti.patch b/SOURCES/bti.patch new file mode 100644 index 0000000..fd342a6 --- /dev/null +++ b/SOURCES/bti.patch @@ -0,0 +1,67 @@ +From a88781954a875c4f00883eba6a8c5d172c4f5c17 Mon Sep 17 00:00:00 2001 +From: Nick Terrell +Date: Wed, 13 Mar 2024 09:58:34 -0700 +Subject: [PATCH] [asm][aarch64] Mark that BTI and PAC are supported + +Mark that `huf_decompress_amd64.S` supports BTI and PAC, which it trivially does because it is empty for aarch64. + +The issue only requested BTI markings, but it also makes sense to mark PAC, which is the only other feature. + +Also run add a test for this mode to the ARM64 QEMU test. Before this PR it warns on `huf_decompress_amd64.S`, after it doesn't. + +Fixes Issue #3841. +--- + .github/workflows/dev-short-tests.yml | 1 + + lib/decompress/huf_decompress_amd64.S | 23 ++++++++++++++++++++++- + 2 files changed, 23 insertions(+), 1 deletion(-) + +diff --git a/.github/workflows/dev-short-tests.yml b/.github/workflows/dev-short-tests.yml +index b2aaff89cf7..5324b38d9ac 100644 +--- a/.github/workflows/dev-short-tests.yml ++++ b/.github/workflows/dev-short-tests.yml +@@ -409,6 +409,7 @@ jobs: + - name: ARM64 + if: ${{ matrix.name == 'ARM64' }} + run: | ++ LDFLAGS="-static -z force-bti" MOREFLAGS="-mbranch-protection=standard" CC=$XCC QEMU_SYS=$XEMU make clean check + LDFLAGS="-static" CC=$XCC QEMU_SYS=$XEMU make clean check + - name: PPC + if: ${{ matrix.name == 'PPC' }} +diff --git a/lib/decompress/huf_decompress_amd64.S b/lib/decompress/huf_decompress_amd64.S +index 3b96b44612f..78da291ee3c 100644 +--- a/lib/decompress/huf_decompress_amd64.S ++++ b/lib/decompress/huf_decompress_amd64.S +@@ -10,11 +10,32 @@ + + #include "../common/portability_macros.h" + ++#if defined(__ELF__) && defined(__GNUC__) + /* Stack marking + * ref: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart + */ +-#if defined(__ELF__) && defined(__GNUC__) + .section .note.GNU-stack,"",%progbits ++ ++#if defined(__aarch64__) ++/* Mark that this assembly supports BTI & PAC, because it is empty for aarch64. ++ * See: https://github.com/facebook/zstd/issues/3841 ++ * See: https://gcc.godbolt.org/z/sqr5T4ffK ++ * See: https://lore.kernel.org/linux-arm-kernel/20200429211641.9279-8-broonie@kernel.org/ ++ * See: https://reviews.llvm.org/D62609 ++ */ ++.pushsection .note.gnu.property, "a" ++.p2align 3 ++.long 4 /* size of the name - "GNU\0" */ ++.long 0x10 /* size of descriptor */ ++.long 0x5 /* NT_GNU_PROPERTY_TYPE_0 */ ++.asciz "GNU" ++.long 0xc0000000 /* pr_type - GNU_PROPERTY_AARCH64_FEATURE_1_AND */ ++.long 4 /* pr_datasz - 4 bytes */ ++.long 3 /* pr_data - GNU_PROPERTY_AARCH64_FEATURE_1_BTI | GNU_PROPERTY_AARCH64_FEATURE_1_PAC */ ++.p2align 3 /* pr_padding - bring everything to 8 byte alignment */ ++.popsection ++#endif ++ + #endif + + #if ZSTD_ENABLE_ASM_X86_64_BMI2 diff --git a/SOURCES/pzstd.1.patch b/SOURCES/pzstd.1.patch new file mode 100644 index 0000000..e6016c7 --- /dev/null +++ b/SOURCES/pzstd.1.patch @@ -0,0 +1,17 @@ +diff -Naur zstd-1.5.4/programs/zstd.1 zstd-1.5.4.new/programs/zstd.1 +--- zstd-1.5.4/programs/zstd.1 2023-02-10 00:41:50.000000000 +0000 ++++ zstd-1.5.4.new/programs/zstd.1 2023-02-13 12:44:01.575160149 +0000 +@@ -162,6 +162,13 @@ + \fB\-\-show\-default\-cparams\fR: shows the default compression parameters that will be used for a particular input file, based on the provided compression level and the input size\. If the provided file is not a regular file (e\.g\. a pipe), this flag will output the parameters used for inputs of unknown size\. + .IP "\[ci]" 4 + \fB\-\-\fR: All arguments after \fB\-\-\fR are treated as files ++ ++.SH Parallel Zstd OPTIONS ++Additional options for the pzstd utility ++.TP ++.BR \-p ", " --processes ++ number of threads to use for (de)compression (default:4) ++ + .IP "" 0 + .SS "gzip Operation Modifiers" + When invoked via a \fBgzip\fR symlink, \fBzstd\fR will support further options that intend to mimic the \fBgzip\fR behavior: diff --git a/SPECS/zstd.spec b/SPECS/zstd.spec new file mode 100644 index 0000000..0078060 --- /dev/null +++ b/SPECS/zstd.spec @@ -0,0 +1,323 @@ +# enable asm implementations by default +%bcond_without asm + +# enable .lz4 support by default +%bcond_without lz4 + +# enable .xz/.lzma support by default +%bcond_without lzma + +# enable .gz support by default +%bcond_without zlib + +# enable pzstd support by default +%bcond_without pzstd + +# Disable gtest on RHEL +%bcond gtest %[ !0%{?rhel} ] + +Name: zstd +Version: 1.5.5 +Release: 8%{?dist} +Summary: Zstd compression library + +License: BSD-3-Clause AND GPL-2.0-only +URL: https://github.com/facebook/zstd +Source0: https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz + +Patch1: pzstd.1.patch +Patch2: bti.patch + +BuildRequires: make +BuildRequires: gcc %{?with_gtest:gtest-devel} +%if %{with lz4} +BuildRequires: lz4-devel +%endif +%if %{with lzma} +BuildRequires: xz-devel +%endif +%if %{with pzstd} +BuildRequires: gcc-c++ +%endif +%if %{with zlib} +BuildRequires: zlib-devel +%endif +BuildRequires: execstack + +%description +Zstd, short for Zstandard, is a fast lossless compression algorithm, +targeting real-time compression scenarios at zlib-level compression ratio. + +%package -n lib%{name} +Summary: Zstd shared library + +%description -n lib%{name} +Zstandard compression shared library. + +%package -n lib%{name}-devel +Summary: Header files for Zstd library +Requires: lib%{name}%{?_isa} = %{version}-%{release} + +%package -n lib%{name}-static +Summary: Static variant of the Zstd library +Requires: lib%{name}-devel = %{version}-%{release} + +%description -n lib%{name}-devel +Header files for Zstd library. + +%description -n lib%{name}-static +Static variant of the Zstd library. + +%prep +%setup -q +find -name .gitignore -delete +%if %{with pzstd} +%patch1 -p1 +%endif + +%patch2 -p1 + +%build +export CFLAGS="$RPM_OPT_FLAGS" +export LDFLAGS="$RPM_LD_FLAGS" +export PREFIX="%{_prefix}" +export LIBDIR="%{_libdir}" +%make_build -C lib lib-mt %{!?with_asm:ZSTD_NO_ASM=1} +%make_build -C programs %{!?with_asm:ZSTD_NO_ASM=1} +%if %{with pzstd} +export CXXFLAGS="$RPM_OPT_FLAGS" +%make_build -C contrib/pzstd %{!?with_asm:ZSTD_NO_ASM=1} +%endif + +%check +execstack lib/libzstd.so.1 + +export CFLAGS="$RPM_OPT_FLAGS" +export LDFLAGS="$RPM_LD_FLAGS" +make -C tests test-zstd +%if %{with pzstd} && %{with gtest} +export CXXFLAGS="$RPM_OPT_FLAGS" +make -C contrib/pzstd test +%endif + +%install +%make_install PREFIX=%{_prefix} LIBDIR=%{_libdir} +%if %{with pzstd} +install -D -m755 contrib/pzstd/pzstd %{buildroot}%{_bindir}/pzstd +install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1 +%endif + +%files +%doc CHANGELOG README.md +%{_bindir}/%{name} +%if %{with pzstd} +%{_bindir}/p%{name} +%{_mandir}/man1/p%{name}.1* +%endif +%{_bindir}/%{name}mt +%{_bindir}/un%{name} +%{_bindir}/%{name}cat +%{_bindir}/%{name}grep +%{_bindir}/%{name}less +%{_mandir}/man1/%{name}.1* +%{_mandir}/man1/un%{name}.1* +%{_mandir}/man1/%{name}cat.1* +%{_mandir}/man1/%{name}grep.1* +%{_mandir}/man1/%{name}less.1* +%license COPYING LICENSE + +%files -n lib%{name} +%{_libdir}/libzstd.so.* +%license COPYING LICENSE + +%files -n lib%{name}-devel +%{_includedir}/zdict.h +%{_includedir}/zstd.h +%{_includedir}/zstd_errors.h +%{_libdir}/pkgconfig/libzstd.pc +%{_libdir}/libzstd.so + +%files -n lib%{name}-static +%{_libdir}/libzstd.a + +%ldconfig_scriptlets -n lib%{name} + +%changelog +* Tue Jul 23 2024 Jakub Martisko - 1.5.5-8 +- Backport the patch that enables BTI on aarch64 +Related: RHEL-50092 + +* Mon Jul 22 2024 Jakub Martisko - 1.5.5-7 +- Add the gating test from rhel-9 +Related: RHEL-50092 + +* Mon Jun 24 2024 Troy Dawson - 1.5.5-6 +- Bump release for June 2024 mass rebuild + +* Sat Jan 27 2024 Fedora Release Engineering - 1.5.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jul 22 2023 Fedora Release Engineering - 1.5.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Thu Jun 22 2023 Jiří Kučera - 1.5.5-3 +- Drop gtest on RHEL (c9s backport) + +* Thu Apr 13 2023 Lukáš Zaoral - 1.5.5-2 +- migrate to SPDX license format + +* Wed Apr 05 2023 Pádraig Brady - 1.5.5-1 +- Latest upstream + +* Mon Feb 13 2023 Pádraig Brady - 1.5.4-1 +- Latest upstream + +* Sat Jan 21 2023 Fedora Release Engineering - 1.5.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Sat Jul 23 2022 Fedora Release Engineering - 1.5.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu May 19 2022 Peter Robinson - 1.5.2-2 +- ThreadPool segfault fixed so build pzst everywhere + +* Sat Jan 22 2022 Pádraig Brady - 1.5.2-1 +- Latest upstream + +* Sat Jan 22 2022 Fedora Release Engineering - 1.5.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Tue Jan 11 2022 Pádraig Brady - 1.5.1-6 +- Re-enable CET protections (#2039353) + +* Fri Jan 07 2022 Michel Alexandre Salim - 1.5.1-5 +- Enable gz, .xz/.lzma and .lz4 support + +* Mon Jan 03 2022 Pádraig Brady - 1.5.1-4 +- Use correct prefix for pkgconfig. + +* Wed Dec 29 2021 Pádraig Brady - 1.5.1-3 +- Avoid executable stack on i686 also. + +* Tue Dec 28 2021 Zbigniew Jędrzejewski-Szmek - 1.5.1-2 +- Disable amd64 assembly on non-intel architectures (#2035802): + this should avoid the issue where an executable stack is created. + +* Wed Dec 22 2021 Pádraig Brady - 1.5.1-1 +- Latest upstream + +* Fri Jul 23 2021 Fedora Release Engineering - 1.5.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Sun May 16 2021 Pádraig Brady - 1.5.0-2 +- Latest upstream + +* Fri Mar 05 2021 Pádraig Brady - 1.4.9-1 +- Latest upstream + +* Thu Jan 28 2021 Fedora Release Engineering - 1.4.7-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Thu Dec 17 2020 Pádraig Brady - 1.4.7-1 +- Latest upstream + +* Wed Aug 26 2020 Jeff Law - 1.4.5-6 +- Do not force C++11 mode + +* Wed Jul 29 2020 Fedora Release Engineering - 1.4.5-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sat Jul 11 2020 Igor Raits - 1.4.5-4 +- Build libzstd with multi-threading support + +* Mon May 25 2020 Pádraig Brady - 1.4.5-3 +- Build shared library with correct compiler flags + +* Fri May 22 2020 Pádraig Brady - 1.4.5-1 +- Latest upstream + +* Fri May 22 2020 Avi Kivity - 1.4.4-3 +- Added static library subpackage + +* Fri Jan 31 2020 Fedora Release Engineering - 1.4.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Wed Jan 15 2020 Pádraig Brady - 1.4.4-1 +- Latest upstream + +* Wed Jul 31 2019 Pádraig Brady - 1.4.2-1 +- Latest upstream + +* Sat Jul 27 2019 Fedora Release Engineering - 1.4.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Apr 29 2019 Pádraig Brady - 1.4.0-1 +- Latest upstream + +* Sun Feb 03 2019 Fedora Release Engineering - 1.3.8-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Mon Dec 31 2018 Pádraig Brady - 1.3.8-1 +- Latest upstream + +* Mon Oct 08 2018 Pádraig Brady - 1.3.6-1 +- Latest upstream + +* Sat Jul 14 2018 Fedora Release Engineering - 1.3.5-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jul 02 2018 Pádraig Brady - 1.3.5.1 +- Latest upstream + +* Wed Mar 28 2018 Pádraig Brady - 1.3.4-1 +- Latest upstream + +* Fri Feb 09 2018 Fedora Release Engineering - 1.3.3-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Feb 02 2018 Igor Gnatenko - 1.3.3-2 +- Switch to %%ldconfig_scriptlets + +* Thu Dec 21 2017 Pádraig Brady - 1.3.3-1 +- Latest upstream + +* Fri Nov 10 2017 Pádraig Brady - 1.3.2-1 +- Latest upstream + +* Mon Aug 21 2017 Pádraig Brady - 1.3.1-1 +- Latest upstream + +* Thu Aug 03 2017 Fedora Release Engineering - 1.3.0-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 1.3.0-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sun Jul 16 2017 Pádraig Brady - 1.3.0-1 +- Latest upstream + +* Mon May 08 2017 Pádraig Brady - 1.2.0-1 +- Latest upstream + +* Mon Mar 06 2017 Pádraig Brady - 1.1.3-1 +- Latest upstream + +* Sat Feb 11 2017 Fedora Release Engineering - 1.1.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Nov 02 2016 Pádraig Brady - 1.1.1-1 +- Latest upstream + +* Thu Oct 6 2016 Pádraig Brady 1.1.0-2 +- Add pzstd(1) + +* Thu Sep 29 2016 Pádraig Brady 1.1.0-1 +- New upstream release +- Remove examples and static lib + +* Mon Sep 12 2016 Pádraig Brady 1.0.0-2 +- Adjust various upstream links +- Parameterize various items in spec file + +* Mon Sep 5 2016 Pádraig Brady 1.0.0-1 +- Initial release