Commit 57d1458
kpatch/LoongArch: disable direct-extern-access for livepatches to fix kernel panic
On LoongArch systems, livepatch modules containing references to EXTERNAL
global variables trigger kernel panics when the core kernel is built with
-mdirect-extern-access optimization.
Root cause:
The -mdirect-extern-access optimization replaces GOT-based external symbol
access with direct addressing for improved performance. However, this breaks
the kernel module loading mechanism which relies on GOT entries for proper
relocation of EXTERNAL symbol references. Direct access to global variables
from livepatch modules causes invalid memory accesses and kernel panics.
Solution:
For LoongArch kpatch builds, conditionally disable direct-extern-access
by adding:
- -mno-direct-extern-access for GCC builds
- -fno-direct-access-external-data for Clang builds
Signed-off-by: George Guo <guodongtai@kylinos.cn>1 parent eab48a0 commit 57d1458
1 file changed
+24
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
385 | 401 | | |
386 | 402 | | |
387 | 403 | | |
| |||
1291 | 1307 | | |
1292 | 1308 | | |
1293 | 1309 | | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
1294 | 1314 | | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
1295 | 1319 | | |
1296 | 1320 | | |
1297 | 1321 | | |
| |||
0 commit comments