From: Martin KaFai Lau <martin.lau@linux.dev>
To: Kui-Feng Lee <kuifeng@meta.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
song@kernel.org, kernel-team@meta.com
Subject: Re: [PATCH bpf-next 1/2] bpf: Check the protocol of a sock to agree the calls to bpf_setsockopt().
Date: Mon, 23 Jan 2023 16:55:52 -0800 [thread overview]
Message-ID: <4f1ecb2a-e6bc-028b-8e77-bd45160fddc3@linux.dev> (raw)
In-Reply-To: <20230121025716.3039933-2-kuifeng@meta.com>
On 1/20/23 6:57 PM, Kui-Feng Lee wrote:
> Resolve an issue when calling sol_tcp_sockopt() on a socket with ktls
> enabled. Prior to this patch, sol_tcp_sockopt() would only allow calls
> if the function pointer of setsockopt of the socket was set to
> tcp_setsockopt(). However, any socket with ktls enabled would have its
> function pointer set to tls_setsockopt(). To resolve this issue, the
> patch adds a check of the protocol of the linux socket and allows
> bpf_setsockopt() to be called if ktls is initialized on the linux
> socket. This ensures that calls to sol_tcp_sockopt() will succeed on
> sockets with ktls enabled.
>
> Signed-off-by: Kui-Feng Lee <kuifeng@meta.com>
> ---
> net/core/filter.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index b4547a2c02f4..890384cbdeb2 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -5204,7 +5204,7 @@ static int sol_tcp_sockopt(struct sock *sk, int optname,
> char *optval, int *optlen,
> bool getopt)
> {
> - if (sk->sk_prot->setsockopt != tcp_setsockopt)
> + if (sk->sk_protocol != IPPROTO_TCP)
It is a pretty broad test but I don't see particular issue also. Let see how it
goes.
next prev parent reply other threads:[~2023-01-24 0:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-21 2:57 [PATCH bpf-next 0/2] Enable bpf_setsockopt() on ktls enabled sockets Kui-Feng Lee
2023-01-21 2:57 ` [PATCH bpf-next 1/2] bpf: Check the protocol of a sock to agree the calls to bpf_setsockopt() Kui-Feng Lee
2023-01-24 0:55 ` Martin KaFai Lau [this message]
2023-01-21 2:57 ` [PATCH bpf-next 2/2] selftests/bpf: Calls bpf_setsockopt() on a ktls enabled socket Kui-Feng Lee
2023-01-24 0:52 ` Martin KaFai Lau
2023-01-24 17:11 ` Kui-Feng Lee
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=4f1ecb2a-e6bc-028b-8e77-bd45160fddc3@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=kernel-team@meta.com \
--cc=kuifeng@meta.com \
--cc=song@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