From 06ae032a3d2691d8ace13188c3f4d8b60715e50d Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Fri, 24 Jan 2025 18:53:14 +0000 Subject: [PATCH] lisa._btf: Ensure stable layout for structs from BTF FIX Kernel options such as CONFIG_RANDSTRUCT_FULL can introduce randomization of struct layouts. Since the LISA module is built out of tree, it cannot share the random seed with the kernel build and any type definition rematerialized from BTF would therefore undergo randomization, breaking the ABI compatibility with the same type in the base kernel image. In order to avoid that, add the __no_randomize_layout attribute to each struct type we generate from BTF so that the compiler preserves the expected layout. --- lisa/_btf.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lisa/_btf.py b/lisa/_btf.py index 2150a1835..84941a0be 100644 --- a/lisa/_btf.py +++ b/lisa/_btf.py @@ -525,6 +525,7 @@ class _BTFStructUnion(_CDecl, BTFType): if last_padding: members = (*members, last_padding) attrs = attrs or '' + attrs = f'__no_randomize_layout {attrs}' members_str = '; '.join(map(format_member, members)) members_str = f'{members_str};' if members_str else '' -- GitLab