Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kpatch: better support for livepatch modules #647

Merged
merged 1 commit into from
Dec 20, 2016

Conversation

joe-lawrence
Copy link
Contributor

Livepatch modules can be supported with minimal changes to the kpatch
script. Adjust for appropriate sysfs paths, core-patching code (in
kernel for livepatch, kpatch.ko for kpatch), and checksum verification
(only verify the checksum if it exists).

Fixes #479.

if [[ ! -z $checksum ]] && [[ -e "$SYSFS/${modname}/checksum" ]] ; then
sysfs_checksum=$(cat $SYSFS/${modname}/checksum)
[[ $checksum == $sysfs_checksum ]] || return 1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bash functions return the return the result of the last command -- in this case, the "if; fi" construct. It would probably be safer to explicitly return 0 at the end of the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed in v2

@@ -27,6 +27,14 @@ INSTALLDIR=/var/lib/kpatch
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
VERSION="0.3.4"

# Assume livepatch core is built into the kernel, otherwise
# use kpatch model.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/model/core module/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded in v2

Livepatch modules can be supported with minimal changes to the kpatch
script.  Adjust for appropriate sysfs paths, core-patching code (in
kernel for livepatch, kpatch.ko for kpatch), and checksum verification
(only verify the checksum if it exists).

Fixes dynup#479.
@joe-lawrence
Copy link
Contributor Author

v2 - reworded live/kpatch comment, explicitly return 0 from verify_module_checksum()

@jpoimboe
Copy link
Member

👍

@flaming-toast
Copy link
Contributor

Thanks @joe-lawrence!

@flaming-toast flaming-toast merged commit 823158d into dynup:master Dec 20, 2016
@joe-lawrence joe-lawrence deleted the livepatch_compat branch December 21, 2016 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants