Skip to content

Commit

Permalink
parse klp backport properties from livepatch.h
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
swine committed Sep 9, 2022
1 parent 3e03b9b commit 55042d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kpatch-build/kpatch-build
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ use_klp_arch()
{
if kernel_is_rhel; then
! rhel_kernel_version_gte 4.18.0-284.el8
elif egrep -sq '^#define\s*NO_KLP_ARCH' include/linux/livepatch.h; then
false # kernel needs no .klp.arch sections
else
! kernel_version_gte 5.8.0
fi
Expand All @@ -233,6 +235,8 @@ support_klp_replace()
{
if kernel_is_rhel; then
rhel_kernel_version_gte 4.18.0-193.el8
elif egrep -sq '^#define\s*HAVE_KLP_REPLACE' include/linux/livepatch.h; then
true # kernel explicitly indicates support
else
kernel_version_gte 5.1.0
fi
Expand Down
2 changes: 2 additions & 0 deletions test/integration/kpatch-test
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ support_klp_replace()
{
if kernel_is_rhel; then
rhel_kernel_version_gte 4.18.0-193.el8
elif egrep -sq '^#define\s*HAVE_KLP_REPLACE' include/linux/livepatch.h: then
true # kernel explicitly indicates support
else
kernel_version_gte 5.1.0
fi
Expand Down

0 comments on commit 55042d5

Please sign in to comment.