提交 92624782 编写于 作者: E Eric Dumazet 提交者: David S. Miller

bpf: enforce correct alignment for instructions

After commit 9facc336 ("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: 9facc336 ("bpf: reject any prog that failed read-only lock")
Signed-off-by: NEric 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: NDavid S. Miller <davem@davemloft.net>
上级 08d02364
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册