You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kpatch/LoongArch: fix kernel panic by disabling direct-extern-access for livepatches
On LoongArch systems, livepatch modules containing references to 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 symbol access
with direct addressing. While this improves performance, it breaks the
module loading mechanism which relies on GOT entries for proper symbol
relocation. 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 <guodongtai@kylinos.cn>
0 commit comments