mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
To: "sd@queasysnail.net" <sd@queasysnail.net>
Cc: "corbet@lwn.net" <corbet@lwn.net>,
	"dueno@redhat.com" <dueno@redhat.com>,
	"ssorce@redhat.com" <ssorce@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Alistair Francis <Alistair.Francis@wdc.com>,
	"john.fastabend@gmail.com" <john.fastabend@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"horms@kernel.org" <horms@kernel.org>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"dlemoal@kernel.org" <dlemoal@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>
Subject: Re: [RFC net-next 0/3] tls_sw: add tx record zero padding
Date: Tue, 17 Mar 2026 00:59:51 +0000	[thread overview]
Message-ID: <2225767d4d7da2bba49fe0a85f2ba9253de037cf.camel@wdc.com> (raw)
In-Reply-To: <abP_Zvrgd5TDKsUP@krikkit>

Re-sending this, new mail client sent with HTML...Sorry for the noise!

On Fri, 2026-03-13 at 13:13 +0100, Sabrina Dubroca wrote:
> Hi Wilfred,
> Sorry for the delay, I'm juggling a few too many things at the
> moment.

Hey Sabrina,
No worries, thanks for the feedback on this series!

> 
> 2026-03-09, 15:48:35 +1000, Wilfred Mallawa wrote:
> > From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
> > 
> > Currently, for TLS 1.3, ktls does not support record zero padding
> > [1].
> 
> to be precise: "on TX" (here, in the subject, and a few spots in the
> rest of the series)
> 
> > Record zero padding is used to allow the sender to hide the size of
> > the
> > traffic patterns from an observer. TLS is susceptible to a variety
> > of traffic
> > analysis attacks based on observing the length and timing of
> > encrypted
> > packets [2]. Upcoming Western Digital NVMe-TCP hardware controllers
> > implement TLS 1.3. Which from a security perspective, can benefit
> > from having
> > record zero padding enabled to mitigate against traffic analysis
> > attacks [2].
> > 
> > Thus, for TX, this series adds support to adding randomized number
> > of zero
> > padding bytes to end-of-record (EOR) records that are not full.
> > This
> > feature is disabled by default and can be enabled by the new
> > TLS_TX_RANDOM_PAD socket option. TLS_TX_RANDOM_PAD allows users to
> > set an upper
> > bound for the number of bytes to be used in zero padding, and can
> > be set
> > back to 0 to disable zero padding altogher. The number of zero
> > padding bytes
> > to append is determined by the remaining record room and the user
> > specified
> > upper bound (minimum of the two). That is
> > rand([0, min(record_room, upper_bound)]).
> 
> From an API point of view, I'm not sure TLS_TX_RANDOM_PAD (and with
> only an upper bound) is what we want. Passing
> {lower_bound,upper_bound}
> via the setsockopt would be more flexible, allow to always pad if
> userspace desires (maybe they're only sending very short records and
> want to hide that with 1000B+ padding every time? no idea), and also
> allow fixed-size padding if desired (by passing
> lower_bound==upper_bound).

I think this makes sense, and I can look into this, if we are going
ahead with this series.

> But I'm not involved in userspace libraries so I don't know.

Our main use-case has been using record zero padding with NVMe oF TCP +
TLS. Which means everything happens in the kernel. NVMe PDUs -> TLS
Records -> TCP. So in that context, this approach made sense.

> 
> I'm also worried about the (still WIP) 1.3 offload proposal. Are HW
> implementations going to support this? Should we consider that as a
> problem wrt transparency of HW offload in ktls?

That's a good point, I had not considered the 1.3 offload proposal, it
will likely need some driver level integration to enable this on
supported devices...

As of now this is exclusive to the SW driver. This series doesn't make
that clear and will need to address that. i.e we can make setsockopt()
complain if HW offload is enabled.

> 
> > Also a selftest is added to test the usage of TLS_TX_RANDOM_PAD.
> > However, it does not test for zero padding bytes as that is
> > stripped in
> > the ktls RX path.
> 
> Couldn't you use "raw RX" type tests and parse_tls_records to check
> the padding?

Do you mean an RX without having keys installed? Similar to what we do
for the record size limit tests? If so, the zero padding is still
stripped in the kernel iirc.

Regards,
Wilfred

      reply	other threads:[~2026-03-17  1:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  5:48 Wilfred Mallawa
2026-03-09  5:48 ` [RFC net-next 1/3] net/tls_sw: support randomized " Wilfred Mallawa
2026-03-13 13:16   ` Sabrina Dubroca
2026-03-14 14:39     ` Jakub Kicinski
2026-03-17  0:53       ` Wilfred Mallawa
2026-03-17  1:03         ` Jakub Kicinski
2026-03-17  1:21           ` Wilfred Mallawa
2026-03-17  1:30             ` Jakub Kicinski
2026-03-17  1:53               ` Wilfred Mallawa
2026-03-19  1:35                 ` Alistair Francis
2026-04-15  5:40                   ` Wilfred Mallawa
2026-03-17  9:19           ` Sabrina Dubroca
2026-03-17  0:20     ` Wilfred Mallawa
2026-03-09  5:48 ` [RFC net-next 2/3] net/tls: add randomized zero padding socket option Wilfred Mallawa
2026-03-09  5:48 ` [RFC net-next 3/3] selftest: tls: add tls record zero pad test Wilfred Mallawa
2026-03-13 12:13 ` [RFC net-next 0/3] tls_sw: add tx record zero padding Sabrina Dubroca
2026-03-17  0:59   ` Wilfred Mallawa [this message]

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=2225767d4d7da2bba49fe0a85f2ba9253de037cf.camel@wdc.com \
    --to=wilfred.mallawa@wdc.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=dlemoal@kernel.org \
    --cc=dueno@redhat.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sd@queasysnail.net \
    --cc=skhan@linuxfoundation.org \
    --cc=ssorce@redhat.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

all inboxes | Powered by JetHome®