diff --git a/.gitignore b/.gitignore index 7c98a7d..f458374 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /kpatch-dnf-v0.4.tar.gz /v0.9.7.tar.gz /v0.9.8.tar.gz +/v0.9.10.tar.gz diff --git a/0002-kpatch-clarify-unload-unsupport.patch b/0002-kpatch-clarify-unload-unsupport.patch index b1c0d2d..a1167eb 100644 --- a/0002-kpatch-clarify-unload-unsupport.patch +++ b/0002-kpatch-clarify-unload-unsupport.patch @@ -9,10 +9,9 @@ still run unload kpatch modules from scripts. RHEL-only. Signed-off-by: Joe Lawrence -diff -Nupr kpatch-0.6.1.old/kpatch/kpatch kpatch-0.6.1/kpatch/kpatch ---- kpatch-0.9.2.old/kpatch/kpatch 2019-08-28 10:35:01.191259434 -0400 -+++ kpatch-0.9.2/kpatch/kpatch 2019-08-28 16:11:13.067926576 -0400 -@@ -49,8 +49,8 @@ usage () { +--- a/kpatch/kpatch ++++ b/kpatch/kpatch +@@ -50,8 +50,8 @@ usage () { echo >&2 usage_cmd "load --all" "load all installed patch modules into the running kernel" usage_cmd "load " "load patch module into the running kernel" @@ -23,7 +22,7 @@ diff -Nupr kpatch-0.6.1.old/kpatch/kpatch kpatch-0.6.1/kpatch/kpatch echo >&2 usage_cmd "info " "show information about a patch module" echo >&2 -@@ -71,6 +71,16 @@ die() { +@@ -72,6 +72,16 @@ die() { exit 1 } @@ -40,7 +39,7 @@ diff -Nupr kpatch-0.6.1.old/kpatch/kpatch kpatch-0.6.1/kpatch/kpatch __find_module () { MODULE="$1" [[ -f "$MODULE" ]] && return -@@ -406,6 +416,19 @@ unset MODULE +@@ -454,6 +464,19 @@ unset MODULE init_sysfs_var [[ "$#" -lt 1 ]] && usage @@ -60,9 +59,8 @@ diff -Nupr kpatch-0.6.1.old/kpatch/kpatch kpatch-0.6.1/kpatch/kpatch case "$1" in "load") [[ "$#" -ne 2 ]] && usage -diff -Nupr kpatch-0.6.1.old/man/kpatch.1 kpatch-0.6.1/man/kpatch.1 ---- kpatch-0.9.2.old/man/kpatch.1 2019-08-28 10:35:01.191259434 -0400 -+++ kpatch-0.9.2/man/kpatch.1 2019-08-28 14:51:23.268198897 -0400 +--- a/man/kpatch.1 ++++ b/man/kpatch.1 @@ -23,10 +23,10 @@ load --all load load patch module into the running kernel diff --git a/0003-do-not-rm-selinux-rpm-owned-directory.patch b/0003-do-not-rm-selinux-rpm-owned-directory.patch index a38e831..5c43848 100644 --- a/0003-do-not-rm-selinux-rpm-owned-directory.patch +++ b/0003-do-not-rm-selinux-rpm-owned-directory.patch @@ -15,10 +15,9 @@ consistency. RHEL-only. Signed-off-by: Yannick Cote -diff -Nupr kpatch-0.9.4.old/kpatch/kpatch kpatch-0.9.4/kpatch/kpatch ---- kpatch-0.9.4.old/kpatch/kpatch 2021-08-26 15:31:07.000000000 -0400 -+++ kpatch-0.9.4/kpatch/kpatch 2022-06-10 12:19:55.791538218 -0400 -@@ -584,7 +584,6 @@ case "$1" in +--- a/kpatch/kpatch ++++ b/kpatch/kpatch +@@ -610,7 +610,6 @@ case "$1" in echo "uninstalling $PATCH ($KVER)" rm -f "$MODULE" || die "failed to uninstall module $PATCH" rmdir --ignore-fail-on-non-empty "$INSTALLDIR/$KVER" || die "failed to remove directory $INSTALLDIR/$KVER" diff --git a/0100-create-diff-object-avoid-reloc-type-collisions-on-el.patch b/0100-create-diff-object-avoid-reloc-type-collisions-on-el.patch new file mode 100644 index 0000000..cacd1d1 --- /dev/null +++ b/0100-create-diff-object-avoid-reloc-type-collisions-on-el.patch @@ -0,0 +1,202 @@ +From f1ad9d71e677ae94de4b9efeb137ad34a7d10e6a Mon Sep 17 00:00:00 2001 +From: Pete Swain +Date: Fri, 31 May 2024 15:17:46 -0700 +Subject: [PATCH 100/118] create-diff-object: avoid reloc-type collisions on + elf.h constants + +The elf.h reloc-type constants are not unique across archs, for example: + + #define R_PPC64_REL24 10 /* PC relative 26 bit */ + #define R_X86_64_32 10 /* Direct 32 bit zero extended */ + +so to avoid any unexpected aliasing, guard all R_arch_type refs with a +check on kelf->arch, or a global default arch set from the first elf +encountered. + +Closes: #1356 ("Do we need more robust archeticture protection") +Signed-off-by: Pete Swain +Signed-off-by: Mihails Strasuns +Signed-off-by: Joe Lawrence +--- + kpatch-build/create-diff-object.c | 77 ++++++++++++++++++----------- + kpatch-build/create-kpatch-module.c | 3 ++ + kpatch-build/kpatch-elf.c | 24 ++++++++- + kpatch-build/kpatch-elf.h | 3 ++ + 4 files changed, 77 insertions(+), 30 deletions(-) + +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -215,6 +215,8 @@ static bool is_gcc6_localentry_bundled_s + */ + static struct rela *toc_rela(const struct rela *rela) + { ++ if (!is_arch(PPC64)) ++ return (struct rela *)rela; + if (rela->type != R_PPC64_TOC16_HA && + rela->type != R_PPC64_TOC16_LO_DS) + return (struct rela *)rela; +@@ -1623,7 +1625,7 @@ static void kpatch_replace_sections_syms + + if (is_text_section(relasec->base) && + !is_text_section(sym->sec) && +- rela->type == R_X86_64_32S && ++ is_arch(X86_64) && rela->type == R_X86_64_32S && + rela->addend == (long)sym->sec->sh.sh_size && + end == (long)sym->sec->sh.sh_size) { + +@@ -3241,12 +3243,23 @@ static int function_ptr_rela(const struc + { + const struct rela *rela_toc = toc_rela(rela); + ++ switch (def_arch()) { ++ case PPC64: ++ if (rela->type != R_PPC64_TOC16_HA && ++ rela->type != R_PPC64_TOC16_LO_DS) ++ return false; ++ break; ++ case X86_64: ++ if (rela->type != R_X86_64_32S) ++ return false; ++ break; ++ default: ++ break; ++ } ++ + return (rela_toc && rela_toc->sym->type == STT_FUNC && + !rela_toc->sym->parent && +- rela_toc->addend == (int)rela_toc->sym->sym.st_value && +- (rela->type == R_X86_64_32S || +- rela->type == R_PPC64_TOC16_HA || +- rela->type == R_PPC64_TOC16_LO_DS)); ++ rela_toc->addend == (int)rela_toc->sym->sym.st_value); + } + + static bool need_klp_reloc(struct kpatch_elf *kelf, struct lookup_table *table, +@@ -3261,32 +3274,38 @@ static bool need_klp_reloc(struct kpatch + * These references are treated specially by the module loader and + * should never be converted to klp relocations. + */ +- if (rela->type == R_PPC64_REL16_HA || rela->type == R_PPC64_REL16_LO || +- rela->type == R_PPC64_ENTRY) +- return false; ++ switch (kelf->arch) { ++ case PPC64: ++ if (rela->type == R_PPC64_REL16_HA || rela->type == R_PPC64_REL16_LO || ++ rela->type == R_PPC64_ENTRY) ++ return false; + +- /* v5.13+ kernels use relative jump labels */ +- if (rela->type == R_PPC64_REL64 && strcmp(relasec->name, ".rela__jump_table")) +- return false; ++ /* v5.13+ kernels use relative jump labels */ ++ if (rela->type == R_PPC64_REL64 && strcmp(relasec->name, ".rela__jump_table")) ++ return false; + +- /* +- * On powerpc, the function prologue generated by GCC 6 has the +- * sequence: +- * +- * .globl my_func +- * .type my_func, @function +- * .quad .TOC.-my_func +- * my_func: +- * .reloc ., R_PPC64_ENTRY ; optional +- * ld r2,-8(r12) +- * add r2,r2,r12 +- * .localentry my_func, .-my_func +- * +- * The R_PPC64_ENTRY is optional and its symbol might have an empty +- * name. Leave it as a normal rela. +- */ +- if (rela->type == R_PPC64_ENTRY) +- return false; ++ /* ++ * On powerpc, the function prologue generated by GCC 6 has the ++ * sequence: ++ * ++ * .globl my_func ++ * .type my_func, @function ++ * .quad .TOC.-my_func ++ * my_func: ++ * .reloc ., R_PPC64_ENTRY ; optional ++ * ld r2,-8(r12) ++ * add r2,r2,r12 ++ * .localentry my_func, .-my_func ++ * ++ * The R_PPC64_ENTRY is optional and its symbol might have an empty ++ * name. Leave it as a normal rela. ++ */ ++ if (rela->type == R_PPC64_ENTRY) ++ return false; ++ break; ++ default: ++ break; ++ } + + /* + * Allow references to core module symbols to remain as normal +--- a/kpatch-build/create-kpatch-module.c ++++ b/kpatch-build/create-kpatch-module.c +@@ -58,6 +58,9 @@ static void create_dynamic_rela_sections + dynsec = create_section_pair(kelf, ".kpatch.dynrelas", sizeof(*dynrelas), nr); + dynrelas = dynsec->data->d_buf; + ++ if (kelf->arch != X86_64) ++ return; ++ + for (index = 0; index < nr; index++) { + offset = index * (unsigned int)sizeof(*krelas); + +--- a/kpatch-build/kpatch-elf.c ++++ b/kpatch-build/kpatch-elf.c +@@ -38,6 +38,26 @@ + * Helper functions + ******************/ + ++static enum architecture current_arch; ++ ++enum architecture def_arch(void) ++{ ++ return current_arch; ++} ++ ++bool is_arch(enum architecture arch) ++{ ++ return current_arch == arch; ++} ++ ++void set_arch(enum architecture arch) ++{ ++ if (!arch || (current_arch && arch != current_arch)) ++ ERROR("inconsistent ELF arch: setting %d but already %d", ++ arch, current_arch); ++ current_arch = arch; ++} ++ + char *status_str(enum status status) + { + switch(status) { +@@ -594,8 +614,10 @@ struct kpatch_elf *kpatch_elf_open(const + kelf->arch = S390; + break; + default: +- ERROR("Unsupported target architecture"); ++ ERROR("Unsupported target architecture: e_machine %x", ++ ehdr.e_machine); + } ++ set_arch(kelf->arch); + + kpatch_create_section_list(kelf); + kpatch_create_symbol_list(kelf); +--- a/kpatch-build/kpatch-elf.h ++++ b/kpatch-build/kpatch-elf.h +@@ -159,6 +159,9 @@ int offset_of_string(struct list_head *l + long rela_target_offset(struct kpatch_elf *kelf, struct section *relasec, + struct rela *rela); + unsigned int insn_length(struct kpatch_elf *kelf, void *addr); ++enum architecture def_arch(void); ++void set_arch(enum architecture); ++bool is_arch(enum architecture); + + #ifndef R_PPC64_ENTRY + #define R_PPC64_ENTRY 118 diff --git a/0100-support-ubsan-for-kpatch.patch b/0100-support-ubsan-for-kpatch.patch deleted file mode 100644 index f1dbe3f..0000000 --- a/0100-support-ubsan-for-kpatch.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 85344cf524cccc7b8e10bf04ed38a0f586bffd10 Mon Sep 17 00:00:00 2001 -From: Sumanth Korikkar -Date: Tue, 21 Feb 2023 15:28:21 +0100 -Subject: [PATCH 100/112] support ubsan for kpatch - -ubsan generates .data..Lubsan_data* sections as follows: - -1. int main(int argc, char **argv) { - int arr[100]; - arr[101] = 1; - printf("arr[101] = %d", arr[101]); - return 0; -} - -2. 1a: 50 10 b0 ac st %r1,172(%r11) - int arr[100]; - arr[101] = 1; -1e: a7 39 00 65 lghi %r3,101 -22: c0 20 00 00 00 00 larl %r2,22 - 24: R_390_PC32DBL .data..Lubsan_data1+0x2 -28: c0 e5 00 00 00 00 brasl %r14,28 - 2a: R_390_PLT32DBL __ubsan_handle_out_of_bounds+0x2 - -3. 0000000000000000 <.data..Lubsan_data1>: -0: R_390_64 .rodata <=== source_location.location->file_name -8: 00 00 00 04 .long 0x00000004 <=== source_location.location->line -c: 00 00 00 05 .long 0x00000005 <=== source_location.location->column - -10: R_390_64 .data..Lubsan_type0 <== source_location->array_type -18: R_390_64 .data..Lubsan_type1 <=== source_location->index_type - -4. Avoid correlating the *.data.Lubsan* sections. This means - included function points to new *.data.Lubsan* sections. - -Signed-off-by: Sumanth Korikkar ---- - kpatch-build/create-diff-object.c | 13 +++++++++++++ - kpatch-build/kpatch-elf.c | 12 ++++++++++++ - kpatch-build/kpatch-elf.h | 1 + - kpatch-build/lookup.c | 3 ++- - 4 files changed, 28 insertions(+), 1 deletion(-) - -diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c -index 707b0a9..454783a 100644 ---- a/kpatch-build/create-diff-object.c -+++ b/kpatch-build/create-diff-object.c -@@ -1036,6 +1036,9 @@ static void kpatch_correlate_sections(struct list_head *seclist_orig, - sec_patched->twin) - continue; - -+ if (is_ubsan_sec(sec_orig->name)) -+ continue; -+ - if (is_special_static(is_rela_section(sec_orig) ? - sec_orig->base->secsym : - sec_orig->secsym)) -@@ -1072,6 +1075,9 @@ static void kpatch_correlate_symbols(struct list_head *symlist_orig, - sym_orig->type != sym_patched->type || sym_patched->twin) - continue; - -+ if (is_ubsan_sec(sym_orig->name)) -+ continue; -+ - if (is_special_static(sym_orig)) - continue; - -@@ -1547,6 +1553,13 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) - if (rela->sym->type != STT_SECTION || !rela->sym->sec) - continue; - -+ /* -+ * UBSAN data will be taken wholesale, no need to -+ * replace section symbols. -+ */ -+ if (is_ubsan_sec(rela->sym->name)) -+ continue; -+ - /* - * These sections don't have symbols associated with - * them: -diff --git a/kpatch-build/kpatch-elf.c b/kpatch-build/kpatch-elf.c -index c7d12ec..405e0d3 100644 ---- a/kpatch-build/kpatch-elf.c -+++ b/kpatch-build/kpatch-elf.c -@@ -587,6 +587,18 @@ bool is_local_sym(struct symbol *sym) - return sym->bind == STB_LOCAL; - } - -+bool is_ubsan_sec(const char *name) { -+ if (!strncmp(name, ".data.rel.local..Lubsan_data", 28) || -+ !strncmp(name, ".data..Lubsan_type", 18) || -+ !strncmp(name, ".Lubsan_data", 12) || -+ !strncmp(name, ".data..Lubsan_data", 18) || -+ !strncmp(name, ".rela.data..Lubsan_data", 23) || -+ !strncmp(name, ".rela.data.rel.local..Lubsan_data", 33)) -+ return true; -+ else -+ return false; -+} -+ - void print_strtab(char *buf, size_t size) - { - size_t i; -diff --git a/kpatch-build/kpatch-elf.h b/kpatch-build/kpatch-elf.h -index cd2900c..187b1d1 100644 ---- a/kpatch-build/kpatch-elf.h -+++ b/kpatch-build/kpatch-elf.h -@@ -170,6 +170,7 @@ bool is_null_sym(struct symbol *sym); - bool is_file_sym(struct symbol *sym); - bool is_local_func_sym(struct symbol *sym); - bool is_local_sym(struct symbol *sym); -+bool is_ubsan_sec(const char *name); - - void print_strtab(char *buf, size_t size); - void kpatch_create_shstrtab(struct kpatch_elf *kelf); -diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c -index f2596b1..2ccc181 100644 ---- a/kpatch-build/lookup.c -+++ b/kpatch-build/lookup.c -@@ -84,7 +84,8 @@ static bool maybe_discarded_sym(const char *name) - !strncmp(name, "__func_stack_frame_non_standard_", 32) || - strstr(name, "__addressable_") || - strstr(name, "__UNIQUE_ID_") || -- !strncmp(name, ".L.str", 6)) -+ !strncmp(name, ".L.str", 6) || -+ is_ubsan_sec(name)) - return true; - - return false; --- -2.45.1 - diff --git a/0101-aarch64-create-diff-object-implementation.patch b/0101-aarch64-create-diff-object-implementation.patch new file mode 100644 index 0000000..d12f973 --- /dev/null +++ b/0101-aarch64-create-diff-object-implementation.patch @@ -0,0 +1,286 @@ +From 1a3af2aaee85bd475bda44993b3e8dc1335497d5 Mon Sep 17 00:00:00 2001 +From: Joe Lawrence +Date: Thu, 10 Oct 2024 16:58:58 -0400 +Subject: [PATCH 101/118] aarch64: create-diff-object implementation + +TODO + +Signed-off-by: Suraj Jitindar Singh +Signed-off-by: Pete Swain +Signed-off-by: Mihails Strasuns +Signed-off-by: Joe Lawrence +--- + kpatch-build/create-diff-object.c | 104 ++++++++++++++++++++++++++---- + kpatch-build/kpatch-elf.c | 8 +++ + kpatch-build/kpatch-elf.h | 1 + + 3 files changed, 101 insertions(+), 12 deletions(-) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 8170b18..e62880b 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -173,6 +173,8 @@ static bool is_gcc6_localentry_bundled_sym(struct kpatch_elf *kelf, + struct symbol *sym) + { + switch(kelf->arch) { ++ case AARCH64: ++ return false; + case PPC64: + return ((PPC64_LOCAL_ENTRY_OFFSET(sym->sym.st_other) != 0) && + sym->sym.st_value == 8); +@@ -230,6 +232,25 @@ static struct rela *toc_rela(const struct rela *rela) + (unsigned int)rela->addend); + } + ++/* ++ * Mapping symbols are used to mark and label the transitions between code and ++ * data in elf files. They begin with a "$" dollar symbol. Don't correlate them ++ * as they often all have the same name either "$x" to mark the start of code ++ * or "$d" to mark the start of data. ++ */ ++static bool kpatch_is_mapping_symbol(struct kpatch_elf *kelf, struct symbol *sym) ++{ ++ if (kelf->arch != AARCH64) ++ return false; ++ ++ if (sym->name && sym->name[0] == '$' && ++ sym->type == STT_NOTYPE && ++ sym->bind == STB_LOCAL) ++ return true; ++ ++ return false; ++} ++ + /* + * When compiling with -ffunction-sections and -fdata-sections, almost every + * symbol gets its own dedicated section. We call such symbols "bundled" +@@ -667,6 +688,12 @@ static bool insn_is_load_immediate(struct kpatch_elf *kelf, void *addr) + + switch(kelf->arch) { + ++ case AARCH64: ++ /* Verify mov w2 */ ++ if ((insn[0] & 0b11111) == 0x2 && insn[3] == 0x52) ++ return true; ++ break; ++ + case X86_64: + /* arg2: mov $imm, %esi */ + if (insn[0] == 0xbe) +@@ -1076,15 +1103,15 @@ static void kpatch_correlate_sections(struct list_head *seclist_orig, + } + } + +-static void kpatch_correlate_symbols(struct list_head *symlist_orig, +- struct list_head *symlist_patched) ++static void kpatch_correlate_symbols(struct kpatch_elf *kelf_orig, ++ struct kpatch_elf *kelf_patched) + { + struct symbol *sym_orig, *sym_patched; + +- list_for_each_entry(sym_orig, symlist_orig, list) { ++ list_for_each_entry(sym_orig, &kelf_orig->symbols, list) { + if (sym_orig->twin) + continue; +- list_for_each_entry(sym_patched, symlist_patched, list) { ++ list_for_each_entry(sym_patched, &kelf_patched->symbols, list) { + if (kpatch_mangled_strcmp(sym_orig->name, sym_patched->name) || + sym_orig->type != sym_patched->type || sym_patched->twin) + continue; +@@ -1104,6 +1131,9 @@ static void kpatch_correlate_symbols(struct list_head *symlist_orig, + !strncmp(sym_orig->name, ".LC", 3)) + continue; + ++ if (kpatch_is_mapping_symbol(kelf_orig, sym_orig)) ++ continue; ++ + /* group section symbols must have correlated sections */ + if (sym_orig->sec && + sym_orig->sec->sh.sh_type == SHT_GROUP && +@@ -1509,7 +1539,7 @@ static void kpatch_correlate_elfs(struct kpatch_elf *kelf_orig, + struct kpatch_elf *kelf_patched) + { + kpatch_correlate_sections(&kelf_orig->sections, &kelf_patched->sections); +- kpatch_correlate_symbols(&kelf_orig->symbols, &kelf_patched->symbols); ++ kpatch_correlate_symbols(kelf_orig, kelf_patched); + } + + static void kpatch_compare_correlated_elements(struct kpatch_elf *kelf) +@@ -1625,7 +1655,8 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) + + if (is_text_section(relasec->base) && + !is_text_section(sym->sec) && +- is_arch(X86_64) && rela->type == R_X86_64_32S && ++ ((is_arch(X86_64) && rela->type == R_X86_64_32S) || ++ (is_arch(AARCH64) && rela->type == R_AARCH64_ABS64)) && + rela->addend == (long)sym->sec->sh.sh_size && + end == (long)sym->sec->sh.sh_size) { + +@@ -1662,6 +1693,9 @@ static void kpatch_replace_sections_syms(struct kpatch_elf *kelf) + */ + } else if (target_off == start && target_off == end) { + ++ if(kpatch_is_mapping_symbol(kelf, sym)) ++ continue; ++ + /* + * Allow replacement for references to + * empty symbols. +@@ -2422,28 +2456,28 @@ static bool static_call_sites_group_filter(struct lookup_table *lookup, + static struct special_section special_sections[] = { + { + .name = "__bug_table", +- .arch = X86_64 | PPC64 | S390, ++ .arch = AARCH64 | X86_64 | PPC64 | S390, + .group_size = bug_table_group_size, + }, + { + .name = ".fixup", +- .arch = X86_64 | PPC64 | S390, ++ .arch = AARCH64 | X86_64 | PPC64 | S390, + .group_size = fixup_group_size, + }, + { + .name = "__ex_table", /* must come after .fixup */ +- .arch = X86_64 | PPC64 | S390, ++ .arch = AARCH64 | X86_64 | PPC64 | S390, + .group_size = ex_table_group_size, + }, + { + .name = "__jump_table", +- .arch = X86_64 | PPC64 | S390, ++ .arch = AARCH64 | X86_64 | PPC64 | S390, + .group_size = jump_table_group_size, + .group_filter = jump_table_group_filter, + }, + { + .name = ".printk_index", +- .arch = X86_64 | PPC64 | S390, ++ .arch = AARCH64 | X86_64 | PPC64 | S390, + .group_size = printk_index_group_size, + }, + { +@@ -2458,7 +2492,7 @@ static struct special_section special_sections[] = { + }, + { + .name = ".altinstructions", +- .arch = X86_64 | S390, ++ .arch = AARCH64 | X86_64 | S390, + .group_size = altinstructions_group_size, + }, + { +@@ -3774,6 +3808,47 @@ static void kpatch_create_ftrace_callsite_sections(struct kpatch_elf *kelf, bool + } + + switch(kelf->arch) { ++ case AARCH64: ++ unsigned char *insn; ++ ++ /* ++ * Assume ppc64le is built with -fpatchable-function-entry=2, which means that all 2 nops are ++ * after the entry point of the function. ++ * ++ * Disassembly of section .text.cmdline_proc_show: ++ * ++ * 0000000000000000 : ++ * 0: d503201f nop << << ++ * 4: d503201f nop ++ * ++ * Relocation section '.rela__patchable_function_entries' ++ * Offset Info Type Symbol's Value Symbol's Name + Addend ++ * 0000000000000008 0000000f00000101 R_AARCH64_ABS64 0000000000000000 .text.cmdline_proc_show + 0 ++ * ^ ++ */ ++ insn_offset = 0; ++ insn = sym->sec->data->d_buf + insn_offset; ++ ++ /* ++ * If BTI (Branch Target Identification) is enabled then there ++ * might be an additional 'BTI C' instruction before the two ++ * patchable function entry 'NOP's. ++ * i.e. 0xd503245f (little endian) ++ */ ++ if (insn[0] == 0x5f) { ++ if (insn[1] != 0x24 || insn[2] != 0x03 || insn[3] != 0xd5) ++ ERROR("%s: unexpected instruction in patch section of function\n", sym->name); ++ insn_offset += 4; ++ insn += 4; ++ } ++ for (int i=0; i<8; i+=4) { ++ /* We expect a NOP i.e. 0xd503201f (little endian) */ ++ if (insn[i] != 0x1f || insn[i + 1] != 0x20 || ++ insn[i + 2] != 0x03 || insn [i + 3] != 0xd5) ++ ERROR("%s: unexpected instruction in patch section of function\n", sym->name); ++ } ++ ++ break; + case PPC64: { + unsigned char *insn; + +@@ -4067,6 +4142,11 @@ static void kpatch_find_func_profiling_calls(struct kpatch_elf *kelf) + continue; + + switch(kelf->arch) { ++ case AARCH64: ++ if (kpatch_symbol_has_pfe_entry(kelf, sym)) { ++ sym->has_func_profiling = 1; ++ } ++ break; + case PPC64: + if (kpatch_symbol_has_pfe_entry(kelf, sym)) { + sym->has_func_profiling = 1; +diff --git a/kpatch-build/kpatch-elf.c b/kpatch-build/kpatch-elf.c +index 073b808..17c0491 100755 +--- a/kpatch-build/kpatch-elf.c ++++ b/kpatch-build/kpatch-elf.c +@@ -156,6 +156,8 @@ struct rela *find_rela_by_offset(struct section *relasec, unsigned int offset) + unsigned int absolute_rela_type(struct kpatch_elf *kelf) + { + switch(kelf->arch) { ++ case AARCH64: ++ return R_AARCH64_ABS64; + case PPC64: + return R_PPC64_ADDR64; + case X86_64: +@@ -225,6 +227,7 @@ long rela_target_offset(struct kpatch_elf *kelf, struct section *relasec, + struct section *sec = relasec->base; + + switch(kelf->arch) { ++ case AARCH64: + case PPC64: + add_off = 0; + break; +@@ -274,6 +277,8 @@ unsigned int insn_length(struct kpatch_elf *kelf, void *addr) + char *insn = addr; + + switch(kelf->arch) { ++ case AARCH64: ++ return 4; + + case X86_64: + insn_init(&decoded_insn, addr, 1); +@@ -604,6 +609,9 @@ struct kpatch_elf *kpatch_elf_open(const char *name) + if (!gelf_getehdr(kelf->elf, &ehdr)) + ERROR("gelf_getehdr"); + switch (ehdr.e_machine) { ++ case EM_AARCH64: ++ kelf->arch = AARCH64; ++ break; + case EM_PPC64: + kelf->arch = PPC64; + break; +diff --git a/kpatch-build/kpatch-elf.h b/kpatch-build/kpatch-elf.h +index 3389dfe..4a3617d 100644 +--- a/kpatch-build/kpatch-elf.h ++++ b/kpatch-build/kpatch-elf.h +@@ -116,6 +116,7 @@ enum architecture { + PPC64 = 0x1 << 0, + X86_64 = 0x1 << 1, + S390 = 0x1 << 2, ++ AARCH64 = 0x1 << 3, + }; + + struct kpatch_elf { +-- +2.48.1 + diff --git a/0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch b/0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch deleted file mode 100644 index 2d17b0e..0000000 --- a/0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 3672db9de548ed4ed5e87089a1263f6b5ddc4a11 Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Mon, 13 Feb 2023 15:14:32 -0800 -Subject: [PATCH 101/112] create-diff-object: handle __initcall_stub with - CONFIG_LTO_CLANG - -The kernel use a special __initcall_stub() with CONFIG_LTO_CLANG to avoid -name collisions. Handle it in kpatch_mangled_strcmp() by ignoring all -digits for symbols start with __initstub__kmod_syscall__. - -Signed-off-by: Song Liu ---- - kpatch-build/create-diff-object.c | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - -diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c -index 2d7b072..fec57b8 100644 ---- a/kpatch-build/create-diff-object.c -+++ b/kpatch-build/create-diff-object.c -@@ -430,6 +430,23 @@ static int __kpatch_unique_id_strcmp(char *s1, char *s2) - return 1; - } - -+static int __kpatch_skip_digits_strcmp(char *s1, char *s2) -+{ -+ while (*s1 == *s2) { -+ if (!*s1) -+ return 0; -+ s1++; -+ s2++; -+ -+ while (isdigit(*s1)) -+ s1++; -+ while (isdigit(*s2)) -+ s2++; -+ } -+ -+ return 1; -+} -+ - /* - * This is like strcmp, but for gcc-mangled symbols. It skips the comparison - * of any substring which consists of '.' followed by any number of digits. -@@ -446,6 +463,19 @@ static int kpatch_mangled_strcmp(char *s1, char *s2) - if (!strncmp(s1, "__UNIQUE_ID_", 12)) - return __kpatch_unique_id_strcmp(s1, s2); - -+ /* -+ * Hack for __initcall_stub() with CONFIG_LTO_CLANG. -+ * The following should match: -+ * -+ * __initstub__kmod_syscall__728_5326_bpf_syscall_sysctl_init7 -+ * __initstub__kmod_syscall__728_5324_bpf_syscall_sysctl_init7 -+ * -+ * Please refer to __initcall_stub() in include/linux/init.h for -+ * more details. -+ */ -+ if (!strncmp(s1, "__initstub__kmod_syscall__", 26)) -+ return __kpatch_skip_digits_strcmp(s1, s2); -+ - while (*s1 == *s2) { - if (!*s1) - return 0; --- -2.45.1 - diff --git a/0102-aarch64-kmod-kpatch-syscall.h-add-aarch64-helper.patch b/0102-aarch64-kmod-kpatch-syscall.h-add-aarch64-helper.patch new file mode 100644 index 0000000..0cafcbf --- /dev/null +++ b/0102-aarch64-kmod-kpatch-syscall.h-add-aarch64-helper.patch @@ -0,0 +1,58 @@ +From bbd47f279def867b79c00e36038277d85eb374c4 Mon Sep 17 00:00:00 2001 +From: Pete Swain +Date: Fri, 28 Jul 2023 16:34:10 -0700 +Subject: [PATCH 102/118] aarch64: kmod: kpatch-syscall.h: add aarch64 helper + +Copy from kernel source tree. + +Signed-off-by: Misono Tomohiro +Signed-off-by: Pete Swain +Signed-off-by: Mihails Strasuns +Signed-off-by: Joe Lawrence +--- + kmod/patch/kpatch-syscall.h | 29 ++++++++++++++++++++++++++++- + 1 file changed, 28 insertions(+), 1 deletion(-) + +diff --git a/kmod/patch/kpatch-syscall.h b/kmod/patch/kpatch-syscall.h +index 6ecf36f..d93d10d 100644 +--- a/kmod/patch/kpatch-syscall.h ++++ b/kmod/patch/kpatch-syscall.h +@@ -210,7 +210,34 @@ + + # endif /* LINUX_VERSION_CODE */ + +-#endif /* CONFIG_X86_64 */ ++#elif defined(CONFIG_ARM64) ++ ++/* arm64/include/asm/syscall_wrapper.h versions */ ++ ++#define SC_ARM64_REGS_TO_ARGS(x, ...) \ ++ __MAP(x,__SC_ARGS \ ++ ,,regs->regs[0],,regs->regs[1],,regs->regs[2] \ ++ ,,regs->regs[3],,regs->regs[4],,regs->regs[5]) ++ ++#define __KPATCH_SYSCALL_DEFINEx(x, name, ...) \ ++ asmlinkage long __arm64_sys##name(const struct pt_regs *regs); \ ++ ALLOW_ERROR_INJECTION(__arm64_sys##name, ERRNO); \ ++ static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ ++ static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ ++ asmlinkage long __arm64_sys##name(const struct pt_regs *regs) \ ++ { \ ++ return __se_sys##name(SC_ARM64_REGS_TO_ARGS(x,__VA_ARGS__)); \ ++ } \ ++ static long __se_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ ++ { \ ++ long ret = __kpatch_do_sys##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \ ++ __MAP(x,__SC_TEST,__VA_ARGS__); \ ++ __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ ++ return ret; \ ++ } \ ++ static inline long __kpatch_do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) ++ ++#endif /* which arch */ + + + #ifndef __KPATCH_SYSCALL_DEFINEx +-- +2.48.1 + diff --git a/0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch b/0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch deleted file mode 100644 index 6ea4f21..0000000 --- a/0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch +++ /dev/null @@ -1,187 +0,0 @@ -From 3db1cfb91b9b2b7cf6c5564995c446567baa371a Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Fri, 3 Feb 2023 10:28:16 -0800 -Subject: [PATCH 102/112] kpatch-build: support CONFIG_LTO_CLANG_THIN - -Support CONFIG_LTO_CLANG_THIN with ld.lld --lto-obj-path option. - -With CONFIG_LTO_CLANG_THIN, .o files are LLVM IR binary, so CDO doesn't -work on .o file. To solve this issue, we CDO the thinlto files generated -by the --lto-obj-path option. Clang LTO generates the thinlto files -after cross file inline, so they are good candidates for CDO. See [1] for -more discussions about this. - -To achieve this, we need: - - 1. kpatch-build to update kernel Makefile(s) so it generates thinlto - files; - 2. kpatch-build and kpatch-cc to save the thinlto file properly; - 3. kpatch-build to feed these thinlto files to CDO; - 4. The user need to supply vmlinux.o, from which we generate the symtab - file. We need this because GLOBAL symbols may be marked as LOCAL in - LTO vmlinux; - -[1] https://github.com/dynup/kpatch/issues/1320 - -Signed-off-by: Song Liu ---- - kpatch-build/kpatch-build | 59 +++++++++++++++++++++++++++++++++------ - kpatch-build/kpatch-cc | 18 ++++++++++++ - 2 files changed, 68 insertions(+), 9 deletions(-) - -diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build -index 45e8b14..f712578 100755 ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -173,11 +173,11 @@ cleanup() { - # restore original vmlinux if it was overwritten by sourcedir build - [[ -e "$TEMPDIR/vmlinux" ]] && mv -f "$TEMPDIR/vmlinux" "$KERNEL_SRCDIR/" - -- # restore original link-vmlinux.sh if we updated it for the build -+ # restore any files that were modified for the build - [[ -e "$TEMPDIR/link-vmlinux.sh" ]] && mv -f "$TEMPDIR/link-vmlinux.sh" "$KERNEL_SRCDIR/scripts" -- -- # restore original Makefile.modfinal if we updated it for the build - [[ -e "$TEMPDIR/Makefile.modfinal" ]] && mv -f "$TEMPDIR/Makefile.modfinal" "$KERNEL_SRCDIR/scripts" -+ [[ -e "$TEMPDIR/Makefile.build" ]] && mv -f "$TEMPDIR/Makefile.build" "$KERNEL_SRCDIR/scripts" -+ [[ -e "$TEMPDIR/Makefile" ]] && mv -f "$TEMPDIR/Makefile" "$KERNEL_SRCDIR" - - [[ "$DEBUG" -eq 0 ]] && rm -rf "$TEMPDIR" - rm -rf "$RPMTOPDIR" -@@ -1054,6 +1054,23 @@ if [[ -n "$CONFIG_DEBUG_INFO_BTF" ]]; then - fi - fi - -+if [[ -n "$CONFIG_LTO_CLANG" ]]; then -+ [[ -n "$CONFIG_LTO_CLANG_THIN" ]] || die "Non-thin LTO is not supported. Please enable CONFIG_LTO_CLANG_THIN" -+ -+ # This is a heuristic: use -x to check vmlinux vs. vmlinux.o -+ [[ -x "$VMLINUX" ]] && die "For kernel with CONFIG_LTO_CLANG, please supply vmlinux.o instead of vmlinux via -v|--vmlinux option." -+ -+ # update Makefile so that ld.lld generate vmlinux.o.thinlto.o* files for vmlinux.o -+ cp -f "$KERNEL_SRCDIR/Makefile" "$TEMPDIR/Makefile" || die -+ sed -i "s/--thinlto-cache-dir=\$(extmod_prefix).thinlto-cache/--lto-obj-path=vmlinux.o.thinlto.o/g" "$KERNEL_SRCDIR"/Makefile -+ -+ # update scripts/Makefile.build so that ld.lld generate XX.o.thinlto.o* files for modules -+ cp -f "$KERNEL_SRCDIR/scripts/Makefile.build" "$TEMPDIR/Makefile.build" || die -+ sed -i "s/\$(ld_flags)/\$(ld_flags) --lto-obj-path=\$@.thinlto.o/g" "$KERNEL_SRCDIR"/scripts/Makefile.build -+ -+ export KPATCH_CC_LTO=1 -+fi -+ - if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then - echo "WARNING: Clang support is experimental" - fi -@@ -1174,9 +1191,14 @@ if [[ -n "$CONFIG_MODVERSIONS" ]]; then - trace_on - fi - -+if [[ -n "$CONFIG_LTO_CLANG" ]]; then -+ DIFF_OBJS="$TEMPDIR/thinlto_objs" -+else -+ DIFF_OBJS="$TEMPDIR/changed_objs" -+fi - # Read as words, no quotes. - # shellcheck disable=SC2013 --for i in $(cat "$TEMPDIR/changed_objs") -+for i in $(cat "$DIFF_OBJS") - do - mkdir -p "$TEMPDIR/patched/$(dirname "$i")" || die - cp -f "$BUILDDIR/$i" "$TEMPDIR/patched/$i" || die -@@ -1205,7 +1227,8 @@ if [[ -z "$MODNAME" ]] ; then - - MODNAME="$(module_name_string "$MODNAME")" - fi --FILES="$(cat "$TEMPDIR/changed_objs")" -+FILES="$(cat "$DIFF_OBJS")" -+ - cd "$TEMPDIR" || die - mkdir output - declare -a objnames -@@ -1229,7 +1252,11 @@ for i in $FILES; do - - mkdir -p "output/$(dirname "$i")" - cd "$BUILDDIR" || die -- find_kobj "$i" -+ if [[ -n "$CONFIG_LTO_CLANG" ]] ; then -+ KOBJFILE=${i/.o.thinlto.o*/} -+ else -+ find_kobj "$i" -+ fi - cd "$TEMPDIR" || die - if [[ -e "orig/$i" ]]; then - if [[ -n $OOT_MODULE ]]; then -@@ -1246,16 +1273,30 @@ for i in $FILES; do - else - KOBJFILE_NAME=$(basename "${KOBJFILE%.ko}") - KOBJFILE_NAME="${KOBJFILE_NAME//-/_}" -- KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE" -+ if [[ -n "$CONFIG_LTO_CLANG" ]] ; then -+ KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE.ko" -+ else -+ KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE" -+ fi - SYMTAB="${KOBJFILE_PATH}.symtab" - SYMVERS_FILE="$BUILDDIR/Module.symvers" - fi - -- "$READELF" -s --wide "$KOBJFILE_PATH" > "$SYMTAB" -+ # With CONFIG_LTO_CLANG, multiple .thinlto files share a -+ # symtab file. Only generate the symtab file once. -+ [[ -e "$SYMTAB" ]] || "$READELF" --symbols --wide "$KOBJFILE_PATH" > "$SYMTAB" - if [[ "$ARCH" = "ppc64le" ]]; then - sed -ri 's/\s+\[: 8\]//' "$SYMTAB" - fi - -+ if [[ -n "$CONFIG_LTO_CLANG" ]] ; then -+ # skip .thinlto file that didn't change at all -+ diff "orig/$i" "patched/$i" 2> /dev/null && continue -+ # skip .thinlto file without any functions -+ num_func=$("$READELF" --symbols "orig/$i" | grep -c FUNC) -+ [[ $num_func -eq 0 ]] && continue -+ fi -+ - # create-diff-object orig.o patched.o parent-name parent-symtab - # Module.symvers patch-mod-name output.o - "$TOOLSDIR"/create-diff-object $CDO_FLAGS "orig/$i" "patched/$i" "$KOBJFILE_NAME" \ -@@ -1308,7 +1349,7 @@ fi - cd "$TEMPDIR/output" || die - # $KPATCH_LDFLAGS and result of find used as list, no quotes. - # shellcheck disable=SC2086,SC2046 --"$LD" -r $KPATCH_LDFLAGS -o ../patch/tmp_output.o $(find . -name "*.o") 2>&1 | logger || die -+"$LD" -r $KPATCH_LDFLAGS -o ../patch/tmp_output.o $(find . -name "*.o*") 2>&1 | logger || die - - if [[ "$USE_KLP" -eq 1 ]]; then - cp -f "$TEMPDIR"/patch/tmp_output.o "$TEMPDIR"/patch/output.o || die -diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc -index 2a3d264..7e9e1be 100755 ---- a/kpatch-build/kpatch-cc -+++ b/kpatch-build/kpatch-cc -@@ -79,6 +79,24 @@ elif [[ "$TOOLCHAINCMD" =~ ^(.*-)?ld || "$TOOLCHAINCMD" =~ ^(.*-)?ld.lld ]] ; th - args+=(--warn-unresolved-symbols) - break - ;; -+ */.tmp_*.o) -+ # .tmp_*.o is used for single file modules. -+ # See "cmd_ld_single_m" in scripts/Makefile.build. -+ if [[ $KPATCH_CC_LTO -eq 1 ]] ; then -+ mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" -+ cp "${obj/.tmp_/}".thinlto.o* "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" -+ echo "${obj/.tmp_/}".thinlto.o* >> "$KPATCH_GCC_TEMPDIR/thinlto_objs" -+ fi -+ break -+ ;; -+ *.o) -+ if [[ $KPATCH_CC_LTO -eq 1 ]] ; then -+ mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" -+ cp "$obj".thinlto* "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" -+ echo "$obj".thinlto.o* >> "$KPATCH_GCC_TEMPDIR/thinlto_objs" -+ fi -+ break -+ ;; - *) - break - ;; --- -2.45.1 - diff --git a/0103-aarch64-kpatch-build-aarch64-implementation.patch b/0103-aarch64-kpatch-build-aarch64-implementation.patch new file mode 100644 index 0000000..69d81dd --- /dev/null +++ b/0103-aarch64-kpatch-build-aarch64-implementation.patch @@ -0,0 +1,59 @@ +From 943edf5bc8079fee8806af6a902852dc22b5db3c Mon Sep 17 00:00:00 2001 +From: Joe Lawrence +Date: Thu, 10 Oct 2024 17:09:46 -0400 +Subject: [PATCH 103/118] aarch64: kpatch-build aarch64 implementation + +TODO + +Signed-off-by: Suraj Jitindar Singh +Signed-off-by: Pete Swain +Signed-off-by: Mihails Strasuns +Signed-off-by: Joe Lawrence +--- + kpatch-build/Makefile | 2 +- + kpatch-build/kpatch-build | 3 +++ + kpatch-build/kpatch-cc | 1 + + 3 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/Makefile b/kpatch-build/Makefile +index 4e964b7..1969fff 100644 +--- a/kpatch-build/Makefile ++++ b/kpatch-build/Makefile +@@ -21,7 +21,7 @@ PLUGIN_CFLAGS := $(filter-out -std=gnu11 -Wconversion, $(CFLAGS)) + PLUGIN_CFLAGS += -shared -I$(GCC_PLUGINS_DIR)/include \ + -Igcc-plugins -fPIC -fno-rtti -O2 -Wall + endif +-ifeq ($(filter $(ARCH),s390x x86_64 ppc64le),) ++ifeq ($(filter $(ARCH),aarch64 s390x x86_64 ppc64le),) + $(error Unsupported architecture ${ARCH}, check https://github.com/dynup/kpatch/#supported-architectures) + endif + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index bc112fc..643d85c 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -382,6 +382,9 @@ find_special_section_data() { + + # Arch-specific features + case "$ARCH" in ++ "aarch64") ++ check[a]=true # alt_instr ++ ;; + "x86_64") + check[a]=true # alt_instr + kernel_version_gte 5.10.0 && check[s]=true # static_call_site +diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc +index 17aae25..5456179 100755 +--- a/kpatch-build/kpatch-cc ++++ b/kpatch-build/kpatch-cc +@@ -31,6 +31,7 @@ if [[ "$TOOLCHAINCMD" =~ ^(.*-)?gcc$ || "$TOOLCHAINCMD" =~ ^(.*-)?clang$ ]] ; th + vmlinux.o|\ + .tmp_kallsyms1.o|\ + .tmp_kallsyms2.o|\ ++ arch/arm64/kernel/vdso*/*|\ + arch/x86/boot/*|\ + arch/x86/entry/vdso/*|\ + arch/x86/purgatory/*|\ +-- +2.48.1 + diff --git a/0103-create-diff-object-compare-section-name-with-kpatch_.patch b/0103-create-diff-object-compare-section-name-with-kpatch_.patch deleted file mode 100644 index 4f5a28e..0000000 --- a/0103-create-diff-object-compare-section-name-with-kpatch_.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 47d1b39ba7686e2368c1ad24af274dfd9f54ecf9 Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Wed, 13 Oct 2021 00:10:20 -0700 -Subject: [PATCH 103/112] create-diff-object: compare section name with - kpatch_section_function_name - -Profile-Guided Optimization (PGO) uses profiling data to help the compiler -to evaluate the properties of a function, and thus adds different prefixes -to the section/function. For example, with -ffunction-sections, the -compiler will prefix some sectiones with .text.unlikely. However, if a -function changes from the version in the profiling data, the compiler may -ignore the profiling data. This often happens to the patched function -when kpatch-build builds the patch. As a result, the original function -and the patch function may have different prefix, i.e., one of them has -.text, the other has .text.unlikely. - -To correlate these functions properly, use kpatch_section_function_name() -in kpatch_correlate_sections() to find matching sections. - -Signed-off-by: Song Liu ---- - kpatch-build/create-diff-object.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c -index fec57b8..e88cb3b 100644 ---- a/kpatch-build/create-diff-object.c -+++ b/kpatch-build/create-diff-object.c -@@ -1053,6 +1053,8 @@ static void kpatch_correlate_section(struct section *sec_orig, - kpatch_correlate_symbol(sec_orig->sym, sec_patched->sym); - } - -+static char *kpatch_section_function_name(struct section *sec); -+ - static void kpatch_correlate_sections(struct list_head *seclist_orig, - struct list_head *seclist_patched) - { -@@ -1062,8 +1064,9 @@ static void kpatch_correlate_sections(struct list_head *seclist_orig, - if (sec_orig->twin) - continue; - list_for_each_entry(sec_patched, seclist_patched, list) { -- if (kpatch_mangled_strcmp(sec_orig->name, sec_patched->name) || -- sec_patched->twin) -+ if (sec_patched->twin || -+ kpatch_mangled_strcmp(kpatch_section_function_name(sec_orig), -+ kpatch_section_function_name(sec_patched))) - continue; - - if (is_ubsan_sec(sec_orig->name)) --- -2.45.1 - diff --git a/0104-aarch64-documentation-update.patch b/0104-aarch64-documentation-update.patch new file mode 100644 index 0000000..adead1f --- /dev/null +++ b/0104-aarch64-documentation-update.patch @@ -0,0 +1,50 @@ +From 04a4f32179c547128e81b35657a1bf6dc6c6ae3e Mon Sep 17 00:00:00 2001 +From: Joe Lawrence +Date: Thu, 10 Oct 2024 17:11:00 -0400 +Subject: [PATCH 104/118] aarch64: documentation update + +TODO + +Signed-off-by: Suraj Jitindar Singh +Signed-off-by: Pete Swain +Signed-off-by: Mihails Strasuns +Signed-off-by: Joe Lawrence +--- + README.md | 2 +- + doc/arm64-upstream-prerequisites.md | 11 +++++++++++ + 2 files changed, 12 insertions(+), 1 deletion(-) + create mode 100644 doc/arm64-upstream-prerequisites.md + +diff --git a/README.md b/README.md +index 6cade1c..5054ccd 100644 +--- a/README.md ++++ b/README.md +@@ -40,7 +40,7 @@ Supported Architectures + + - [x] x86-64 + - [x] ppc64le +-- [ ] arm64 ++- [x] arm64 + - [x] s390 [upstream prerequisites](doc/s390-upstream-prerequisites.md) + + Installation +diff --git a/doc/arm64-upstream-prerequisites.md b/doc/arm64-upstream-prerequisites.md +new file mode 100644 +index 0000000..3c49af8 +--- /dev/null ++++ b/doc/arm64-upstream-prerequisites.md +@@ -0,0 +1,11 @@ ++### arm64 backporting ++ ++**Prerequisite kernel patches:** ++**v5.19:** ++- [Madhavan Venkataraman's [RFC PATCH v2 00/20] arm64: livepatch: Use ORC for dynamic frame pointer validation](https://lore.kernel.org/linux-arm-kernel/20220524001637.1707472-1-madvenka@linux.microsoft.com/) ++- also tested against madvenka's earlier pre-objtool series up to v15 ++ ++**v5.15 and v5.10:** ++- under development, both known to work with backports of madvenka's v15, ++ but the objtool-using version above is likely to be the approach that ++ finally merges into upstream kernel +-- +2.48.1 + diff --git a/0104-kpatch-build-add-support-for-clang-pgo.patch b/0104-kpatch-build-add-support-for-clang-pgo.patch deleted file mode 100644 index ae1ccae..0000000 --- a/0104-kpatch-build-add-support-for-clang-pgo.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 19c4942a1415d0f99c910949ba55c95ddcc5a976 Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Wed, 13 Oct 2021 01:03:55 -0700 -Subject: [PATCH 104/112] kpatch-build: add support for clang pgo - -For clang with Profile-Guided Optimization (PGO), profile data is needed -to compile the livepatch properly. Add option -p|--profile-data, which -specifies the profile data file. This option is only valid with -CONFIG_CC_IS_CLANG and CONFIG_PGO_CLANG. - -Signed-off-by: Song Liu ---- - kpatch-build/kpatch-build | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - -diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build -index f712578..fc9f92b 100755 ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -677,9 +677,10 @@ usage() { - echo " --skip-cleanup Skip post-build cleanup" >&2 - echo " --skip-compiler-check Skip compiler version matching check" >&2 - echo " (not recommended)" >&2 -+ echo " -p, --profile-data specify profile data for PGO (clang only)" >&2 - } - --options="$(getopt -o ha:r:s:c:v:j:t:n:o:dR -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace" -- "$@")" || die "getopt failed" -+options="$(getopt -o ha:r:s:c:v:j:t:n:o:dRp: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace,profile-data" -- "$@")" || die "getopt failed" - - eval set -- "$options" - -@@ -761,6 +762,10 @@ while [[ $# -gt 0 ]]; do - echo "WARNING: Skipping compiler version matching check (not recommended)" - SKIPCOMPILERCHECK=1 - ;; -+ -p|--profile-data) -+ PROFILE_DATA="$(readlink -f "$2")" -+ shift -+ ;; - *) - [[ "$1" = "--" ]] && shift && continue - [[ ! -f "$1" ]] && die "patch file '$1' not found" -@@ -1073,6 +1078,16 @@ fi - - if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then - echo "WARNING: Clang support is experimental" -+ if [[ -z "$PROFILE_DATA" ]] && [[ -n "$CONFIG_PGO_CLANG" ]]; then -+ die "Please specify profile-data for CONFIG_PGO_CLANG" -+ fi -+ if [[ -n "$PROFILE_DATA" ]] && [[ -z "$CONFIG_PGO_CLANG" ]]; then -+ echo "WARNING profile-data specified w/o CONFIG_PGO_CLANG, ignore it" -+ fi -+else -+ if [[ -n "$PROFILE_DATA" ]]; then -+ die "Only supports profile-data with Clang" -+ fi - fi - - if [[ "$SKIPCOMPILERCHECK" -eq 0 ]]; then -@@ -1124,6 +1139,10 @@ declare -a MAKEVARS - if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then - MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${CLANG}") - MAKEVARS+=("HOSTCC=clang") -+ if [[ -n "$CONFIG_PGO_CLANG" ]]; then -+ MAKEVARS+=("CFLAGS_PGO_CLANG=-fprofile-use=$PROFILE_DATA") -+ MAKEVARS+=("LLVM=1") -+ fi - else - MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${GCC}") - fi --- -2.45.1 - diff --git a/0105-arm64-Skip-offset-check-in-kpatch_bundle_symbols.patch b/0105-arm64-Skip-offset-check-in-kpatch_bundle_symbols.patch new file mode 100644 index 0000000..8a866fe --- /dev/null +++ b/0105-arm64-Skip-offset-check-in-kpatch_bundle_symbols.patch @@ -0,0 +1,29 @@ +From 66da21b27722a6e1550cfd3a0c846e68f01d5bdc Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Wed, 22 Jan 2025 13:17:35 -0800 +Subject: [PATCH 105/118] arm64: Skip offset check in kpatch_bundle_symbols + +Set expected_offset for AARCH64 directly to sym->sym.st_value, so the +test is skipped. + +Signed-off-by: Song Liu +--- + kpatch-build/create-diff-object.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index e62880b..16cc1a1 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -267,6 +267,8 @@ static void kpatch_bundle_symbols(struct kpatch_elf *kelf) + expected_offset = sym->pfx->sym.st_size; + else if (is_gcc6_localentry_bundled_sym(kelf, sym)) + expected_offset = 8; ++ else if (kelf->arch == AARCH64) ++ expected_offset = (unsigned int)sym->sym.st_value; + else + expected_offset = 0; + +-- +2.48.1 + diff --git a/0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch b/0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch deleted file mode 100644 index b81a1e3..0000000 --- a/0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 88bf611ea0a16930a764509a59700cc2418641f0 Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Wed, 1 Mar 2023 15:25:19 -0800 -Subject: [PATCH 105/112] create-diff-object: ignore section - .rel.llvm.call-graph-profile - -This section is used by llvm to store profile data. Ignore it in the -livepatch. - -Signed-off-by: Song Liu ---- - kpatch-build/create-diff-object.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c -index e88cb3b..4e3341e 100644 ---- a/kpatch-build/create-diff-object.c -+++ b/kpatch-build/create-diff-object.c -@@ -2869,6 +2869,7 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf) - if (!strncmp(sec->name, ".discard", 8) || - !strncmp(sec->name, ".rela.discard", 13) || - !strncmp(sec->name, ".llvm_addrsig", 13) || -+ !strncmp(sec->name, ".rel.llvm.call-graph-profile", 28) || - !strncmp(sec->name, ".llvm.", 6)) - sec->ignore = 1; - } --- -2.45.1 - diff --git a/0106-Ignore-symbols-like-.Ltmp-ID.patch b/0106-Ignore-symbols-like-.Ltmp-ID.patch new file mode 100644 index 0000000..92f9817 --- /dev/null +++ b/0106-Ignore-symbols-like-.Ltmp-ID.patch @@ -0,0 +1,29 @@ +From 12ee75a821dbfb2ded0752d495d4589e9dd09649 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Thu, 23 Jan 2025 15:34:35 -0800 +Subject: [PATCH 106/118] Ignore symbols like .Ltmp + +Signed-off-by: Song Liu +--- + kpatch-build/create-diff-object.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 16cc1a1..866db33 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -955,6 +955,11 @@ static void kpatch_compare_correlated_symbol(struct symbol *sym) + { + struct symbol *sym1 = sym, *sym2 = sym->twin; + ++ if (strncmp(sym->name, ".Ltmp", 5) == 0) { ++ sym->status = SAME; ++ return; ++ } ++ + if (sym1->sym.st_info != sym2->sym.st_info || + (sym1->sec && !sym2->sec) || + (sym2->sec && !sym1->sec)) +-- +2.48.1 + diff --git a/0106-kpatch-build-Run-objtool-on-thinlto-files.patch b/0106-kpatch-build-Run-objtool-on-thinlto-files.patch deleted file mode 100644 index d3360ce..0000000 --- a/0106-kpatch-build-Run-objtool-on-thinlto-files.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 764a57b1756dffba9bf7c990f752dbd739ea149f Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Mon, 6 Mar 2023 22:43:43 -0800 -Subject: [PATCH 106/112] kpatch-build: Run objtool on thinlto files - -In this way, CDO should generate patches with required sections, such as -the .orc sections. - -Signed-off-by: Song Liu ---- - kpatch-build/kpatch-build | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build -index fc9f92b..938e88f 100755 ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -1212,6 +1212,9 @@ fi - - if [[ -n "$CONFIG_LTO_CLANG" ]]; then - DIFF_OBJS="$TEMPDIR/thinlto_objs" -+ -+ # Get the objtool command line, so we can run it on the thinlto files -+ OBJTOOL_CMD=$(grep -o -e "/tools/objtool/objtool .*" "$BUILDDIR"/.vmlinux.o.cmd | sed 's/vmlinux.o//') - else - DIFF_OBJS="$TEMPDIR/changed_objs" - fi -@@ -1314,6 +1317,13 @@ for i in $FILES; do - # skip .thinlto file without any functions - num_func=$("$READELF" --symbols "orig/$i" | grep -c FUNC) - [[ $num_func -eq 0 ]] && continue -+ if [[ $i = vmlinux.o.* ]] ; then -+ eval "$BUILDDIR/$OBJTOOL_CMD orig/$i" -+ eval "$BUILDDIR/$OBJTOOL_CMD patched/$i" -+ else -+ eval "$BUILDDIR/$OBJTOOL_CMD --module orig/$i" -+ eval "$BUILDDIR/$OBJTOOL_CMD --module patched/$i" -+ fi - fi - - # create-diff-object orig.o patched.o parent-name parent-symtab --- -2.45.1 - diff --git a/0107-create-diff-object-handle-__initcall_stub-with-CONFI.patch b/0107-create-diff-object-handle-__initcall_stub-with-CONFI.patch new file mode 100644 index 0000000..2988501 --- /dev/null +++ b/0107-create-diff-object-handle-__initcall_stub-with-CONFI.patch @@ -0,0 +1,67 @@ +From c0d05b70cd68774c933b59586a763c5bf23d4334 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Mon, 13 Feb 2023 15:14:32 -0800 +Subject: [PATCH 107/118] create-diff-object: handle __initcall_stub with + CONFIG_LTO_CLANG + +The kernel use a special __initcall_stub() with CONFIG_LTO_CLANG to avoid +name collisions. Handle it in kpatch_mangled_strcmp() by ignoring all +digits for symbols start with __initstub__kmod_syscall__. + +Signed-off-by: Song Liu +(cherry picked from commit 3672db9de548ed4ed5e87089a1263f6b5ddc4a11) +--- + kpatch-build/create-diff-object.c | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 866db33..22a0155 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -462,6 +462,23 @@ static int __kpatch_unique_id_strcmp(char *s1, char *s2) + return 1; + } + ++static int __kpatch_skip_digits_strcmp(char *s1, char *s2) ++{ ++ while (*s1 == *s2) { ++ if (!*s1) ++ return 0; ++ s1++; ++ s2++; ++ ++ while (isdigit(*s1)) ++ s1++; ++ while (isdigit(*s2)) ++ s2++; ++ } ++ ++ return 1; ++} ++ + /* + * This is like strcmp, but for gcc-mangled symbols. It skips the comparison + * of any substring which consists of '.' followed by any number of digits. +@@ -478,6 +495,19 @@ static int kpatch_mangled_strcmp(char *s1, char *s2) + if (!strncmp(s1, "__UNIQUE_ID_", 12)) + return __kpatch_unique_id_strcmp(s1, s2); + ++ /* ++ * Hack for __initcall_stub() with CONFIG_LTO_CLANG. ++ * The following should match: ++ * ++ * __initstub__kmod_syscall__728_5326_bpf_syscall_sysctl_init7 ++ * __initstub__kmod_syscall__728_5324_bpf_syscall_sysctl_init7 ++ * ++ * Please refer to __initcall_stub() in include/linux/init.h for ++ * more details. ++ */ ++ if (!strncmp(s1, "__initstub__kmod_syscall__", 26)) ++ return __kpatch_skip_digits_strcmp(s1, s2); ++ + while (*s1 == *s2) { + if (!*s1) + return 0; +-- +2.48.1 + diff --git a/0107-kpatch-build-skip-more-symbols-in-locals_match.patch b/0107-kpatch-build-skip-more-symbols-in-locals_match.patch deleted file mode 100644 index 35697ff..0000000 --- a/0107-kpatch-build-skip-more-symbols-in-locals_match.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b479edd20f6083c65cda9c9277cc54cc56ce0939 Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Wed, 15 Mar 2023 11:21:31 -0700 -Subject: [PATCH 107/112] kpatch-build: skip more symbols in locals_match - -Skip table_sym with maybe_discarded_sym() == true. This is probably only -needed for LTO build. - -Signed-off-by: Song Liu ---- - kpatch-build/lookup.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c -index 2ccc181..c8844f8 100644 ---- a/kpatch-build/lookup.c -+++ b/kpatch-build/lookup.c -@@ -107,6 +107,8 @@ static bool locals_match(struct lookup_table *table, int idx, - if (table_sym->type != STT_FUNC && table_sym->type != STT_OBJECT) - continue; - -+ if (maybe_discarded_sym(table_sym->name)) -+ continue; - found = 0; - sym = file_sym; - list_for_each_entry_continue(sym, sym_list, list) { -@@ -115,6 +117,8 @@ static bool locals_match(struct lookup_table *table, int idx, - if (sym->bind != STB_LOCAL) - continue; - -+ if (maybe_discarded_sym(sym->name)) -+ continue; - if (sym->type == table_sym->type && - !strcmp(sym->name, table_sym->name)) { - found = 1; --- -2.45.1 - diff --git a/0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch b/0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch deleted file mode 100644 index 2b291bd..0000000 --- a/0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch +++ /dev/null @@ -1,114 +0,0 @@ -From f38c64b7e490c6de1208f277d767bd7b8029edcc Mon Sep 17 00:00:00 2001 -From: Josh Poimboeuf -Date: Mon, 13 Mar 2023 13:51:01 -0700 -Subject: [PATCH 108/112] kpatch-build: Fix setlocalversion issue with 6.3 - kernel - -The kernel has a VERMAGIC_STRING, e.g. "6.2.0". The module loader uses -that string to ensure that all loaded modules' version strings match the -kernel's. - -If the kernel source is in a git tree, and if there are uncommitted -changes, the version string will have a '+' or "-dirty" appended to it, -like "6.1.0+" or "6.2.0-dirty". This dirty tree detection is done by -the setlocalversion script. - -This affects kpatch-build in a few ways. When it builds the original -kernel, in some cases there are uncommitted changes to the makefiles. -When it builds the patched kernel, there are additional uncommitted -changes due to the .patch file being applied. - -We want to avoid the VERMAGIC_STRING changing between builds. Otherwise -it would cause problems: - - - object code which uses that string would change unnecessarily, - causing a false positive change detected by create-diff-object - - - the linked patch module would report the wrong version, resulting in - the module failing to load due to version mismatch. - -Up until now, the version was prevented from changing by running -`setlocalversion --save-scmversion` before the build. That command -hard-codes the version by saving it to a file which is then -automatically read later during future invocations of the kernel build. - -Unfortunately that feature was removed in the 6.3 merge window with -commit f6e09b07cc12 ("kbuild: do not put .scmversion into the source -tarball"). So we need to come up with a new approach. - -Fix it by temporarily replacing the setlocalversion script with a -one-liner which just echo's the original version. I think this is -unfortunately the best we can do, as we really can't handle -VERMAGIC_STRING changing, either during/between kernel builds or during -the module link. - -Fixes #1335. - -Signed-off-by: Josh Poimboeuf -(cherry picked from commit 629b5acf3dab0311e1bebbffec4908999273d58d) ---- - kpatch-build/kpatch-build | 25 +++++++++++++++++++++---- - 1 file changed, 21 insertions(+), 4 deletions(-) - -diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build -index 938e88f..429f214 100755 ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -166,11 +166,9 @@ remove_patches() { - } - - cleanup() { -- rm -f "$BUILDDIR/.scmversion" -- - remove_patches - -- # restore original vmlinux if it was overwritten by sourcedir build -+ # restore any files that were modified for the build - [[ -e "$TEMPDIR/vmlinux" ]] && mv -f "$TEMPDIR/vmlinux" "$KERNEL_SRCDIR/" - - # restore any files that were modified for the build -@@ -178,6 +176,7 @@ cleanup() { - [[ -e "$TEMPDIR/Makefile.modfinal" ]] && mv -f "$TEMPDIR/Makefile.modfinal" "$KERNEL_SRCDIR/scripts" - [[ -e "$TEMPDIR/Makefile.build" ]] && mv -f "$TEMPDIR/Makefile.build" "$KERNEL_SRCDIR/scripts" - [[ -e "$TEMPDIR/Makefile" ]] && mv -f "$TEMPDIR/Makefile" "$KERNEL_SRCDIR" -+ [[ -e "$TEMPDIR/setlocalversion" ]] && mv -f "$TEMPDIR/setlocalversion" "$KERNEL_SRCDIR/scripts" - - [[ "$DEBUG" -eq 0 ]] && rm -rf "$TEMPDIR" - rm -rf "$RPMTOPDIR" -@@ -994,6 +993,25 @@ if [[ -z "$OOT_MODULE" && ! "$CONFIGFILE" -ef "$KERNEL_SRCDIR"/.config ]] ; then - cp -f "$CONFIGFILE" "$KERNEL_SRCDIR/.config" || die - fi - -+# When the kernel source is in a git repo, applying the patch (plus the -+# Makefile sed hacks we do) can cause it to be built with "+" or "dirty" -+# appended to the kernel version string (VERMAGIC_STRING), even if the original -+# kernel was not dirty. That can complicate both the build (create-diff-object -+# false positive changes) and the patch module link (module version mismatch -+# load failures). -+# -+# Prevent that by replacing the original setlocalversion with a friendlier one -+# which just echo's the original version. This should be done before any -+# changes to the source. -+if [[ -n "$USERSRCDIR" && -e "$KERNEL_SRCDIR/.git" ]]; then -+ cd "$KERNEL_SRCDIR" || die -+ cp -f scripts/setlocalversion "$TEMPDIR" || die -+ LOCALVERSION="$(make kernelversion)" -+ LOCALVERSION="$(KERNELVERSION="$LOCALVERSION" ./scripts/setlocalversion)" -+ [[ -n "$LOCALVERSION" ]] || die "setlocalversion failed" -+ echo "echo $LOCALVERSION" > scripts/setlocalversion -+fi -+ - # kernel option checking - - trace_off "reading .config" -@@ -1131,7 +1149,6 @@ fi - save_env - - echo "Building original source" --[[ -n "$OOT_MODULE" ]] || ./scripts/setlocalversion --save-scmversion || die - unset KPATCH_GCC_TEMPDIR - - KPATCH_CC_PREFIX="$TOOLSDIR/kpatch-cc " --- -2.45.1 - diff --git a/0108-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch b/0108-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch new file mode 100644 index 0000000..be86412 --- /dev/null +++ b/0108-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch @@ -0,0 +1,173 @@ +From fc9c9f6cdd6fd9edc4db86d202b8e0d5e249c7ee Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Fri, 3 Feb 2023 10:28:16 -0800 +Subject: [PATCH 108/118] kpatch-build: support CONFIG_LTO_CLANG_THIN + +Support CONFIG_LTO_CLANG_THIN with ld.lld --lto-obj-path option. + +With CONFIG_LTO_CLANG_THIN, .o files are LLVM IR binary, so CDO doesn't +work on .o file. To solve this issue, we CDO the thinlto files generated +by the --lto-obj-path option. Clang LTO generates the thinlto files +after cross file inline, so they are good candidates for CDO. See [1] for +more discussions about this. + +To achieve this, we need: + + 1. kpatch-build to update kernel Makefile(s) so it generates thinlto + files; + 2. kpatch-build and kpatch-cc to save the thinlto file properly; + 3. kpatch-build to feed these thinlto files to CDO; + 4. The user need to supply vmlinux.o, from which we generate the symtab + file. We need this because GLOBAL symbols may be marked as LOCAL in + LTO vmlinux; + +[1] https://github.com/dynup/kpatch/issues/1320 + +Signed-off-by: Song Liu +(cherry picked from commit 3db1cfb91b9b2b7cf6c5564995c446567baa371a) +--- + kpatch-build/kpatch-build | 53 ++++++++++++++++++++++++++++++++++----- + kpatch-build/kpatch-cc | 18 +++++++++++++ + 2 files changed, 65 insertions(+), 6 deletions(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 643d85c..57b00c5 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1223,6 +1223,23 @@ if [[ "$CONFIG_LD_ORPHAN_WARN_LEVEL" == "error" ]]; then + sed -i 's/--orphan-handling=[$](CONFIG_LD_ORPHAN_WARN_LEVEL)/--orphan-handling="warn"/g' "$KERNEL_SRCDIR/Makefile" || die + fi + ++if [[ -n "$CONFIG_LTO_CLANG" ]]; then ++ [[ -n "$CONFIG_LTO_CLANG_THIN" ]] || die "Non-thin LTO is not supported. Please enable CONFIG_LTO_CLANG_THIN" ++ ++ # This is a heuristic: use -x to check vmlinux vs. vmlinux.o ++ [[ -x "$VMLINUX" ]] && die "For kernel with CONFIG_LTO_CLANG, please supply vmlinux.o instead of vmlinux via -v|--vmlinux option." ++ ++ # update Makefile so that ld.lld generate vmlinux.o.thinlto.o* files for vmlinux.o ++ backup_kernel_file "Makefile" ++ sed -i "s/--thinlto-cache-dir=\$(extmod_prefix).thinlto-cache/--lto-obj-path=vmlinux.o.thinlto.o/g" "$KERNEL_SRCDIR"/Makefile ++ ++ # update scripts/Makefile.build so that ld.lld generate XX.o.thinlto.o* files for modules ++ backup_kernel_file "scripts/Makefile.build" ++ sed -i "s/\$(ld_flags)/\$(ld_flags) --lto-obj-path=\$@.thinlto.o/g" "$KERNEL_SRCDIR"/scripts/Makefile.build ++ ++ export KPATCH_CC_LTO=1 ++fi ++ + if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then + echo "WARNING: Clang support is experimental" + fi +@@ -1346,9 +1363,14 @@ if [[ -n "$CONFIG_MODVERSIONS" ]]; then + trace_on + fi + ++if [[ -n "$CONFIG_LTO_CLANG" ]]; then ++ DIFF_OBJS="$TEMPDIR/thinlto_objs" ++else ++ DIFF_OBJS="$TEMPDIR/changed_objs" ++fi + # Read as words, no quotes. + # shellcheck disable=SC2013 +-for i in $(cat "$TEMPDIR/changed_objs") ++for i in $(cat "$DIFF_OBJS") + do + mkdir -p "$TEMPDIR/patched/$(dirname "$i")" || die + cp -f "$BUILDDIR/$i" "$TEMPDIR/patched/$i" || die +@@ -1377,7 +1399,8 @@ if [[ -z "$MODNAME" ]] ; then + + MODNAME="$(module_name_string "$MODNAME")" + fi +-FILES="$(cat "$TEMPDIR/changed_objs")" ++FILES="$(cat "$DIFF_OBJS")" ++ + cd "$TEMPDIR" || die + mkdir output + declare -a objnames +@@ -1401,7 +1424,11 @@ for i in $FILES; do + + mkdir -p "output/$(dirname "$i")" + cd "$BUILDDIR" || die +- find_kobj "$i" ++ if [[ -n "$CONFIG_LTO_CLANG" ]] ; then ++ KOBJFILE=${i/.o.thinlto.o*/} ++ else ++ find_kobj "$i" ++ fi + cd "$TEMPDIR" || die + if [[ -e "orig/$i" ]]; then + if [[ -n $OOT_MODULE ]]; then +@@ -1418,16 +1445,30 @@ for i in $FILES; do + else + KOBJFILE_NAME=$(basename "${KOBJFILE%.ko}") + KOBJFILE_NAME="${KOBJFILE_NAME//-/_}" +- KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE" ++ if [[ -n "$CONFIG_LTO_CLANG" ]] ; then ++ KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE.ko" ++ else ++ KOBJFILE_PATH="${TEMPDIR}/module/$KOBJFILE" ++ fi + SYMTAB="${KOBJFILE_PATH}.symtab" + SYMVERS_FILE="$BUILDDIR/Module.symvers" + fi + +- "$READELF" -s --wide "$KOBJFILE_PATH" > "$SYMTAB" ++ # With CONFIG_LTO_CLANG, multiple .thinlto files share a ++ # symtab file. Only generate the symtab file once. ++ [[ -e "$SYMTAB" ]] || "$READELF" --symbols --wide "$KOBJFILE_PATH" > "$SYMTAB" + if [[ "$ARCH" = "ppc64le" ]]; then + sed -ri 's/\s+\[: 8\]//' "$SYMTAB" + fi + ++ if [[ -n "$CONFIG_LTO_CLANG" ]] ; then ++ # skip .thinlto file that didn't change at all ++ diff "orig/$i" "patched/$i" 2> /dev/null && continue ++ # skip .thinlto file without any functions ++ num_func=$("$READELF" --symbols "orig/$i" | grep -c FUNC) ++ [[ $num_func -eq 0 ]] && continue ++ fi ++ + # create-diff-object orig.o patched.o parent-name parent-symtab + # Module.symvers patch-mod-name output.o + "$TOOLSDIR"/create-diff-object "${CDO_FLAGS[@]}" "orig/$i" "patched/$i" "$KOBJFILE_NAME" \ +@@ -1480,7 +1521,7 @@ fi + cd "$TEMPDIR/output" || die + # $KPATCH_LDFLAGS and result of find used as list, no quotes. + # shellcheck disable=SC2086,SC2046 +-"$LD" -r $KPATCH_LDFLAGS -o ../patch/tmp_output.o $(find . -name "*.o") 2>&1 | logger || die ++"$LD" -r $KPATCH_LDFLAGS -o ../patch/tmp_output.o $(find . -name "*.o*") 2>&1 | logger || die + + if [[ "$USE_KLP" -eq 1 ]]; then + cp -f "$TEMPDIR"/patch/tmp_output.o "$TEMPDIR"/patch/output.o || die +diff --git a/kpatch-build/kpatch-cc b/kpatch-build/kpatch-cc +index 5456179..85189e1 100755 +--- a/kpatch-build/kpatch-cc ++++ b/kpatch-build/kpatch-cc +@@ -81,6 +81,24 @@ elif [[ "$TOOLCHAINCMD" =~ ^(.*-)?ld || "$TOOLCHAINCMD" =~ ^(.*-)?ld.lld ]] ; th + args+=(--warn-unresolved-symbols) + break + ;; ++ */.tmp_*.o) ++ # .tmp_*.o is used for single file modules. ++ # See "cmd_ld_single_m" in scripts/Makefile.build. ++ if [[ $KPATCH_CC_LTO -eq 1 ]] ; then ++ mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" ++ cp "${obj/.tmp_/}".thinlto.o* "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" ++ echo "${obj/.tmp_/}".thinlto.o* >> "$KPATCH_GCC_TEMPDIR/thinlto_objs" ++ fi ++ break ++ ;; ++ *.o) ++ if [[ $KPATCH_CC_LTO -eq 1 ]] ; then ++ mkdir -p "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" ++ cp "$obj".thinlto* "$KPATCH_GCC_TEMPDIR/orig/$(dirname "$relobj")" ++ echo "$obj".thinlto.o* >> "$KPATCH_GCC_TEMPDIR/thinlto_objs" ++ fi ++ break ++ ;; + *) + break + ;; +-- +2.48.1 + diff --git a/0109-create-diff-object-compare-section-name-with-kpatch_.patch b/0109-create-diff-object-compare-section-name-with-kpatch_.patch new file mode 100644 index 0000000..b4bb25b --- /dev/null +++ b/0109-create-diff-object-compare-section-name-with-kpatch_.patch @@ -0,0 +1,53 @@ +From 9633ff14e80449b2001d6e49884fce896e1ffd41 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Wed, 13 Oct 2021 00:10:20 -0700 +Subject: [PATCH 109/118] create-diff-object: compare section name with + kpatch_section_function_name + +Profile-Guided Optimization (PGO) uses profiling data to help the compiler +to evaluate the properties of a function, and thus adds different prefixes +to the section/function. For example, with -ffunction-sections, the +compiler will prefix some sectiones with .text.unlikely. However, if a +function changes from the version in the profiling data, the compiler may +ignore the profiling data. This often happens to the patched function +when kpatch-build builds the patch. As a result, the original function +and the patch function may have different prefix, i.e., one of them has +.text, the other has .text.unlikely. + +To correlate these functions properly, use kpatch_section_function_name() +in kpatch_correlate_sections() to find matching sections. + +Signed-off-by: Song Liu +(cherry picked from commit 47d1b39ba7686e2368c1ad24af274dfd9f54ecf9) +--- + kpatch-build/create-diff-object.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 22a0155..61e1477 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -1101,6 +1101,8 @@ static void kpatch_correlate_section(struct section *sec_orig, + kpatch_correlate_symbol(sec_orig->sym, sec_patched->sym); + } + ++static char *kpatch_section_function_name(struct section *sec); ++ + static void kpatch_correlate_sections(struct list_head *seclist_orig, + struct list_head *seclist_patched) + { +@@ -1110,8 +1112,9 @@ static void kpatch_correlate_sections(struct list_head *seclist_orig, + if (sec_orig->twin) + continue; + list_for_each_entry(sec_patched, seclist_patched, list) { +- if (kpatch_mangled_strcmp(sec_orig->name, sec_patched->name) || +- sec_patched->twin) ++ if (sec_patched->twin || ++ kpatch_mangled_strcmp(kpatch_section_function_name(sec_orig), ++ kpatch_section_function_name(sec_patched))) + continue; + + if (is_ubsan_sec(sec_orig->name)) +-- +2.48.1 + diff --git a/0109-kpatch-build-ignore-changes-in-.comment-section.patch b/0109-kpatch-build-ignore-changes-in-.comment-section.patch deleted file mode 100644 index f758938..0000000 --- a/0109-kpatch-build-ignore-changes-in-.comment-section.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 101bfb58f0111b3e4032645125b5b259454750d4 Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Fri, 20 Oct 2023 13:55:04 -0700 -Subject: [PATCH 109/112] kpatch-build: ignore changes in .comment section - -.comment section contains compiler version number of compiler(s) used to -generate the object file. With LTO, it is possible that cross file inlining -add/remove items to/from the .comment section. Ignore any changes in the -section in CDO. - -Signed-off-by: Song Liu ---- - kpatch-build/create-diff-object.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c -index 4e3341e..4ce0766 100644 ---- a/kpatch-build/create-diff-object.c -+++ b/kpatch-build/create-diff-object.c -@@ -2870,6 +2870,7 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf) - !strncmp(sec->name, ".rela.discard", 13) || - !strncmp(sec->name, ".llvm_addrsig", 13) || - !strncmp(sec->name, ".rel.llvm.call-graph-profile", 28) || -+ !strncmp(sec->name, ".comment", 8) || - !strncmp(sec->name, ".llvm.", 6)) - sec->ignore = 1; - } --- -2.45.1 - diff --git a/0110-kpatch-build-add-support-for-clang-pgo.patch b/0110-kpatch-build-add-support-for-clang-pgo.patch new file mode 100644 index 0000000..560f86b --- /dev/null +++ b/0110-kpatch-build-add-support-for-clang-pgo.patch @@ -0,0 +1,78 @@ +From a5bb2c9cba03c5dd6f33e1d42ddf54c45e48d70e Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Wed, 13 Oct 2021 01:03:55 -0700 +Subject: [PATCH 110/118] kpatch-build: add support for clang pgo + +For clang with Profile-Guided Optimization (PGO), profile data is needed +to compile the livepatch properly. Add option -p|--profile-data, which +specifies the profile data file. This option is only valid with +CONFIG_CC_IS_CLANG and CONFIG_PGO_CLANG. + +Signed-off-by: Song Liu +(cherry picked from commit 19c4942a1415d0f99c910949ba55c95ddcc5a976) +--- + kpatch-build/kpatch-build | 21 ++++++++++++++++++++- + 1 file changed, 20 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 57b00c5..d35ede4 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -738,13 +738,14 @@ usage() { + echo " --skip-compiler-check Skip compiler version matching check" >&2 + echo " (not recommended)" >&2 + echo " --version Version of kpatch-build" ++ echo " -p, --profile-data specify profile data for PGO (clang only)" >&2 + } + + if ! command -v gawk &> /dev/null; then + die "gawk not installed" + fi + +-options="$(getopt -o ha:r:s:c:v:j:t:n:o:dR -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace,version" -- "$@")" || die "getopt failed" ++options="$(getopt -o ha:r:s:c:v:j:t:n:o:dRp: -l "help,archversion:,sourcerpm:,sourcedir:,config:,vmlinux:,jobs:,target:,name:,output:,oot-module:,oot-module-src:,debug,skip-gcc-check,skip-compiler-check,skip-cleanup,non-replace,version,profile-data" -- "$@")" || die "getopt failed" + + eval set -- "$options" + +@@ -830,6 +831,10 @@ while [[ $# -gt 0 ]]; do + echo "Version : $VERSION" + exit 0 + ;; ++ -p|--profile-data) ++ PROFILE_DATA="$(readlink -f "$2")" ++ shift ++ ;; + *) + [[ "$1" = "--" ]] && shift && continue + [[ ! -f "$1" ]] && die "patch file '$1' not found" +@@ -1242,6 +1247,16 @@ fi + + if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then + echo "WARNING: Clang support is experimental" ++ if [[ -z "$PROFILE_DATA" ]] && [[ -n "$CONFIG_PGO_CLANG" ]]; then ++ die "Please specify profile-data for CONFIG_PGO_CLANG" ++ fi ++ if [[ -n "$PROFILE_DATA" ]] && [[ -z "$CONFIG_PGO_CLANG" ]]; then ++ echo "WARNING profile-data specified w/o CONFIG_PGO_CLANG, ignore it" ++ fi ++else ++ if [[ -n "$PROFILE_DATA" ]]; then ++ die "Only supports profile-data with Clang" ++ fi + fi + + if [[ "$SKIPCOMPILERCHECK" -eq 0 ]]; then +@@ -1296,6 +1311,10 @@ declare -a MAKEVARS + if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then + MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${CLANG}") + MAKEVARS+=("HOSTCC=clang") ++ if [[ -n "$CONFIG_PGO_CLANG" ]]; then ++ MAKEVARS+=("CFLAGS_PGO_CLANG=-fprofile-use=$PROFILE_DATA") ++ MAKEVARS+=("LLVM=1") ++ fi + else + MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${GCC}") + fi +-- +2.48.1 + diff --git a/0110-kpatch-build-handle-init-version-timestamp.o.patch b/0110-kpatch-build-handle-init-version-timestamp.o.patch deleted file mode 100644 index 2acc728..0000000 --- a/0110-kpatch-build-handle-init-version-timestamp.o.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 1b77c087cbaf667d9ce140a7a5885bba7cca59d1 Mon Sep 17 00:00:00 2001 -From: Yonghong Song -Date: Fri, 20 Oct 2023 14:21:30 -0700 -Subject: [PATCH 110/112] kpatch-build: handle init/version-timestamp.o - -init/version-timestamp.c is introduced after 5.19. - 2df8220cc511 kbuild: build init/built-in.a just once -The init/version-timestamp.o is built after some compilation/build has -been done, so it can have accurate version information. The -init/version-timestamp.o is used in final linking. Different build -environment, including machine or build time can make -init/version-timestamp.o different from each other. - -Make two changes in kpatch-build to avoid init/version-timestamp.o -introduced build failures. - -Signed-off-by: Yonghong Song -Signed-off-by: Song Liu ---- - kpatch-build/kpatch-build | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build -index 429f214..3af1918 100755 ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -634,6 +634,7 @@ find_kobj() { - arch/x86/kernel/head*.o|\ - arch/x86/kernel/platform-quirks.o|\ - arch/x86/lib/lib.a|\ -+ init/version-timestamp.o|\ - lib/lib.a) - KOBJFILE=vmlinux - return -@@ -1287,7 +1288,7 @@ for i in $FILES; do - [[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = centos ]] || [[ "$DISTRO" = ol ]] && \ - [[ "$i" = arch/x86/lib/copy_user_64.o ]] && continue - -- [[ "$i" = usr/initramfs_data.o ]] && continue -+ [[ "$i" = usr/initramfs_data.o || $i = init/version-timestamp.o ]] && continue - - mkdir -p "output/$(dirname "$i")" - cd "$BUILDDIR" || die --- -2.45.1 - diff --git a/0111-create-diff-object-ignore-section-.rel.llvm.call-gra.patch b/0111-create-diff-object-ignore-section-.rel.llvm.call-gra.patch new file mode 100644 index 0000000..0cf1764 --- /dev/null +++ b/0111-create-diff-object-ignore-section-.rel.llvm.call-gra.patch @@ -0,0 +1,30 @@ +From 47c2a7a7c6f1db13bd2b2176d29c831536337afb Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Wed, 1 Mar 2023 15:25:19 -0800 +Subject: [PATCH 111/118] create-diff-object: ignore section + .rel.llvm.call-graph-profile + +This section is used by llvm to store profile data. Ignore it in the +livepatch. + +Signed-off-by: Song Liu +(cherry picked from commit 88bf611ea0a16930a764509a59700cc2418641f0) +--- + kpatch-build/create-diff-object.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 61e1477..e7c74e2 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -2938,6 +2938,7 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf) + if (!strncmp(sec->name, ".discard", 8) || + !strncmp(sec->name, ".rela.discard", 13) || + !strncmp(sec->name, ".llvm_addrsig", 13) || ++ !strncmp(sec->name, ".rel.llvm.call-graph-profile", 28) || + !strncmp(sec->name, ".llvm.", 6)) + sec->ignore = 1; + +-- +2.48.1 + diff --git a/0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch b/0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch deleted file mode 100644 index 363134d..0000000 --- a/0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch +++ /dev/null @@ -1,44 +0,0 @@ -From c147ddf8a343c1de68ac306deb7ddc942d0f50bb Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Thu, 30 May 2024 11:48:03 -0700 -Subject: [PATCH 111/112] kpatch-build: Ignore missing PARA_STRUCT_SIZE for - 6.8.0+ kernels - -struct paravirt_patch_site was removed in 6.8.0+ kernels. We should not -fail kpatch-build for missing PARA_STRUCT_SIZE. - -Signed-off-by: Song Liu ---- - kpatch-build/kpatch-build | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build -index 3af1918..29624da 100755 ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -236,6 +236,11 @@ support_klp_replace() - fi - } - -+check_paravirt_patch_site() -+{ -+ ! kernel_version_gte 6.8.0 -+} -+ - find_dirs() { - if [[ -e "$SCRIPTDIR/create-diff-object" ]]; then - # git repo -@@ -426,7 +431,9 @@ 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" -+ if check_paravirt_patch_site; then -+ [[ ${check[p]} && -z "$PARA_STRUCT_SIZE" ]] && die "can't find special struct paravirt_patch_site size" -+ fi - [[ ${check[s]} && -z "$STATIC_CALL_STRUCT_SIZE" ]] && die "can't find special struct static_call_site size" - - save_env --- -2.45.1 - diff --git a/0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch b/0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch deleted file mode 100644 index 9717747..0000000 --- a/0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch +++ /dev/null @@ -1,31 +0,0 @@ -From cdf423a52d78a0c2b92bd1714021fbd6d1e5c8a8 Mon Sep 17 00:00:00 2001 -From: Song Liu -Date: Thu, 30 May 2024 11:49:47 -0700 -Subject: [PATCH 112/112] kpatch-build: Always do LLVM=1 with - CONFIG_CC_IS_CLANG - -This will make sure NM, AR, etc. are set properly. - -Signed-off-by: Song Liu ---- - kpatch-build/kpatch-build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build -index 29624da..3dec7c9 100755 ---- a/kpatch-build/kpatch-build -+++ b/kpatch-build/kpatch-build -@@ -1164,9 +1164,9 @@ declare -a MAKEVARS - if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then - MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${CLANG}") - MAKEVARS+=("HOSTCC=clang") -+ MAKEVARS+=("LLVM=1") - if [[ -n "$CONFIG_PGO_CLANG" ]]; then - MAKEVARS+=("CFLAGS_PGO_CLANG=-fprofile-use=$PROFILE_DATA") -- MAKEVARS+=("LLVM=1") - fi - else - MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${GCC}") --- -2.45.1 - diff --git a/0112-kpatch-build-Run-objtool-on-thinlto-files.patch b/0112-kpatch-build-Run-objtool-on-thinlto-files.patch new file mode 100644 index 0000000..3d93dcb --- /dev/null +++ b/0112-kpatch-build-Run-objtool-on-thinlto-files.patch @@ -0,0 +1,45 @@ +From 1c5ab108926fff4392884a890fc4db7d79800f3b Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Mon, 6 Mar 2023 22:43:43 -0800 +Subject: [PATCH 112/118] kpatch-build: Run objtool on thinlto files + +In this way, CDO should generate patches with required sections, such as +the .orc sections. + +Signed-off-by: Song Liu +(cherry picked from commit 764a57b1756dffba9bf7c990f752dbd739ea149f) +--- + kpatch-build/kpatch-build | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index d35ede4..4dd72ef 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1384,6 +1384,9 @@ fi + + if [[ -n "$CONFIG_LTO_CLANG" ]]; then + DIFF_OBJS="$TEMPDIR/thinlto_objs" ++ ++ # Get the objtool command line, so we can run it on the thinlto files ++ OBJTOOL_CMD=$(grep -o -e "/tools/objtool/objtool .*" "$BUILDDIR"/.vmlinux.o.cmd | sed 's/vmlinux.o//') + else + DIFF_OBJS="$TEMPDIR/changed_objs" + fi +@@ -1486,6 +1489,13 @@ for i in $FILES; do + # skip .thinlto file without any functions + num_func=$("$READELF" --symbols "orig/$i" | grep -c FUNC) + [[ $num_func -eq 0 ]] && continue ++ if [[ $i = vmlinux.o.* ]] ; then ++ eval "$BUILDDIR/$OBJTOOL_CMD orig/$i" ++ eval "$BUILDDIR/$OBJTOOL_CMD patched/$i" ++ else ++ eval "$BUILDDIR/$OBJTOOL_CMD --module orig/$i" ++ eval "$BUILDDIR/$OBJTOOL_CMD --module patched/$i" ++ fi + fi + + # create-diff-object orig.o patched.o parent-name parent-symtab +-- +2.48.1 + diff --git a/0113-kpatch-build-skip-more-symbols-in-locals_match.patch b/0113-kpatch-build-skip-more-symbols-in-locals_match.patch new file mode 100644 index 0000000..597a51a --- /dev/null +++ b/0113-kpatch-build-skip-more-symbols-in-locals_match.patch @@ -0,0 +1,39 @@ +From da29a415b056b0b18f7adc58af8787b41cf53a33 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Wed, 15 Mar 2023 11:21:31 -0700 +Subject: [PATCH 113/118] kpatch-build: skip more symbols in locals_match + +Skip table_sym with maybe_discarded_sym() == true. This is probably only +needed for LTO build. + +Signed-off-by: Song Liu +(cherry picked from commit b479edd20f6083c65cda9c9277cc54cc56ce0939) +--- + kpatch-build/lookup.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/kpatch-build/lookup.c b/kpatch-build/lookup.c +index bd2b732..52ac2ee 100644 +--- a/kpatch-build/lookup.c ++++ b/kpatch-build/lookup.c +@@ -107,6 +107,8 @@ static bool locals_match(struct lookup_table *table, int idx, + if (table_sym->type != STT_FUNC && table_sym->type != STT_OBJECT) + continue; + ++ if (maybe_discarded_sym(table_sym->name)) ++ continue; + found = 0; + sym = file_sym; + list_for_each_entry_continue(sym, sym_list, list) { +@@ -115,6 +117,8 @@ static bool locals_match(struct lookup_table *table, int idx, + if (sym->bind != STB_LOCAL) + continue; + ++ if (maybe_discarded_sym(sym->name)) ++ continue; + if (sym->type == table_sym->type && + !strcmp(sym->name, table_sym->name)) { + found = 1; +-- +2.48.1 + diff --git a/0114-kpatch-build-ignore-changes-in-.comment-section.patch b/0114-kpatch-build-ignore-changes-in-.comment-section.patch new file mode 100644 index 0000000..c4af429 --- /dev/null +++ b/0114-kpatch-build-ignore-changes-in-.comment-section.patch @@ -0,0 +1,31 @@ +From bfddae4f2568db2f346e0a8f4b520f84f9865f5d Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Fri, 20 Oct 2023 13:55:04 -0700 +Subject: [PATCH 114/118] kpatch-build: ignore changes in .comment section + +.comment section contains compiler version number of compiler(s) used to +generate the object file. With LTO, it is possible that cross file inlining +add/remove items to/from the .comment section. Ignore any changes in the +section in CDO. + +Signed-off-by: Song Liu +(cherry picked from commit 101bfb58f0111b3e4032645125b5b259454750d4) +--- + kpatch-build/create-diff-object.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index e7c74e2..d4d8584 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -2939,6 +2939,7 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf) + !strncmp(sec->name, ".rela.discard", 13) || + !strncmp(sec->name, ".llvm_addrsig", 13) || + !strncmp(sec->name, ".rel.llvm.call-graph-profile", 28) || ++ !strncmp(sec->name, ".comment", 8) || + !strncmp(sec->name, ".llvm.", 6)) + sec->ignore = 1; + +-- +2.48.1 + diff --git a/0115-kpatch-build-handle-init-version-timestamp.o.patch b/0115-kpatch-build-handle-init-version-timestamp.o.patch new file mode 100644 index 0000000..7b47367 --- /dev/null +++ b/0115-kpatch-build-handle-init-version-timestamp.o.patch @@ -0,0 +1,47 @@ +From ffdf133fc75b7b2491e004b9dae643e32efe9087 Mon Sep 17 00:00:00 2001 +From: Yonghong Song +Date: Fri, 20 Oct 2023 14:21:30 -0700 +Subject: [PATCH 115/118] kpatch-build: handle init/version-timestamp.o + +init/version-timestamp.c is introduced after 5.19. + 2df8220cc511 kbuild: build init/built-in.a just once +The init/version-timestamp.o is built after some compilation/build has +been done, so it can have accurate version information. The +init/version-timestamp.o is used in final linking. Different build +environment, including machine or build time can make +init/version-timestamp.o different from each other. + +Make two changes in kpatch-build to avoid init/version-timestamp.o +introduced build failures. + +Signed-off-by: Yonghong Song +Signed-off-by: Song Liu +(cherry picked from commit 1b77c087cbaf667d9ce140a7a5885bba7cca59d1) +--- + kpatch-build/kpatch-build | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 4dd72ef..7f60ca0 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -676,6 +676,7 @@ find_kobj() { + arch/x86/kernel/head*.o|\ + arch/x86/kernel/platform-quirks.o|\ + arch/x86/lib/lib.a|\ ++ init/version-timestamp.o|\ + lib/lib.a) + KOBJFILE=vmlinux + return +@@ -1442,7 +1443,7 @@ for i in $FILES; do + [[ "$DISTRO" = rhel ]] || [[ "$DISTRO" = centos ]] || [[ "$DISTRO" = ol ]] && \ + [[ "$i" = arch/x86/lib/copy_user_64.o ]] && continue + +- [[ "$i" = usr/initramfs_data.o ]] && continue ++ [[ "$i" = usr/initramfs_data.o || $i = init/version-timestamp.o ]] && continue + + mkdir -p "output/$(dirname "$i")" + cd "$BUILDDIR" || die +-- +2.48.1 + diff --git a/0116-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch b/0116-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch new file mode 100644 index 0000000..7f9249b --- /dev/null +++ b/0116-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch @@ -0,0 +1,45 @@ +From 750e7cf0dbf33290f86e845ccaabce512187f6ce Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Thu, 30 May 2024 11:48:03 -0700 +Subject: [PATCH 116/118] kpatch-build: Ignore missing PARA_STRUCT_SIZE for + 6.8.0+ kernels + +struct paravirt_patch_site was removed in 6.8.0+ kernels. We should not +fail kpatch-build for missing PARA_STRUCT_SIZE. + +Signed-off-by: Song Liu +(cherry picked from commit c147ddf8a343c1de68ac306deb7ddc942d0f50bb) +--- + kpatch-build/kpatch-build | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 7f60ca0..5bc1c85 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -275,6 +275,11 @@ support_klp_replace() + fi + } + ++check_paravirt_patch_site() ++{ ++ ! kernel_version_gte 6.8.0 ++} ++ + find_dirs() { + if [[ -e "$SCRIPTDIR/create-diff-object" ]]; then + # git repo +@@ -468,7 +473,9 @@ 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" ++ if check_paravirt_patch_site; then ++ [[ ${check[p]} && -z "$PARA_STRUCT_SIZE" ]] && die "can't find special struct paravirt_patch_site size" ++ fi + [[ ${check[s]} && -z "$STATIC_CALL_STRUCT_SIZE" ]] && die "can't find special struct static_call_site size" + + save_env +-- +2.48.1 + diff --git a/0117-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch b/0117-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch new file mode 100644 index 0000000..9210eb6 --- /dev/null +++ b/0117-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch @@ -0,0 +1,32 @@ +From 88143f4facc9c349f4d3e833fc1550329cc6a2d6 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Thu, 30 May 2024 11:49:47 -0700 +Subject: [PATCH 117/118] kpatch-build: Always do LLVM=1 with + CONFIG_CC_IS_CLANG + +This will make sure NM, AR, etc. are set properly. + +Signed-off-by: Song Liu +(cherry picked from commit cdf423a52d78a0c2b92bd1714021fbd6d1e5c8a8) +--- + kpatch-build/kpatch-build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index 5bc1c85..c284d77 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1319,9 +1319,9 @@ declare -a MAKEVARS + if [[ -n "$CONFIG_CC_IS_CLANG" ]]; then + MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${CLANG}") + MAKEVARS+=("HOSTCC=clang") ++ MAKEVARS+=("LLVM=1") + if [[ -n "$CONFIG_PGO_CLANG" ]]; then + MAKEVARS+=("CFLAGS_PGO_CLANG=-fprofile-use=$PROFILE_DATA") +- MAKEVARS+=("LLVM=1") + fi + else + MAKEVARS+=("CC=${KPATCH_CC_PREFIX}${GCC}") +-- +2.48.1 + diff --git a/0118-kpatch-build-lto-sed-logic-for-lto-obj-path-in-newer.patch b/0118-kpatch-build-lto-sed-logic-for-lto-obj-path-in-newer.patch new file mode 100644 index 0000000..916daaa --- /dev/null +++ b/0118-kpatch-build-lto-sed-logic-for-lto-obj-path-in-newer.patch @@ -0,0 +1,37 @@ +From 497649b03d28e429690b1b3c0eb6f1cde620ef7d Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Tue, 28 Jan 2025 17:13:31 -0800 +Subject: [PATCH 118/118] kpatch-build: lto: sed logic for --lto-obj-path in + newer kernel + +In newer kernel, the thinlto-cache-dir line is removed from Makefile. +Therefore, we cannot use it to add theh --lto-obj-path option. Use +a different sed logic for newer kernel. + +Signed-off-by: Song Liu +--- + kpatch-build/kpatch-build | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/kpatch-build/kpatch-build b/kpatch-build/kpatch-build +index c284d77..a14fd48 100755 +--- a/kpatch-build/kpatch-build ++++ b/kpatch-build/kpatch-build +@@ -1244,7 +1244,13 @@ if [[ -n "$CONFIG_LTO_CLANG" ]]; then + + # update Makefile so that ld.lld generate vmlinux.o.thinlto.o* files for vmlinux.o + backup_kernel_file "Makefile" +- sed -i "s/--thinlto-cache-dir=\$(extmod_prefix).thinlto-cache/--lto-obj-path=vmlinux.o.thinlto.o/g" "$KERNEL_SRCDIR"/Makefile ++ # For older kernel (<=v6.9.4), replace the --thinlto-cache-dir line with --lto-obj-path=... ++ # For newer kernel (>=v6.9.5), add the --lto-obj-path=... line after CONFIG_LTO_CLANG_THIN ++ if grep -q thinlto-cache-dir "$KERNEL_SRCDIR"/Makefile ; then ++ sed -i "s/--thinlto-cache-dir=\$(extmod_prefix).thinlto-cache/--lto-obj-path=vmlinux.o.thinlto.o/g" "$KERNEL_SRCDIR"/Makefile ++ else ++ sed -i "/CONFIG_LTO_CLANG_THIN/a KBUILD_LDFLAGS += --lto-obj-path=vmlinux.o.thinlto.o" "$KERNEL_SRCDIR"/Makefile ++ fi + + # update scripts/Makefile.build so that ld.lld generate XX.o.thinlto.o* files for modules + backup_kernel_file "scripts/Makefile.build" +-- +2.48.1 + diff --git a/kpatch.spec b/kpatch.spec index 8d22bf9..5fd1ad1 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,8 +1,8 @@ %define kpatch_dnf_ver 0.4 Name: kpatch -Version: 0.9.8 -Release: 1.3%{?dist} +Version: 0.9.10 +Release: 0.1%{?dist} Summary: Dynamic kernel patch manager Group: System Environment/Kernel @@ -17,19 +17,25 @@ Patch1: 0002-kpatch-clarify-unload-unsupport.patch Patch2: 0003-do-not-rm-selinux-rpm-owned-directory.patch # Upstream backports -Patch100: 0100-support-ubsan-for-kpatch.patch -Patch101: 0101-create-diff-object-handle-__initcall_stub-with-CONFI.patch -Patch102: 0102-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch -Patch103: 0103-create-diff-object-compare-section-name-with-kpatch_.patch -Patch104: 0104-kpatch-build-add-support-for-clang-pgo.patch -Patch105: 0105-create-diff-object-ignore-section-.rel.llvm.call-gra.patch -Patch106: 0106-kpatch-build-Run-objtool-on-thinlto-files.patch -Patch107: 0107-kpatch-build-skip-more-symbols-in-locals_match.patch -Patch108: 0108-kpatch-build-Fix-setlocalversion-issue-with-6.3-kern.patch -Patch109: 0109-kpatch-build-ignore-changes-in-.comment-section.patch -Patch110: 0110-kpatch-build-handle-init-version-timestamp.o.patch -Patch111: 0111-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch -Patch112: 0112-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch +Patch100: 0100-create-diff-object-avoid-reloc-type-collisions-on-el.patch +Patch101: 0101-aarch64-create-diff-object-implementation.patch +Patch102: 0102-aarch64-kmod-kpatch-syscall.h-add-aarch64-helper.patch +Patch103: 0103-aarch64-kpatch-build-aarch64-implementation.patch +Patch104: 0104-aarch64-documentation-update.patch +Patch105: 0105-arm64-Skip-offset-check-in-kpatch_bundle_symbols.patch +Patch106: 0106-Ignore-symbols-like-.Ltmp-ID.patch +Patch107: 0107-create-diff-object-handle-__initcall_stub-with-CONFI.patch +Patch108: 0108-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch +Patch109: 0109-create-diff-object-compare-section-name-with-kpatch_.patch +Patch110: 0110-kpatch-build-add-support-for-clang-pgo.patch +Patch111: 0111-create-diff-object-ignore-section-.rel.llvm.call-gra.patch +Patch112: 0112-kpatch-build-Run-objtool-on-thinlto-files.patch +Patch113: 0113-kpatch-build-skip-more-symbols-in-locals_match.patch +Patch114: 0114-kpatch-build-ignore-changes-in-.comment-section.patch +Patch115: 0115-kpatch-build-handle-init-version-timestamp.o.patch +Patch116: 0116-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch +Patch117: 0117-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch +Patch118: 0118-kpatch-build-lto-sed-logic-for-lto-obj-path-in-newer.patch # kpatch-dnf backports (inactive -- for future reference) #Patch200: 0200-foo-bar-etcetera.patch @@ -48,7 +54,6 @@ patch the kernel without rebooting. %package -n kpatch-build Summary: Build tool for kpatch BuildRequires: gcc kernel-devel elfutils elfutils-devel -ExcludeArch: aarch64 %description -n kpatch-build kpatch-build is a tool to build patches for kpatch. @@ -85,19 +90,7 @@ kpatch-patch packages updates. %patch -P 1 -p1 %patch -P 2 -p1 # Use this to apply upstream patches to kpatch -%patch -P 100 -p1 -%patch -P 101 -p1 -%patch -P 102 -p1 -%patch -P 103 -p1 -%patch -P 104 -p1 -%patch -P 105 -p1 -%patch -P 106 -p1 -%patch -P 107 -p1 -%patch -P 108 -p1 -%patch -P 109 -p1 -%patch -P 110 -p1 -%patch -P 111 -p1 -%patch -P 112 -p1 +%autopatch -p1 -m 100 -M 199 %setup -D -T -a 1 @@ -140,6 +133,13 @@ echo "To enable automatic kpatch-patch subscription, run:" echo -e "\t$ dnf kpatch auto" %changelog +* Tue Feb 11 2025 Michel Lind - 0.9.10-0.1 +- Update to 0.9.10 +- Enable kpatch-build on aarch64 +- Rebase EL-only patches +- Refresh clang PGO patches +- Switch to autopatch for easier application of upstream patches + * Fri May 31 2024 Davide Cavalca - 0.9.8-1.3 - Backport two more fixes and refresh patches diff --git a/series b/series new file mode 100644 index 0000000..6f96854 --- /dev/null +++ b/series @@ -0,0 +1,22 @@ +0001-contrib-disable-upstart-kpatch.conf-install.patch +0002-kpatch-clarify-unload-unsupport.patch +0003-do-not-rm-selinux-rpm-owned-directory.patch +0100-create-diff-object-avoid-reloc-type-collisions-on-el.patch +0101-aarch64-create-diff-object-implementation.patch +0102-aarch64-kmod-kpatch-syscall.h-add-aarch64-helper.patch +0103-aarch64-kpatch-build-aarch64-implementation.patch +0104-aarch64-documentation-update.patch +0105-arm64-Skip-offset-check-in-kpatch_bundle_symbols.patch +0106-Ignore-symbols-like-.Ltmp-ID.patch +0107-create-diff-object-handle-__initcall_stub-with-CONFI.patch +0108-kpatch-build-support-CONFIG_LTO_CLANG_THIN.patch +0109-create-diff-object-compare-section-name-with-kpatch_.patch +0110-kpatch-build-add-support-for-clang-pgo.patch +0111-create-diff-object-ignore-section-.rel.llvm.call-gra.patch +0112-kpatch-build-Run-objtool-on-thinlto-files.patch +0113-kpatch-build-skip-more-symbols-in-locals_match.patch +0114-kpatch-build-ignore-changes-in-.comment-section.patch +0115-kpatch-build-handle-init-version-timestamp.o.patch +0116-kpatch-build-Ignore-missing-PARA_STRUCT_SIZE-for-6.8.patch +0117-kpatch-build-Always-do-LLVM-1-with-CONFIG_CC_IS_CLAN.patch +0118-kpatch-build-lto-sed-logic-for-lto-obj-path-in-newer.patch diff --git a/sources b/sources index 75d6a90..ac3a833 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ SHA512 (kpatch-dnf-v0.4.tar.gz) = d76b2ec5595e06fd560ae928f43ad275b4ce07574a1fc829d184d56c5f09a88ce0cb1d1b05e58eb53e6d934a879886b7f0149f782950d7856fbb99c61ce436c3 -SHA512 (v0.9.8.tar.gz) = ab3a771dfcde92a9eee768afcf7fddb6f1ad5ba9e8c7f44d579d258ce9b6ee1722869b1b70c4597ae951b0faf71413efa26a5b135f50308c996b284a9dcee5b7 +SHA512 (v0.9.10.tar.gz) = d27f0e92d93539cc6ae6137419a99d124e5e2dba8bfbf67d15b0bf89230d2e92584c974ccae6932ce7a02460d73da9d46806e9104ee019ea3c6d3cfe8658be83