-
Notifications
You must be signed in to change notification settings - Fork 305
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-build: handle paravirt absence in Linux v6.8+ #1392
Conversation
kpatch-build/kpatch-build
Outdated
@@ -438,7 +438,7 @@ find_special_section_data() { | |||
[[ ${check[i]} && -z "$PRINTK_INDEX_STRUCT_SIZE" ]] && die "can't find special struct pi_entry size" | |||
[[ ${check[j]} && -z "$JUMP_STRUCT_SIZE" ]] && die "can't find special struct jump_entry size" | |||
[[ ${check[o]} && -z "$ORC_STRUCT_SIZE" ]] && die "can't find special struct orc_entry size" | |||
[[ ${check[p]} && -z "$PARA_STRUCT_SIZE" ]] && die "can't find special struct paravirt_patch_site size" | |||
[[ ${check[p]} && -z "$PARA_STRUCT_SIZE" ]] && ! kernel_version_gte 6.8.0 && die "can't find special struct paravirt_patch_site size" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this second kernel_version_gte check is redundant as ${check[p]} should only be set if it's >= 6.8.0, right?
kpatch-build/create-diff-object.c
Outdated
|
||
if (!size) { | ||
if (uname(&name) < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately create-diff-object can't assume that it's building for the currently running kernel. (Think about how it operates when kpatch-build is passed the -r, -s, -v options.)
11d822a
to
4329cf5
Compare
kpatch-build/create-diff-object.c
Outdated
if (omit_str) | ||
omit = atoi(omit_str); | ||
|
||
if (!size && !omit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work out if you omitted this "omit" code and left create-diff-object untouched? If I read the code correctly, the group_size callbacks are only executed when their sections are encountered:
kpatch_process_special_sections()
for (special = special_sections; special->name; special++) {
...
sec = find_section_by_name(&kelf->sections, special->name);
if (!sec || !sec->rela)
continue;
kpatch_regenerate_special_section(kelf, lookup, special, sec->rela);
group_size = special->group_size(kelf, src_offset);
So I'd expect create-diff-object would only care about PARA_STRUCT_SIZE when the corresponding .parainstructions section is present. (Which I believe torvalds/linux@f7af6977 removes.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, my bad do not need to even pass omit
6fe14ce
to
18a796f
Compare
Upstream kernel commit f7af6977621a ("x86/paravirt: Remove no longer needed paravirt patching code") v6.8+ removed the .parainstructions section and its paravirt_patch_site struct. Therefore this checks the kernel version and does not export the struct size if the kernel version is >= v6.8.0, avoiding the code path for it in create-diff-object.c entirely. Fixes: dynup#1380 Signed-off-by: Ryan Sullivan <[email protected]>
18a796f
to
36ba2b8
Compare
Adds linux kernel version checks to all functions pertaining to struct paravirt_patch_site as it is removed in Linux v6.8+
Fixes: #1380