]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Add strict alignment flag for BPF_PROG_LOAD.
authorDavid S. Miller <davem@davemloft.net>
Wed, 10 May 2017 18:38:07 +0000 (11:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 May 2017 18:19:00 +0000 (14:19 -0400)
commita84b1a4bac9e9d4e4a21532f37d6a1738407484b
tree52a3aede39b1bac6a409586bcdd272d9aa958868
parent13a5a0d0abe8df531f31c85ec6580c708b5a9cfc
bpf: Add strict alignment flag for BPF_PROG_LOAD.

Add a new field, "prog_flags", and an initial flag value
BPF_F_STRICT_ALIGNMENT.

When set, the verifier will enforce strict pointer alignment
regardless of the setting of CONFIG_EFFICIENT_UNALIGNED_ACCESS.

The verifier, in this mode, will also use a fixed value of "2" in
place of NET_IP_ALIGN.

This facilitates test cases that will exercise and validate this part
of the verifier even when run on architectures where alignment doesn't
matter.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
include/linux/bpf_verifier.h
include/uapi/linux/bpf.h
kernel/bpf/syscall.c
kernel/bpf/verifier.c
tools/build/feature/test-bpf.c
tools/include/uapi/linux/bpf.h