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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190418.165458.2210597262215422851.davem@davemloft.net>
Date:   Thu, 18 Apr 2019 16:54:58 -0700 (PDT)
From:   David Miller <davem@...emloft.net>
To:     jakub.kicinski@...ronome.com
Cc:     edumazet@...gle.com, netdev@...r.kernel.org,
        oss-drivers@...ronome.com, alexei.starovoitov@...il.com,
        john.hurley@...ronome.com
Subject: Re: [PATCH net] net/tls: fix refcount adjustment in fallback

From: Jakub Kicinski <jakub.kicinski@...ronome.com>
Date: Wed, 17 Apr 2019 10:51:19 -0700

> Unlike atomic_add(), refcount_add() does not deal well
> with a negative argument.  TLS fallback code reallocates
> the skb and is very likely to shrink the truesize, leading to:
> 
> [  189.513254] WARNING: CPU: 5 PID: 0 at lib/refcount.c:81 refcount_add_not_zero_checked+0x15c/0x180
>  Call Trace:
>   refcount_add_checked+0x6/0x40
>   tls_enc_skb+0xb93/0x13e0 [tls]
> 
> Once wmem_allocated count saturates the application can no longer
> send data on the socket.  This is similar to Eric's fixes for GSO,
> TCP:
> commit 7ec318feeed1 ("tcp: gso: avoid refcount_t warning from tcp_gso_segment()")
> and UDP:
> commit 575b65bc5bff ("udp: avoid refcount_t saturation in __udp_gso_segment()").
> 
> Unlike the GSO case, for TLS fallback it's likely that the skb has
> shrunk, so the "likely" annotation is the other way around (likely
> branch being "sub").
> 
> Fixes: e8f69799810c ("net/tls: Add generic NIC offload infrastructure")
> Signed-off-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
> Reviewed-by: John Hurley <john.hurley@...ronome.com>

Applied and queued up for -stable, thanks Jakub.

> Should we add a helper for this in -next?  Because with
> CONFIG_REFCOUNT_FULL=n we don't need the branch, we can just
> do an atomic_add() directly..

I think the value of that isn't so high.  Are we counting branch miss
penalities in code pathes where we are copying SKB data or doing SW
crypto? :-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ