From 9ea2179ffc181014f196ea247663bafcaecd79bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 28 Dec 2021 17:37:11 +0100 Subject: [PATCH] Disable amd64 assembly on non-intel architectures All builds would include an .S file which contains a pre-processor directive that makes the file effectively empty on non-amd64 architectures. Objects built from assembly get an executable stack by default. The file has a stanza to make the stack non-executable, but on non-amd64 architectures this stanza is skipped together with the rest of the file. Nevertheless, it seems that even the empty file causes an executable stack to be created. To avoid the issue, do a build with the assembler file explicitly skipped. --- zstd.spec | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/zstd.spec b/zstd.spec index 964c3c7..145a3e5 100644 --- a/zstd.spec +++ b/zstd.spec @@ -4,10 +4,12 @@ %else %ifarch %{ix86} x86_64 %bcond_without pzstd +%bcond_without asm %else # aarch64 and armv7hl at least currently segfault # in ThreadPool test for the pzstd util %bcond_with pzstd +%bcond_with asm %endif %endif @@ -22,11 +24,12 @@ Source0: https://github.com/facebook/zstd/archive/v%{version}.tar.gz#/%{n Patch1: pzstd.1.patch -BuildRequires: make +BuildRequires: make BuildRequires: gcc gtest-devel %if %{with pzstd} BuildRequires: gcc-c++ %endif +BuildRequires: execstack %description Zstd, short for Zstandard, is a fast lossless compression algorithm, @@ -62,14 +65,16 @@ find -name .gitignore -delete %build export CFLAGS="$RPM_OPT_FLAGS" export LDFLAGS="$RPM_LD_FLAGS" -%make_build -C lib lib-mt -%make_build -C programs +%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 +%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 @@ -121,6 +126,10 @@ install -D -m644 programs/%{name}.1 %{buildroot}%{_mandir}/man1/p%{name}.1 %ldconfig_scriptlets -n lib%{name} %changelog +* Tue Dec 28 2021 Zbigniew Jędrzejewski-Szmek - 1.5.1-1 +- 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