lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 May 2019 14:39:03 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc:     Boris Pismenny <borisp@...lanox.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "oss-drivers@...ronome.com" <oss-drivers@...ronome.com>,
        "davejwatson@...com" <davejwatson@...com>,
        "john.fastabend@...il.com" <john.fastabend@...il.com>,
        "vakul.garg@....com" <vakul.garg@....com>,
        Alexei Starovoitov <ast@...nel.org>,
        Tariq Toukan <tariqt@...lanox.com>
Subject: Re: [PATCH net 3/3] Documentation: add TLS offload documentation

On Thu, 16 May 2019 12:32:59 -0700, Alexei Starovoitov wrote:
> On Thu, May 16, 2019 at 11:42:03AM -0700, Jakub Kicinski wrote:
> > On Thu, 16 May 2019 11:13:47 -0700, Alexei Starovoitov wrote:
> > > On Thu, May 16, 2019 at 10:57 AM Jakub Kicinski wrote:
> > > >
> > > >   The preferred method of reporting the Layer 4 (TCP) checksum offload
> > > >   for packets decrypted by the device is to update the checksum field
> > > >   to the correct value for clear text and report CHECKSUM_UNNECESSARY
> > > >   or CHECKSUM_COMPLETE computed over clear text. However, the exact
> > > >   semantics of RX checksum offload when NIC performs data modification
> > > >   are not clear and subject to change.
> > >
> > > when host is consuming the tcp stream I don't see the value of
> > > tcp checksum on top tls.
> > > In that sense CHECKSUM_UNNECESSARY is fine and no
> > > need to update checksum field.
> > > Even in case of sockmap and tcp stream redirect it is still fine.
> > > Only the tcp payload being redirected to a different tcp socket
> > > and the headers are gone.
> > > So imo in all cases CHECKSUM_UNNECESSARY is fine
> > > even without adjustment to checksum field.
> >
> > No question that CHECKSUM_UNNECESSARY currently works.
> > But it's not "entirely" correct without the header fixup?
> > Device modifies the data - it should fix up the checksum.
>
> I think it's an interesting angle to discuss.
> Though ktls in hw is done per packet many key fields of ip/tcp headers
> are fully processed.

Checksum has been validated, 5-tuple extracted and sequence number
confirmed.  That's not that much, aRFS will do most of it.

> socket is selected and payload is decrypted.

To be clear socket is not assigned to the skb by the offload today.

I only realized it after replying to your other statements but the key
is that the device and the kernel are still tightly coupled by the
decrypted bit set in the descriptor and then the skb.  So there is no
wire-level middlebox going on here.

> imo it is better to state that such headers have been 'consumed' by hw.
> Where 'consumed' would mean that hw did what network layering suppose to do
> and the stack should not look at them (because they can contain garbage).
> (in that sense it's fine to keep csum unadjusted. imo it's ok to zero-out IP too)
> Such decrypted skb is essentially a wrapper of payload plus
> left-over headers passed to the stack.

Expressing that cleanly in terms of sk_buff fields seems hard.  We
could add another checksum bit to denote CHECKSUM_BROKEN_BUT_OKAY,
if we really need it (today as stated for TCP streams UNNECESSARY
works with mangled csums).

> I think it makes sense to clarify which headers have been consumed/processed.
> Like: IP4/6+protocol+port+csum - processed, whereas
> tcp bits, dscp, ecn are still valid and have to be processed by the stack.

Invalidating the 5 tuple on the packet seems like a step backward,
the stack would no longer have the ability to match the packets based
on header fields for firewalling, accounting, whatnot.

> > I was trying (unsuccessfully) to hint at the fact that it's okay
> > today to leave the checksum be, but at the same time if someone
> > is designing new HW or has the ability to fix this up in microcode
> > I think the TCP csum should be fixed..
>
> I don't think so. hw should work together with the stack
> instead of being 'inline transparent decryption box'.

I'd rather not extend socket handling into the firmware.  I'm hoping
that a narrower interface (checksum bit + decrypted bit) will give more
independence to the stack, and I see no negative implications for the
the firmware (negative in the sense we don't have to trust and be bound
by it).

> If hw decrypts stuff and adjusts csum it would imply that stack
> will see completely valid headers. It would also imply that
> the stack must check csum.

What's wrong with the checksum being fixed up after data gets processed?
It's not that the stack _must_ check the checksum, it's that the stack
_may_ reasonably look at that field - CHECKSUM_UNNECESSARY.

> That doesn't seem right from trust point of view.

Please clarify where the trust problem is.  The processed packet still
has to come with a "decrypted" metadata indication (which we'll
translated into skb->decrypted), so it's still necessarily a tightly
coupled interface.


> >
> > Maybe like this?
> >
> >   The preferred method of reporting the Layer 4 (TCP) checksum offload
> >   for packets decrypted by the device is to update the checksum field
> >   to the correct value for clear text and report CHECKSUM_UNNECESSARY
> >   or CHECKSUM_COMPLETE computed over clear text.
> >
> >   Some existing devices may report CHECKSUM_UNNECESSARY without fixing
> >   the checksum field, which currently functions correctly but is not
> >   in line with the exact semantics of RX checksum offload. Such devices
> >   must make sure that RXCSUM offload is always enabled for TLS offloaded
> >   flows.
>
> I don't like it for the reasons above.
>
> > > Obviously the hw/firmware should have checked tcp csum before doing decrypt.
> >
> > Ah, that is definitely worth stating, will add!

Powered by blists - more mailing lists