From f7cb876a5c76046351901e5f9a03183e4adbc56e Mon Sep 17 00:00:00 2001 From: fly_fzc <2385803914@qq.com> Date: Fri, 1 Aug 2025 15:31:51 +0800 Subject: [PATCH] CDO: Handle .data..once sections. (cherry picked from commit 9aa067ace879b496a3ca588797e69fb8f50f0202) --- 0042-CDO-Handle-.data.once-sections.patch | 47 +++++++++++++++++++++++ kpatch.spec | 9 ++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 0042-CDO-Handle-.data.once-sections.patch diff --git a/0042-CDO-Handle-.data.once-sections.patch b/0042-CDO-Handle-.data.once-sections.patch new file mode 100644 index 0000000..ce63fc0 --- /dev/null +++ b/0042-CDO-Handle-.data.once-sections.patch @@ -0,0 +1,47 @@ +From 835d9d1ae10c7483744074689291f3afb34bc2b5 Mon Sep 17 00:00:00 2001 +From: Song Liu +Date: Fri, 25 Apr 2025 16:28:23 -0700 +Subject: [PATCH] CDO: Handle .data..once sections. + +Upstream commit [1] renamed .data.once section as .data..once. Handle it +the same as .data.once sections. + +[1] dbefa1f31a91 ("Rename .data.once to .data..once to fix resetting WARN*_ONCE") +Signed-off-by: Song Liu +--- + kpatch-build/create-diff-object.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c +index a5473b0..3a568a3 100644 +--- a/kpatch-build/create-diff-object.c ++++ b/kpatch-build/create-diff-object.c +@@ -372,7 +372,8 @@ static bool is_special_static(struct symbol *sym) + if (sym->type != STT_OBJECT || sym->bind != STB_LOCAL) + return false; + +- if (!strcmp(sym->sec->name, ".data.once")) ++ if (!strcmp(sym->sec->name, ".data.once") || ++ !strcmp(sym->sec->name, ".data..once")) + return true; + + for (var_name = var_names; *var_name; var_name++) { +@@ -1734,11 +1735,13 @@ static void kpatch_verify_patchability(struct kpatch_elf *kelf) + + /* + * ensure we aren't including .data.* or .bss.* +- * (.data.unlikely and .data.once is ok b/c it only has __warned vars) ++ * (.data.unlikely, .data.once, and .data..once is ok b/c it only ++ * has __warned vars) + */ + if (sec->include && sec->status != NEW && + (!strncmp(sec->name, ".data", 5) || !strncmp(sec->name, ".bss", 4)) && +- (strcmp(sec->name, ".data.unlikely") && strcmp(sec->name, ".data.once"))) { ++ (strcmp(sec->name, ".data.unlikely") && strcmp(sec->name, ".data.once") && ++ strcmp(sec->name, ".data..once"))) { + log_normal("data section %s selected for inclusion\n", + sec->name); + errs++; +-- +2.33.0 + diff --git a/kpatch.spec b/kpatch.spec index 072ba8f..c40d029 100644 --- a/kpatch.spec +++ b/kpatch.spec @@ -1,7 +1,7 @@ Name: kpatch Epoch: 1 Version: 0.9.9 -Release: 15 +Release: 16 Summary: A Linux dynamic kernel patching infrastructure License: GPLv2 @@ -54,6 +54,7 @@ Patch0038:0038-Fix-undefined-behavior-problem-when-using-list_forea.patch Patch0039:0039-build-support-for-building-with-clang.patch Patch0040:0001-add-loongarch64-support.patch Patch0041:0051-fix-rela.init.text-section-changed-due-to-__BTF_id_-changed.patch +Patch0042:0042-CDO-Handle-.data.once-sections.patch Patch9001:huawei-fix-function-ptr-relocation.patch Patch9002:huawei-lookup.c-ignore-BTF-ID-when-matching-locals.patch @@ -127,6 +128,12 @@ popd %{_mandir}/man1/*.1.gz %changelog +* Fri Aug 1 2025 jinsaihang - 1:0.9.9-16 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:CDO: Handle .data..once sections. + * Thu Jul 10 2025 fuanan - 1:0.9.9-15 - Type:bugfix - CVE:NA -- Gitee