Commit 91adaf0e authored by Baruch Siach's avatar Baruch Siach Committed by Greg Kroah-Hartman

bpf: fix uapi bpf_prog_info fields alignment

[ Upstream commit 0472301a ]

Merge commit 1c8c5a9d ("Merge
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next") undid the
fix from commit 36f9814a ("bpf: fix uapi hole for 32 bit compat
applications") by taking the gpl_compatible 1-bit field definition from
commit b85fab0e ("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: default avatarBaruch Siach <baruch@tkos.co.il>
Acked-by: default avatarSong 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: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c3674310
...@@ -2871,6 +2871,7 @@ struct bpf_prog_info { ...@@ -2871,6 +2871,7 @@ struct bpf_prog_info {
char name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
__u32 ifindex; __u32 ifindex;
__u32 gpl_compatible:1; __u32 gpl_compatible:1;
__u32 :31; /* alignment pad */
__u64 netns_dev; __u64 netns_dev;
__u64 netns_ino; __u64 netns_ino;
__u32 nr_jited_ksyms; __u32 nr_jited_ksyms;
......
...@@ -2869,6 +2869,7 @@ struct bpf_prog_info { ...@@ -2869,6 +2869,7 @@ struct bpf_prog_info {
char name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
__u32 ifindex; __u32 ifindex;
__u32 gpl_compatible:1; __u32 gpl_compatible:1;
__u32 :31; /* alignment pad */
__u64 netns_dev; __u64 netns_dev;
__u64 netns_ino; __u64 netns_ino;
__u32 nr_jited_ksyms; __u32 nr_jited_ksyms;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment