netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Watson <davejwatson@fb.com>
To: Boris Pismenny <borisp@mellanox.com>
Cc: "aviadye@mellanox.com" <aviadye@mellanox.com>,
	"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
	"daniel@iogearbox.net" <daniel@iogearbox.net>,
	"vakul.garg@nxp.com" <vakul.garg@nxp.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"eranbe@mellanox.com" <eranbe@mellanox.com>
Subject: Re: [PATCH net 4/4] tls: Fix tls_device receive
Date: Tue, 26 Feb 2019 20:34:40 +0000	[thread overview]
Message-ID: <20190226203437.c7tsjfb5ri35nn6y@iphone-a056f37cfbb1.dhcp.thefacebook.com> (raw)
In-Reply-To: <20190226121235.20784-5-borisp@mellanox.com>

On 02/26/19 02:12 PM, Boris Pismenny wrote:
> Currently, the receive function fails to handle records already
> decrypted by the device due to the commit mentioned below.
> 
> This commit advances the TLS record sequence number and prepares the context
> to handle the next record.
> 
> Fixes: fedf201e1296 ("net: tls: Refactor control message handling on recv")
> Signed-off-by: Boris Pismenny <borisp@mellanox.com>
> Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
> ---
>  net/tls/tls_sw.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
> index f515cd7e984e..85da10182d8d 100644
> --- a/net/tls/tls_sw.c
> +++ b/net/tls/tls_sw.c
> @@ -1481,18 +1481,17 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
>  
>  			return err;
>  		}
> -
> -		rxm->full_len -= padding_length(ctx, tls_ctx, skb);
> -
> -		rxm->offset += prot->prepend_size;
> -		rxm->full_len -= prot->overhead_size;
> -		tls_advance_record_sn(sk, &tls_ctx->rx, version);
> -		ctx->decrypted = true;
> -		ctx->saved_data_ready(sk);
>  	} else {
>  		*zc = false;
>  	}
>  
> +	rxm->full_len -= padding_length(ctx, tls_ctx, skb);
> +	rxm->offset += prot->prepend_size;
> +	rxm->full_len -= prot->overhead_size;
> +	tls_advance_record_sn(sk, &tls_ctx->rx, version);
> +	ctx->decrypted = true;
> +	ctx->saved_data_ready(sk);
> +
>  	return err;
>  }

This breaks the tls.control_msg test:

  [ RUN      ] tls.control_msg
  tls.c:764:tls.control_msg:Expected memcmp(buf, test_str, send_len) (18446744073709551614) == 0 (0)
  tls.c:777:tls.control_msg:Expected memcmp(buf, test_str, send_len) (18446744073709551614) == 0 (0)
  tls.control_msg: Test failed at step #8

So either control message handling needs to only call
decrypt_skb_update once, or we need a new flag or something to handle
the device case

  parent reply	other threads:[~2019-02-26 20:35 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 12:12 [PATCH net 0/4] tls: Fix issues in tls_device Boris Pismenny
2019-02-26 12:12 ` [PATCH net 1/4] tls: Fix tls_device handling of partial records Boris Pismenny
2019-02-26 14:57   ` Vakul Garg
2019-02-26 15:05     ` Boris Pismenny
2019-02-26 12:12 ` [PATCH net 2/4] tls: Fix write space handling Boris Pismenny
2019-02-26 12:49   ` Vakul Garg
2019-02-26 14:13     ` Boris Pismenny
2019-03-11 15:06       ` Vakul Garg
2019-03-11 15:59         ` Boris Pismenny
2019-03-12  6:02           ` Vakul Garg
2019-02-26 12:12 ` [PATCH net 3/4] tls: Fix mixing between async capable and async Boris Pismenny
2019-02-26 12:38   ` Vakul Garg
2019-02-26 13:43     ` Boris Pismenny
2019-02-26 12:12 ` [PATCH net 4/4] tls: Fix tls_device receive Boris Pismenny
2019-02-26 15:01   ` Vakul Garg
2019-02-26 20:34   ` Dave Watson [this message]
2019-02-27  3:08     ` Vakul Garg
2019-02-27 15:23       ` Boris Pismenny
2019-02-27 16:28         ` Vakul Garg
2019-02-27 15:26     ` Boris Pismenny

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=20190226203437.c7tsjfb5ri35nn6y@iphone-a056f37cfbb1.dhcp.thefacebook.com \
    --to=davejwatson@fb.com \
    --cc=aviadye@mellanox.com \
    --cc=borisp@mellanox.com \
    --cc=daniel@iogearbox.net \
    --cc=eranbe@mellanox.com \
    --cc=john.fastabend@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vakul.garg@nxp.com \
    /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).