Commit 88f2adb
committed
create-diff-object: fix Clang UBSAN diff failure by ignoring unnamed data
This fixes a diff failure when generating livepatches for objects
compiled with Clang and UBSAN (Undefined Behavior Sanitizer).
When UBSAN is enabled, Clang heavily utilizes `.data..L__unnamed_XX`
sections to store type descriptors and source location metadata.
kpatch-build currently fails to handle these sections, resulting in
errors like:
fsnotify.o: changed section .data..L__unnamed_1 not selected for inclusion
ERROR: fsnotify.o: 1 unsupported section change(s)
create-diff-object: unreconcilable difference
The numeric suffix (e.g., `_1`) in these section names is an unstable
internal counter. If the patch modifies the code, these indices often
shift, causing `create-diff-object` to incorrectly correlate unrelated
UBSAN metadata between the original and patched objects. Since kpatch
cannot support changes to existing data sections, the build aborts.
Fix this by treating `.data..L__unnamed_` sections as unstable and
uncorrelatable.
This patch introduces `is_clang_unnamed_data()` to:
1. Explicitly skip these sections in `kpatch_correlate_sections()`.
2. Prevent `kpatch_correlate_static_local_variables()` from forcing
correlation based on symbol usage.
This ensures that UBSAN metadata sections are always marked as 'NEW'
and allocated safely in the patch module, enabling support for
livepatching UBSAN-instrumented kernels.
Signed-off-by: Florent Revest <[email protected]>1 parent 9f72959 commit 88f2adb
2 files changed
+23
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
399 | 411 | | |
400 | 412 | | |
401 | 413 | | |
| |||
425 | 437 | | |
426 | 438 | | |
427 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
428 | 444 | | |
429 | 445 | | |
430 | 446 | | |
| |||
1142 | 1158 | | |
1143 | 1159 | | |
1144 | 1160 | | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1145 | 1166 | | |
1146 | 1167 | | |
1147 | 1168 | | |
| |||
1785 | 1806 | | |
1786 | 1807 | | |
1787 | 1808 | | |
| 1809 | + | |
1788 | 1810 | | |
1789 | 1811 | | |
1790 | 1812 | | |
| |||
- loongarch64/Makefile+2
- loongarch64/cmdline-string.ORIG.o
- loongarch64/cmdline-string.PATCHED.o
- loongarch64/cmdline-string.test+5
- loongarch64/data-new.ORIG.o
- loongarch64/data-new.PATCHED.o
- loongarch64/data-new.test+6
- loongarch64/gcc-static-local-var-6.ORIG.o
- loongarch64/gcc-static-local-var-6.PATCHED.o
- loongarch64/gcc-static-local-var-6.test+6
- loongarch64/new-function.ORIG.o
- loongarch64/new-function.PATCHED.o
- loongarch64/new-function.test+7
- loongarch64/proc-version.ORIG.o
- loongarch64/proc-version.PATCHED.o
- loongarch64/proc-version.test+5
- loongarch64/syscall.ORIG.o
- loongarch64/syscall.PATCHED.o
- loongarch64/syscall.test+7
- x86_64/clang-unnamed.ORIG.o
- x86_64/clang-unnamed.PATCHED.o
- x86_64/clang-unnamed.test+4
0 commit comments