diff options
author | Eric Dumazet <edumazet@google.com> | 2018-06-20 17:24:09 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-06-21 12:46:06 +0900 |
commit | 9262478220eac908ae6e168c3df2c453c87e2da3 (patch) | |
tree | c947c374ca969723540a9e50ad09f6d603313b58 /include | |
parent | 08d02364b12faa54d76dbfea2090321fd27996f2 (diff) |
bpf: enforce correct alignment for instructions
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/filter.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index b615df57b7d5..20f2659dd829 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -472,7 +472,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 { |