Skip to content

Commit

Permalink
fix(dracut): when aggressive strip is enabled, don't apply to ko
Browse files Browse the repository at this point in the history
Unlike ordinary binaries, kernel module will be unusable if stripped
with "-p". Fix this by always use "-g" only.

So far it didn't cause many issues since most kernels have their
modules signed or compressed so this is skipped.

Signed-off-by: Kairui Song <kasong@tencent.com>
  • Loading branch information
ryncsn committed Sep 13, 2024
1 parent 5d2bda4 commit c89dfda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2111,6 +2111,7 @@ if [[ $do_strip == yes ]]; then
fi
done
kstrip_args=(-g)
if [[ $aggressive_strip == yes ]]; then
# `eu-strip` and `strip` both strips all unneeded parts by default
strip_args=(-p)
Expand Down Expand Up @@ -2260,7 +2261,7 @@ if [[ $do_strip == yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
| while read -r -d $'\0' f || [ -n "$f" ]; do
SIG=$(tail -c 28 "$f" | tr -d '\000')
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
done | xargs -r -0 $strip_cmd "${strip_args[@]}"
done | xargs -r -0 $strip_cmd "${kstrip_args[@]}"
dinfo "*** Stripping files done ***"
fi
Expand Down

0 comments on commit c89dfda

Please sign in to comment.