]> Git Repo - linux.git/commitdiff
bpf: fix uapi bpf_prog_info fields alignment
authorBaruch Siach <[email protected]>
Fri, 28 Jun 2019 04:08:45 +0000 (07:08 +0300)
committerDaniel Borkmann <[email protected]>
Fri, 28 Jun 2019 23:35:46 +0000 (01:35 +0200)
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.

Signed-off-by: Baruch Siach <[email protected]>
Acked-by: Song Liu <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Linus Torvalds <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
include/uapi/linux/bpf.h
tools/include/uapi/linux/bpf.h

index a8b823c30b434d8022ebeab666d7072a09473be5..29a5bc3d5c6661181251d1427d1a0742c4e397c0 100644 (file)
@@ -3143,6 +3143,7 @@ struct bpf_prog_info {
        char name[BPF_OBJ_NAME_LEN];
        __u32 ifindex;
        __u32 gpl_compatible:1;
+       __u32 :31; /* alignment pad */
        __u64 netns_dev;
        __u64 netns_ino;
        __u32 nr_jited_ksyms;
index a8b823c30b434d8022ebeab666d7072a09473be5..29a5bc3d5c6661181251d1427d1a0742c4e397c0 100644 (file)
@@ -3143,6 +3143,7 @@ struct bpf_prog_info {
        char name[BPF_OBJ_NAME_LEN];
        __u32 ifindex;
        __u32 gpl_compatible:1;
+       __u32 :31; /* alignment pad */
        __u64 netns_dev;
        __u64 netns_ino;
        __u32 nr_jited_ksyms;
This page took 0.069391 seconds and 4 git commands to generate.