[PATCH bpf-next v1 2/3] bpf: btf: Ensure natural alignment of .BTF_ids section

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



While building of vmlinux employs a linker script to align the .BTF_ids
section to 4 bytes, other usage leaves .BTF_ids unaligned and may lead to
problems (e.g. [1]). Post-processing and libelf-based endian translation by
resolve_btfids may also potentially suffer from misalignment.

Update encoding macros in btf_ids.h to always align BTF ID data to 4 bytes.

[1]: 3effc06a4dde ("selftests/bpf: Fix alignment of .BTF_ids")

Signed-off-by: Tony Ambardar <tony.ambardar@xxxxxxxxx>
---
 include/linux/btf_ids.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
index c0e3e1426a82..c10b163dc340 100644
--- a/include/linux/btf_ids.h
+++ b/include/linux/btf_ids.h
@@ -89,6 +89,7 @@ word							\
 #define __BTF_ID_LIST(name, scope)			\
 asm(							\
 ".pushsection " BTF_IDS_SECTION ",\"a\";       \n"	\
+".balign 4, 0;                                 \n"	\
 "." #scope " " #name ";                        \n"	\
 #name ":;                                      \n"	\
 ".popsection;                                  \n");
-- 
2.34.1





[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux