All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tariq Toukan <ttoukan.linux@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	borisp@nvidia.com, john.fastabend@gmail.com, maximmi@nvidia.com,
	tariqt@nvidia.com, vfedorenko@novek.ru,
	Ran Rozenstein <ranro@nvidia.com>,
	"gal@nvidia.com" <gal@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH net-next v3 7/7] tls: rx: do not use the standard strparser
Date: Thu, 4 Aug 2022 09:13:37 +0300	[thread overview]
Message-ID: <9dccb71f-e9a2-81f3-28bc-c170719a5f49@gmail.com> (raw)
In-Reply-To: <20220803182432.363b0c04@kernel.org>



On 8/4/2022 4:24 AM, Jakub Kicinski wrote:
> On Tue, 2 Aug 2022 17:54:01 +0300 Tariq Toukan wrote:
>>    [  407.589886] RIP: 0010:tls_device_decrypted+0x7a/0x2e0
> 
> Sorry, got distracted yesterday. This?

I also had issues yesterday with the decode script.
For some reason, it didn't work for me.
Probably a missing env variable, or a kernel config.

...
? tls_rx_rec_wait (tls_sw.c:?)
tls_rx_one_record (tls_sw.c:?)
tls_sw_recvmsg (??:?)
? __wait_for_common (build_utility.c:?)
? usleep_range_state (??:?)
inet6_recvmsg (??:?)
____sys_recvmsg (socket.c:?)
? _copy_from_user (??:?)
? iovec_from_user (??:?)
___sys_recvmsg (socket.c:?)
WARNING! Modules path isn't set, but is needed to parse this symbol
? post_static_params+0x15c/0x320 mlx5_core
WARNING! Modules path isn't set, but is needed to parse this symbol
? mlx5e_ktls_add_rx+0x3d1/0x5d0 mlx5_core
WARNING! Modules path isn't set, but is needed to parse this symbol
? mlx5e_ktls_add_rx+0x45d/0x5d0 mlx5_core
...

> 
> --->8--------------------
> tls: rx: device: bound the frag walk
> 
> We can't do skb_walk_frags() on the input skbs, because
> the input skbs is really just a pointer to the tcp read
> queue. We need to bound the "is decrypted" check by the
> amount of data in the message.
> 
> Note that the walk in tls_device_reencrypt() is after a
> CoW so the skb there is safe to walk. Actually in the
> current implementation it can't have frags at all, but
> whatever, maybe one day it will.
> 
> Reported-by: Tariq Toukan <tariqt@nvidia.com>
> Fixes: 84c61fe1a75b ("tls: rx: do not use the standard strparser")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>   net/tls/tls_device.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c
> index e3e6cf75aa03..6ed41474bdf8 100644
> --- a/net/tls/tls_device.c
> +++ b/net/tls/tls_device.c
> @@ -984,11 +984,17 @@ int tls_device_decrypted(struct sock *sk, struct tls_context *tls_ctx)
>   	int is_decrypted = skb->decrypted;
>   	int is_encrypted = !is_decrypted;
>   	struct sk_buff *skb_iter;
> +	int left;
>   
> +	left = rxm->full_len - skb->len;
>   	/* Check if all the data is decrypted already */
> -	skb_walk_frags(skb, skb_iter) {
> +	skb_iter = skb_shinfo(skb)->frag_list;
> +	while (skb_iter && left > 0) {
>   		is_decrypted &= skb_iter->decrypted;
>   		is_encrypted &= !skb_iter->decrypted;
> +
> +		left -= skb_iter->len;
> +		skb_iter = skb_iter->next;
>   	}
>   
>   	trace_tls_device_decrypted(sk, tcp_sk(sk)->copied_seq - rxm->full_len,

Thanks!
Testing it. I'll update.

  reply	other threads:[~2022-08-04  6:13 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 23:50 [PATCH net-next v3 0/7] tls: rx: decrypt from the TCP queue Jakub Kicinski
2022-07-22 23:50 ` [PATCH net-next v3 1/7] tls: rx: wrap recv_pkt accesses in helpers Jakub Kicinski
2022-07-22 23:50 ` [PATCH net-next v3 2/7] tls: rx: factor SW handling out of tls_rx_one_record() Jakub Kicinski
2022-07-22 23:50 ` [PATCH net-next v3 3/7] tls: rx: don't free the output in case of zero-copy Jakub Kicinski
2022-07-22 23:50 ` [PATCH net-next v3 4/7] tls: rx: device: keep the zero copy status with offload Jakub Kicinski
2022-07-22 23:50 ` [PATCH net-next v3 5/7] tcp: allow tls to decrypt directly from the tcp rcv queue Jakub Kicinski
2022-07-22 23:50 ` [PATCH net-next v3 6/7] tls: rx: device: add input CoW helper Jakub Kicinski
2022-07-22 23:50 ` [PATCH net-next v3 7/7] tls: rx: do not use the standard strparser Jakub Kicinski
2022-07-26  9:27   ` Paolo Abeni
2022-07-26 17:01     ` Jakub Kicinski
2022-07-26 17:26       ` Paolo Abeni
2022-08-02 14:54   ` Tariq Toukan
2022-08-02 15:40     ` Jakub Kicinski
2022-08-04  1:24     ` Jakub Kicinski
2022-08-04  6:13       ` Tariq Toukan [this message]
2022-08-04  8:05       ` Tariq Toukan
2022-08-04 15:35         ` Jakub Kicinski
2022-08-07  6:01           ` Tariq Toukan
2022-08-04 15:59         ` Jakub Kicinski
2022-08-07  6:01           ` Tariq Toukan
2022-08-08  5:24             ` Tariq Toukan
2022-08-08 18:24               ` Jakub Kicinski
2022-08-09  8:47                 ` Tariq Toukan
2023-03-09 15:15   ` Tariq Toukan
2023-03-09 17:54     ` Jakub Kicinski
2023-03-12 17:59       ` Tariq Toukan
2023-03-13 18:22         ` Jakub Kicinski
2023-03-15 20:26           ` Tariq Toukan
2023-03-16  1:41             ` Jakub Kicinski
2022-07-26 22:00 ` [PATCH net-next v3 0/7] tls: rx: decrypt from the TCP queue patchwork-bot+netdevbpf

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=9dccb71f-e9a2-81f3-28bc-c170719a5f49@gmail.com \
    --to=ttoukan.linux@gmail.com \
    --cc=borisp@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gal@nvidia.com \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=maximmi@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ranro@nvidia.com \
    --cc=tariqt@nvidia.com \
    --cc=vfedorenko@novek.ru \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.