summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2021-07-11 18:08:26 +0200
committerPanu Matilainen <pmatilai@redhat.com>2021-08-20 11:44:09 +0300
commit3040fdab7756b0e2dcdd3fc3e8cbd5cce3a80709 (patch)
tree9fe6986a394867ab503ca59a9bd6522ad89c4d01
parent6f63bf93cfd4700e0561b57410a957d0356ca9aa (diff)
downloadrpm-3040fdab7756b0e2dcdd3fc3e8cbd5cce3a80709.tar.gz
Don't brp-strip .ko files
Otherwise SecureBoot signatures may be stripped too. We used to exclude shared libraries from this strip as they were supposed to be covered by another brp script (brp-strip-shared), however it turned out the latter was never really used, so we removed the exclusion in commit 0ab151ab138fd4fb6d3176fd0270d9cc6f4623f3. As it turns out, that was a little too ambitious, since we may now inadvertently strip SecureBoot signatures from kernel modules too, provided that they're made during the build, prior to the invocation of brp-strip. Note that this regression currently does *not* affect the following two cases on Fedora/RHEL systems with redhat-rpm-config installed: - in-tree kernel modules; these are built from kernel.spec which already contains a hack ensuring that module signing only happens *after* any stripping (see %__modsign_install_post in kernel.spec) - out-of-tree kernel modules built with debuginfo enabled; this is because brp-strip is only called when %debug_package is set to %{nil} Any other combinations may be affected, depending on the macros and .spec files used, so let's fix this by effectively "reverting" said commit for .ko files only. Fixes: rhbz#1967291 (cherry picked from commit cfdb8300f6e3aed0abc41406a3c4737eb1192067)
-rwxr-xr-xscripts/brp-strip2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/brp-strip b/scripts/brp-strip
index 35fbb593a..a6734f56f 100755
--- a/scripts/brp-strip
+++ b/scripts/brp-strip
@@ -13,5 +13,5 @@ Darwin*) exit 0 ;;
esac
# Strip ELF binaries
-find "$RPM_BUILD_ROOT" -type f \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" -print0 | \
+find "$RPM_BUILD_ROOT" -type f \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" \! -name "*.ko" -print0 | \
xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0