[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZC4qAJHkQq_ZVTk2REv+6u1xLhv3de15Ec2u+AT7SiMg@mail.gmail.com>
Date: Mon, 18 May 2020 22:06:32 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [bpf-next PATCH 4/4] bpf: selftests, add printk to
test_sk_lookup_kern to encode null ptr check
On Mon, May 18, 2020 at 1:05 PM John Fastabend <john.fastabend@...il.com> wrote:
>
> Adding a printk to test_sk_lookup_kern created the reported failure
> where a pointer type is checked twice for NULL. Lets add it to the
> progs test test_sk_lookup_kern.c so we test the case from C all the
> way into the verifier.
>
> We already have printk's in selftests so seems OK to add another one.
>
> Signed-off-by: John Fastabend <john.fastabend@...il.com>
> ---
Yeah, I think it's fine.
Acked-by: Andrii Nakryiko <andriin@...com>
> .../selftests/bpf/progs/test_sk_lookup_kern.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
> index d2b38fa..e83d0b4 100644
> --- a/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
> +++ b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
> @@ -73,6 +73,7 @@ int bpf_sk_lookup_test0(struct __sk_buff *skb)
>
> tuple_len = ipv4 ? sizeof(tuple->ipv4) : sizeof(tuple->ipv6);
> sk = bpf_sk_lookup_tcp(skb, tuple, tuple_len, BPF_F_CURRENT_NETNS, 0);
> + bpf_printk("sk=%d\n", sk ? 1 : 0);
> if (sk)
> bpf_sk_release(sk);
> return sk ? TC_ACT_OK : TC_ACT_UNSPEC;
>
Powered by blists - more mailing lists