Skip to content

Commit 91adaf0

Browse files
baruchsiachgregkh
authored andcommitted
bpf: fix uapi bpf_prog_info fields alignment
[ Upstream commit 0472301 ] Merge commit 1c8c5a9 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next") undid the fix from commit 36f9814 ("bpf: fix uapi hole for 32 bit compat applications") by taking the gpl_compatible 1-bit field definition from commit b85fab0 ("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. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Song Liu <songliubraving@fb.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c367431 commit 91adaf0

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

  • include/uapi/linux
  • tools/include/uapi/linux

‎include/uapi/linux/bpf.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,6 +2871,7 @@ struct bpf_prog_info {
28712871
char name[BPF_OBJ_NAME_LEN];
28722872
__u32 ifindex;
28732873
__u32 gpl_compatible:1;
2874+
__u32 :31; /* alignment pad */
28742875
__u64 netns_dev;
28752876
__u64 netns_ino;
28762877
__u32 nr_jited_ksyms;

‎tools/include/uapi/linux/bpf.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,6 +2869,7 @@ struct bpf_prog_info {
28692869
char name[BPF_OBJ_NAME_LEN];
28702870
__u32 ifindex;
28712871
__u32 gpl_compatible:1;
2872+
__u32 :31; /* alignment pad */
28722873
__u64 netns_dev;
28732874
__u64 netns_ino;
28742875
__u32 nr_jited_ksyms;

0 commit comments

Comments
 (0)