Skip to content

Commit 5a8e136

Browse files
committed
parse klp backport properties from livepatch.h
Avoid further cluttering of kpatch-build by per-distro exceptions to the usual inference from KERNEL_VERSION of core klp properties NO_KLP_ARCH or HAVE_KLP_REPLACE. Rather than tweak kpatch-build to reflect each distro's different backporting of livepatch core code from upstream, at each reported KERNEL_VERSION, advertise in <linux/livepatch.h> those kernel properties that have been backported from upstream, overriding the logic based on KERNEL_VERSION as needed. Signed-off-by: Pete Swain <swine@google.com>
1 parent fa959df commit 5a8e136

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

kpatch-build/kpatch-build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ use_klp_arch()
224224
{
225225
if kernel_is_rhel; then
226226
! rhel_kernel_version_gte 4.18.0-284.el8
227+
elif egrep -sq '^#define\s*NO_KLP_ARCH' include/linux/livepatch.h; then
228+
false # kernel needs no .klp.arch sections
227229
else
228230
! kernel_version_gte 5.8.0
229231
fi
@@ -233,6 +235,8 @@ support_klp_replace()
233235
{
234236
if kernel_is_rhel; then
235237
rhel_kernel_version_gte 4.18.0-193.el8
238+
elif egrep -sq '^#define\s*HAVE_KLP_REPLACE' include/linux/livepatch.h; then
239+
true # kernel explicitly indicates support
236240
else
237241
kernel_version_gte 5.1.0
238242
fi

test/integration/kpatch-test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@ support_klp_replace()
317317
{
318318
if kernel_is_rhel; then
319319
rhel_kernel_version_gte 4.18.0-193.el8
320+
elif egrep -sq '^#define\s*HAVE_KLP_REPLACE' include/linux/livepatch.h: then
321+
true # kernel explicitly indicates support
320322
else
321323
kernel_version_gte 5.1.0
322324
fi

0 commit comments

Comments
 (0)