Skip to content

Commit

Permalink
Don't brp-strip .ko files
Browse files Browse the repository at this point in the history
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 0ab151a.

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
  • Loading branch information
dmnks authored and ffesti committed Jul 12, 2021
1 parent 513d04d commit cfdb830
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/brp-strip
Expand Up @@ -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

1 comment on commit cfdb830

@jmflinuxtx
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was known and expected behavior that we have been working around since we started signing things many years ago. Now they just aren't getting stripped.

Please sign in to comment.