diff --git a/SOURCES/1231.patch b/SOURCES/1231.patch index 19d9067..28830d4 100644 --- a/SOURCES/1231.patch +++ b/SOURCES/1231.patch @@ -1,4 +1,4 @@ -From 909d7a656bb5e638bb199b8abd1c5b221b873793 Mon Sep 17 00:00:00 2001 +From ac947f20de981a0da0b63521894cb5777fc10fa3 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Wed, 13 Oct 2021 00:10:20 -0700 Subject: [PATCH 1/2] create-diff-object: compare section name with @@ -48,7 +48,7 @@ index 826741d0..319ed68d 100644 if (is_special_static(is_rela_section(sec_orig) ? -From 0223fa3ab3efc1bed18cff7acf470185e2e66406 Mon Sep 17 00:00:00 2001 +From 085cf5d21aa4f61b617f7a51fdede34ec1061ece Mon Sep 17 00:00:00 2001 From: Song Liu Date: Wed, 13 Oct 2021 01:03:55 -0700 Subject: [PATCH 2/2] kpatch-build: add support for clang pgo diff --git a/SOURCES/3112397f3b7b59f8e9089143965d889165c16d13.patch b/SOURCES/3112397f3b7b59f8e9089143965d889165c16d13.patch new file mode 100644 index 0000000..dbfd56b --- /dev/null +++ b/SOURCES/3112397f3b7b59f8e9089143965d889165c16d13.patch @@ -0,0 +1,50 @@ +From 3112397f3b7b59f8e9089143965d889165c16d13 Mon Sep 17 00:00:00 2001 +From: Josh Poimboeuf +Date: Mon, 6 Jun 2022 17:05:41 -0700 +Subject: [PATCH] create-diff-object: Create missing section symbol + +Recent toolchains only create a section symbol if it's needed, i.e. if +there's a reference to it. If there's a missing section symbol in +kpatch_create_intermediate_sections(), create one instead of erroring +out. + +Fixes #1272. + +Signed-off-by: Josh Poimboeuf +--- + kpatch-build/create-diff-object.c | 21 ++++++++++++++++----- + 1 file changed, 16 insertions(+), 5 deletions(-) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index 319ed68d..420d55d8 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -3397,12 +3397,23 @@ static void kpatch_create_intermediate_sections(struct kpatch_elf *kelf, + + /* add rela to fill in krelas[index].dest field */ + ALLOC_LINK(rela2, &krela_sec->rela->relas); +- if (sec->base->secsym) +- rela2->sym = sec->base->secsym; +- else +- ERROR("can't create dynrela for section %s (symbol %s): no bundled or section symbol", +- sec->name, rela->sym->name); ++ if (!sec->base->secsym) { ++ struct symbol *sym; + ++ /* ++ * Newer toolchains are stingy with their ++ * section symbols, create one if it doesn't ++ * exist already. ++ */ ++ ALLOC_LINK(sym, &kelf->symbols); ++ sym->sec = sec->base; ++ sym->sym.st_info = GELF_ST_INFO(STB_LOCAL, STT_SECTION); ++ sym->type = STT_SECTION; ++ sym->bind = STB_LOCAL; ++ sym->name = sec->base->name; ++ sec->base->secsym = sym; ++ } ++ rela2->sym = sec->base->secsym; + rela2->type = absolute_rela_type(kelf); + rela2->addend = rela->offset; + rela2->offset = (unsigned int)(index * sizeof(*krelas) + \ diff --git a/SPECS/kpatch.spec b/SPECS/kpatch.spec index de1ada3..347215a 100644 --- a/SPECS/kpatch.spec +++ b/SPECS/kpatch.spec @@ -2,7 +2,7 @@ Name: kpatch Version: 0.9.6 -Release: 2.9%{?dist} +Release: 2.10%{?dist} Summary: Dynamic kernel patch manager Group: System Environment/Kernel @@ -17,6 +17,8 @@ Patch1: 0002-kpatch-clarify-unload-unsupport.patch # Upstream backports Patch100: https://github.com/dynup/kpatch/pull/1231.patch +# PR#1273 backport for 0.9.6 +Patch101: https://github.com/liu-song-6/kpatch/commit/3112397f3b7b59f8e9089143965d889165c16d13.patch # kpatch-dnf backports Patch200: 0200-Makefile-set-install-permission-modes.patch @@ -67,6 +69,7 @@ kpatch-build is a tool to build patches for kpatch. %patch0 -p1 %patch1 -p1 %patch100 -p1 +%patch101 -p1 %setup -D -T -a 1 cd kpatch-dnf-%{kpatch_dnf_ver} @@ -107,6 +110,10 @@ echo -e "\t$ dnf kpatch auto" %{_mandir}/man1/kpatch-build.1* %changelog +* Tue Jun 7 2022 Davide Cavalca - 0.9.6-2.10 +- Refresh PR#1231 patch +- Backport PR#1273 + * Wed Apr 13 2022 Davide Cavalca - 0.9.6-2.9 - Merge upstream changes from kpatch-0.9.4-2.el8 - Refresh PR#1231 patch