From: Song Liu <song@kernel.org>
To: John Fastabend <john.fastabend@gmail.com>
Cc: Martin KaFai Lau <kafai@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Alexei Starovoitov <ast@kernel.org>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [bpf PATCH v2 3/5] bpf, selftests: Add tests for ctx access in sock_ops with single register
Date: Wed, 29 Jul 2020 14:35:56 -0700 [thread overview]
Message-ID: <CAPhsuW7qesH-NwNgeOM4A04BggD=AzJoQrQ-fB1gdG-3xAcxGQ@mail.gmail.com> (raw)
In-Reply-To: <159603981285.4454.14040533307191666685.stgit@john-Precision-5820-Tower>
On Wed, Jul 29, 2020 at 9:24 AM John Fastabend <john.fastabend@gmail.com> wrote:
>
[...]
>
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Song Liu <songliubraving@fb.com>
> ---
> .../testing/selftests/bpf/progs/test_tcpbpf_kern.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> index 1f1966e..f8b13682 100644
> --- a/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> +++ b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
> @@ -54,6 +54,7 @@ SEC("sockops")
> int bpf_testcb(struct bpf_sock_ops *skops)
> {
> char header[sizeof(struct ipv6hdr) + sizeof(struct tcphdr)];
> + struct bpf_sock_ops *reuse = skops;
> struct tcphdr *thdr;
> int good_call_rv = 0;
> int bad_call_rv = 0;
> @@ -62,6 +63,18 @@ int bpf_testcb(struct bpf_sock_ops *skops)
> int v = 0;
> int op;
>
> + /* Test reading fields in bpf_sock_ops using single register */
> + asm volatile (
> + "%[reuse] = *(u32 *)(%[reuse] +96)"
> + : [reuse] "+r"(reuse)
> + :);
> +
> + asm volatile (
> + "%[op] = *(u32 *)(%[skops] +96)"
> + : [op] "+r"(op)
> + : [skops] "r"(skops)
> + :);
> +
Shall we add a separate test for this? It does seem to fix in bpf_testcb().
> op = (int) skops->op;
>
> update_event_map(op);
>
next prev parent reply other threads:[~2020-07-29 21:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 16:22 [bpf PATCH v2 0/5] Fix sock_ops field read splat John Fastabend
2020-07-29 16:22 ` [bpf PATCH v2 1/5] bpf: sock_ops ctx access may stomp registers in corner case John Fastabend
2020-07-29 21:29 ` Song Liu
2020-07-31 12:25 ` Daniel Borkmann
2020-07-31 22:46 ` John Fastabend
2020-07-29 16:23 ` [bpf PATCH v2 2/5] bpf: sock_ops sk access may stomp registers when dst_reg = src_reg John Fastabend
2020-07-29 21:30 ` Song Liu
2020-07-29 16:23 ` [bpf PATCH v2 3/5] bpf, selftests: Add tests for ctx access in sock_ops with single register John Fastabend
2020-07-29 21:35 ` Song Liu [this message]
2020-07-29 16:23 ` [bpf PATCH v2 4/5] bpf, selftests: Add tests for sock_ops load with r9, r8.r7 registers John Fastabend
2020-07-29 21:36 ` Song Liu
2020-07-29 16:24 ` [bpf PATCH v2 5/5] bpf, selftests: Add tests to sock_ops for loading sk John Fastabend
2020-07-29 21:36 ` Song Liu
2020-07-29 21:57 ` [bpf PATCH v2 0/5] Fix sock_ops field read splat Martin KaFai Lau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPhsuW7qesH-NwNgeOM4A04BggD=AzJoQrQ-fB1gdG-3xAcxGQ@mail.gmail.com' \
--to=song@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).