mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
bpf/tests: Add test case flag for verifier zero-extension
This patch adds a new flag to indicate that the verified did insert zero-extensions, even though the verifier is not being run for any of the tests. Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20210914091842.4186267-9-johan.almbladh@anyfinetworks.com
This commit is contained in:
parent
2e80761194
commit
27cc6dac6e
1 changed files with 3 additions and 0 deletions
|
@ -52,6 +52,7 @@
|
||||||
#define FLAG_NO_DATA BIT(0)
|
#define FLAG_NO_DATA BIT(0)
|
||||||
#define FLAG_EXPECTED_FAIL BIT(1)
|
#define FLAG_EXPECTED_FAIL BIT(1)
|
||||||
#define FLAG_SKB_FRAG BIT(2)
|
#define FLAG_SKB_FRAG BIT(2)
|
||||||
|
#define FLAG_VERIFIER_ZEXT BIT(3)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CLASSIC = BIT(6), /* Old BPF instructions only. */
|
CLASSIC = BIT(6), /* Old BPF instructions only. */
|
||||||
|
@ -11280,6 +11281,8 @@ static struct bpf_prog *generate_filter(int which, int *err)
|
||||||
fp->type = BPF_PROG_TYPE_SOCKET_FILTER;
|
fp->type = BPF_PROG_TYPE_SOCKET_FILTER;
|
||||||
memcpy(fp->insnsi, fptr, fp->len * sizeof(struct bpf_insn));
|
memcpy(fp->insnsi, fptr, fp->len * sizeof(struct bpf_insn));
|
||||||
fp->aux->stack_depth = tests[which].stack_depth;
|
fp->aux->stack_depth = tests[which].stack_depth;
|
||||||
|
fp->aux->verifier_zext = !!(tests[which].aux &
|
||||||
|
FLAG_VERIFIER_ZEXT);
|
||||||
|
|
||||||
/* We cannot error here as we don't need type compatibility
|
/* We cannot error here as we don't need type compatibility
|
||||||
* checks.
|
* checks.
|
||||||
|
|
Loading…
Reference in a new issue