summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2018-06-20 17:24:09 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-22 15:16:08 +0200
commitd3aaff449e24bd254db7a44e049461a127137114 (patch)
treec7ccccf4fb1b45086c9e5b9ab46bcf83574e53a0 /include
parentabe6147b876a4215e8ec9f705334e5009619ae91 (diff)
downloadlinux-stable-d3aaff449e24bd254db7a44e049461a127137114.tar.gz
linux-stable-d3aaff449e24bd254db7a44e049461a127137114.tar.bz2
linux-stable-d3aaff449e24bd254db7a44e049461a127137114.zip
bpf: enforce correct alignment for instructions
commit 9262478220eac908ae6e168c3df2c453c87e2da3 upstream. After commit 9facc336876f ("bpf: reject any prog that failed read-only lock") offsetof(struct bpf_binary_header, image) became 3 instead of 4, breaking powerpc BPF badly, since instructions need to be word aligned. Fixes: 9facc336876f ("bpf: reject any prog that failed read-only lock") Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Martin KaFai Lau <kafai@fb.com> Cc: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/filter.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 6ba7eb732550..bf58df844279 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -455,7 +455,9 @@ struct sock_fprog_kern {
struct bpf_binary_header {
u16 pages;
u16 locked:1;
- u8 image[];
+
+ /* Some arches need word alignment for their instructions */
+ u8 image[] __aligned(4);
};
struct bpf_prog {