History

bpf: fix uapi bpf_prog_info fields alignment

Merge commit 1c8c5a9d38f60 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next") undid the fix from commit 36f9814a494 ("bpf: fix uapi hole for 32 bit compat applications") by taking the gpl_compatible 1-bit field definition from commit b85fab0e67b162 ("bpf: Add gpl_compatible flag to struct bpf_prog_info") as is. That breaks architectures with 16-bit alignment like m68k. Add 31-bit pad after gpl_compatible to restore alignment of following fields. Thanks to Dmitry V. Levin his analysis of this bug history.

Baruch Siach committed 7 years ago

Commit 04723011 parent 75672dd2 files · +2 −0Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/bpf.h+1−0
@@ -3143,6 +3143,7 @@ struct bpf_prog_info { · 3142 unmodified lines
3143 char name[BPF_OBJ_NAME_LEN];3143 char name[BPF_OBJ_NAME_LEN];
3144 __u32 ifindex;3144 __u32 ifindex;
3145 __u32 gpl_compatible:1;3145 __u32 gpl_compatible:1;
3146 __u32 :31; /* alignment pad */
3146 __u64 netns_dev;3147 __u64 netns_dev;
3147 __u64 netns_ino;3148 __u64 netns_ino;
3148 __u32 nr_jited_ksyms;3149 __u32 nr_jited_ksyms;