diff options
author | David S. Miller <davem@davemloft.net> | 2017-05-10 11:38:07 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-11 14:19:00 -0400 |
commit | e07b98d9bffe410019dfcf62c3428d4a96c56a2c (patch) | |
tree | 52a3aede39b1bac6a409586bcdd272d9aa958868 /include/linux/bpf_verifier.h | |
parent | c5fc9692d101d1318b0f53f9f691cd88ac029317 (diff) | |
download | lwn-e07b98d9bffe410019dfcf62c3428d4a96c56a2c.tar.gz lwn-e07b98d9bffe410019dfcf62c3428d4a96c56a2c.zip |
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>
Diffstat (limited to 'include/linux/bpf_verifier.h')
-rw-r--r-- | include/linux/bpf_verifier.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h index 7c6a51924afc..d5093b52b485 100644 --- a/include/linux/bpf_verifier.h +++ b/include/linux/bpf_verifier.h @@ -90,6 +90,7 @@ struct bpf_verifier_env { struct bpf_prog *prog; /* eBPF program being verified */ struct bpf_verifier_stack_elem *head; /* stack of verifier states to be processed */ int stack_size; /* number of states to be processed */ + bool strict_alignment; /* perform strict pointer alignment checks */ struct bpf_verifier_state cur_state; /* current verifier state */ struct bpf_verifier_state_list **explored_states; /* search pruning optimization */ const struct bpf_ext_analyzer_ops *analyzer_ops; /* external analyzer ops */ |