kpatch: don't complain about missing livepatch .kpatch.checksum

The verify_module_checksum() function reads a kpatch-specific ELF
section to compare on-disk and in-memory kernel modules.  The function
only reports a miscompare if the .kpatch.checksum section actually
exists.  Livepatches don't have such section, so throw away any "Section
'.kpatch.checksum' was not dumped because it does not exist!" warnings
from readelf.

Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
This commit is contained in:
Joe Lawrence 2017-11-15 10:44:42 -05:00
parent 64ba06606f
commit a2fbce1587

View File

@ -145,7 +145,7 @@ verify_module_checksum () {
modname="$(get_module_name "$1")"
[[ -z "$modname" ]] && return 1
checksum="$(readelf -p .kpatch.checksum "$1" | grep '\[.*\]' | awk '{print $3}')"
checksum="$(readelf -p .kpatch.checksum "$1" 2>&1 | grep '\[.*\]' | awk '{print $3}')"
# Fail checksum match only if both exist and diverge
if [[ ! -z "$checksum" ]] && [[ -e "$SYSFS/${modname}/checksum" ]] ; then