Commit 442381a
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 442381a
1 file changed
+20
-0
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 | + | |
399 | 410 | | |
400 | 411 | | |
401 | 412 | | |
| |||
425 | 436 | | |
426 | 437 | | |
427 | 438 | | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
428 | 443 | | |
429 | 444 | | |
430 | 445 | | |
| |||
1142 | 1157 | | |
1143 | 1158 | | |
1144 | 1159 | | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1145 | 1165 | | |
1146 | 1166 | | |
1147 | 1167 | | |
| |||
0 commit comments