From 360c2630e4180e6e0510755cbce076e15736b2f0 Mon Sep 17 00:00:00 2001 From: Nick Terrell Date: Tue, 30 Nov 2021 12:29:55 -0800 Subject: [PATCH] [test] Test that the exec-stack bit isn't set on libzstd.so Tests that libzstd.so doesn't have the exec-stack bit set using readelf. If the stack is marked executable systemd will refuse to link against zstd. We now test that it isn't set on every PR. Adds a test for PR #2857 Fixes Issue #2865 --- .github/workflows/dev-short-tests.yml | 6 +++--- tests/{libzstd_partial_builds.sh => libzstd_builds.sh} | 9 +++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) rename tests/{libzstd_partial_builds.sh => libzstd_builds.sh} (92%) diff --git a/.github/workflows/dev-short-tests.yml b/.github/workflows/dev-short-tests.yml index 584baa85..0f6590ec 100644 --- a/.github/workflows/dev-short-tests.yml +++ b/.github/workflows/dev-short-tests.yml @@ -117,11 +117,11 @@ jobs: make -C zlibWrapper test make -C zlibWrapper valgrindTest - lz4-threadpool-partial-libs: + lz4-threadpool-libs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: LZ4, thread pool, and partial libs testslib wrapper test + - name: LZ4, thread pool, and libs build testslib wrapper test run: | make lz4install make -C tests test-lz4 @@ -129,7 +129,7 @@ jobs: make clean make -C tests test-pool make clean - bash tests/libzstd_partial_builds.sh + bash tests/libzstd_builds.sh gcc-make-tests-32bit: runs-on: ubuntu-latest diff --git a/tests/libzstd_partial_builds.sh b/tests/libzstd_builds.sh similarity index 92% rename from tests/libzstd_partial_builds.sh rename to tests/libzstd_builds.sh index 05dad8f9..f9e1e76c 100755 --- a/tests/libzstd_partial_builds.sh +++ b/tests/libzstd_builds.sh @@ -23,14 +23,19 @@ mustBeAbsent() { # default compilation : all features enabled - no zbuff $ECHO "testing default library compilation" -CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID +CFLAGS= make -C $DIR/../lib libzstd libzstd.a > $INTOVOID nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog isPresent "zstd_compress.o" isPresent "zstd_decompress.o" isPresent "zdict.o" isPresent "zstd_v07.o" mustBeAbsent "zbuff_compress.o" -$RM $DIR/../lib/libzstd.a tmplog +$RM tmplog + +# Check that the exec-stack bit isn't set +readelf -lW $DIR/../lib/libzstd.so | $GREP "GNU_STACK" > tmplog +mustBeAbsent "RWE" +$RM $DIR/../lib/libzstd.a $DIR/../lib/libzstd.so* tmplog # compression disabled => also disable zdict $ECHO "testing with compression disabled"