Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2019-02-06 10:53:44 +0100
committerMiroslav Benes <mbenes@suse.cz>2019-02-13 12:53:32 +0100
commit3efd3305217e72214db1cde3dbbae5c3704850e6 (patch)
tree50f0ee123144d132d59a36b12408bdaa27375251
parent76fa1a42d05db3cb21e3fbc0b5ccece8dee12f7e (diff)
Use klp-convert where provided
klp-convert tool converts undefined symbols in a live patch kernel module to special relocation records which are resolved by the kernel. It allows to omit kallsyms tricks. Wire it to the spec file and let tar-up.sh script decide if it is to be used depending on a codestream. SLE15-SP1 is supported currently. Signed-off-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Nicolai Stange <nstange@suse.de>
-rw-r--r--rpm/kernel-livepatch.spec12
-rwxr-xr-xscripts/tar-up.sh14
2 files changed, 26 insertions, 0 deletions
diff --git a/rpm/kernel-livepatch.spec b/rpm/kernel-livepatch.spec
index 11efeb9..2f5d713 100644
--- a/rpm/kernel-livepatch.spec
+++ b/rpm/kernel-livepatch.spec
@@ -17,6 +17,8 @@
# needssslcertforbuild
+@@USE_KLP_CONVERT@@
+
Name: kernel-livepatch-@@RELEASE@@
Version: 1
Release: 1
@@ -34,6 +36,9 @@ Source6: kallsyms_relocs.h
Source7: kallsyms_relocs.c
@@KLP_PATCHES_SOURCES@@
BuildRequires: kernel-syms kernel-livepatch-tools-devel libelf-devel
+%if 0%{?use_klp_convert}
+BuildRequires: kernel-default-livepatch-devel
+%endif
ExclusiveArch: ppc64le x86_64
%klp_module_package
@@ -64,6 +69,13 @@ for flavor in %flavors_to_build; do
mkdir -p "obj/$flavor"
cp -r "$@" "obj/$flavor"
make -C %{kernel_source $flavor} M="$PWD/obj/$flavor" modules
+
+ %if 0%{?use_klp_convert}
+ module=$(find "obj/$flavor" -name 'livepatch*.ko' -printf '%f')
+ klp-convert /usr/src/linux-obj/%_target_cpu/$flavor/Symbols.list \
+ obj/$flavor/$module obj/$flavor/${module}_converted
+ mv obj/$flavor/${module}_converted obj/$flavor/$module
+ %endif
done
%install
diff --git a/scripts/tar-up.sh b/scripts/tar-up.sh
index 92fe7b4..422b369 100755
--- a/scripts/tar-up.sh
+++ b/scripts/tar-up.sh
@@ -104,3 +104,17 @@ sed -i \
# changelog
changelog=$build_dir/kernel-livepatch-"$RELEASE".changes
scripts/gitlog2changes.pl HEAD -- > "$changelog"
+
+# klp-convert
+parse_release() {
+ echo "$1" | \
+ sed 's/SLE\([0-9]\+\)\(-SP\([0-9]\+\)\)\?_Update_\([0-9]\+\)/\1,\3,\4/' | \
+ awk -F, '{ print $1 " " ($2 ? $2 : 0) " " $3 }'
+}
+
+rel=($(parse_release $RELEASE))
+if [[ -n "${rel[0]##*Test*}" && ${rel[0]} -eq 15 && ${rel[1]} -eq 1 ]]; then
+ sed -i "s/@@USE_KLP_CONVERT@@/%define use_klp_convert 1/" $build_dir/kernel-livepatch-"$RELEASE".spec
+else
+ sed -i "s/@@USE_KLP_CONVERT@@//" $build_dir/kernel-livepatch-"$RELEASE".spec
+fi