diff --git a/SOURCES/1231.patch b/SOURCES/1231.patch index b663a3d..19d9067 100644 --- a/SOURCES/1231.patch +++ b/SOURCES/1231.patch @@ -1,7 +1,57 @@ -From 184bc480d753610efbcb0731f7f4c2ba2bdce256 Mon Sep 17 00:00:00 2001 +From 909d7a656bb5e638bb199b8abd1c5b221b873793 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 + 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 826741d0..319ed68d 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -1001,6 +1001,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) + { +@@ -1010,8 +1012,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_special_static(is_rela_section(sec_orig) ? + +From 0223fa3ab3efc1bed18cff7acf470185e2e66406 Mon Sep 17 00:00:00 2001 From: Song Liu Date: Wed, 13 Oct 2021 01:03:55 -0700 -Subject: [PATCH] kpatch-build: add support for clang pgo +Subject: [PATCH 2/2] 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 diff --git a/SPECS/kpatch.spec b/SPECS/kpatch.spec index ffed6cb..de1ada3 100644 --- a/SPECS/kpatch.spec +++ b/SPECS/kpatch.spec @@ -2,7 +2,7 @@ Name: kpatch Version: 0.9.6 -Release: 1.8%{?dist} +Release: 2.9%{?dist} Summary: Dynamic kernel patch manager Group: System Environment/Kernel @@ -80,14 +80,14 @@ cd .. %install make install PREFIX=/usr DESTDIR=%{buildroot} -make install PREFIX=/usr DESTDIR=%{buildroot} -make install PREFIX=/usr DESTDIR=%{buildroot} +mkdir -p %{buildroot}/%{_sharedstatedir}/kpatch make install PREFIX=/usr DESTDIR=%{buildroot} PYTHONSITES=%{python3_sitelib} -C kpatch-dnf-%{kpatch_dnf_ver} %files -n kpatch-runtime %{_sbindir}/kpatch %{_usr}/lib/systemd/system/kpatch.service +%{_sharedstatedir}/kpatch %doc %{_mandir}/man1/kpatch.1.gz %files -n kpatch-dnf @@ -107,12 +107,19 @@ echo -e "\t$ dnf kpatch auto" %{_mandir}/man1/kpatch-build.1* %changelog +* 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 + * Tue Apr 12 2022 Davide Cavalca - 0.9.6-1.8 - Fix release * Tue Apr 12 2022 Davide Cavalca - 0.9.6-1.1 - Update to 0.9.6 +* Fri Jan 14 2022 Yannick Cote 0.9.4-2 +- Add /usr/lib/kpatch to install and files list to appease SELinux (rhbz#2022123) + * Wed Oct 13 2021 Davide Cavalca - 0.9.4-1.7 - Backport PR#1231 for clang PGO support - Exclude aarch64 and s390x as kpatch is not supported there