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] [thread-next>] [day] [month] [year] [list]
Date: Wed, 14 Jun 2023 10:46:04 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Maxim Mikityanskiy <maxtram95@...il.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
 pabeni@...hat.com, j.vosburgh@...il.com, andy@...yhouse.net,
 rajur@...lsio.com, ayush.sawal@...lsio.com, dmichail@...gible.com,
 borisp@...dia.com, saeedm@...dia.com, leon@...nel.org,
 simon.horman@...igine.com, john.fastabend@...il.com,
 anirudh.venkataramanan@...el.com, tariqt@...dia.com, gal@...dia.com,
 raeds@...dia.com, liorna@...dia.com, louis.peens@...igine.com,
 yinjun.zhang@...igine.com, na.wang@...igine.com,
 linux-rdma@...r.kernel.org, oss-drivers@...igine.com
Subject: Re: [PATCH net-next] net: tls: make the offload check helper take
 skb not socket

On Wed, 14 Jun 2023 10:09:02 +0300 Maxim Mikityanskiy wrote:
> On Tue, 13 Jun 2023 at 13:50:06 -0700, Jakub Kicinski wrote:
> > All callers of tls_is_sk_tx_device_offloaded() currently do
> > an equivalent of:
> > 
> >  if (skb->sk && tls_is_skb_tx_device_offloaded(skb->sk))
> > 
> > Have the helper accept skb and do the skb->sk check locally.
> > Two drivers have local static inlines with similar wrappers
> > already.
> > 
> > While at it change the ifdef condition to TLS_DEVICE.
> > Only TLS_DEVICE selects SOCK_VALIDATE_XMIT, so the two are
> > equivalent. This makes removing the duplicated IS_ENABLED()
> > check in funeth more obviously correct.
> > 
> > Signed-off-by: Jakub Kicinski <kuba@...nel.org>  
> 
> Acked-by: Maxim Mikityanskiy <maxtram95@...il.com>

Thanks!

> > diff --git a/include/net/tls.h b/include/net/tls.h
> > index b7d0f1e3058b..5e71dd3df8ca 100644
> > --- a/include/net/tls.h
> > +++ b/include/net/tls.h
> > @@ -370,10 +370,12 @@ struct sk_buff *
> >  tls_validate_xmit_skb_sw(struct sock *sk, struct net_device *dev,
> >  			 struct sk_buff *skb);
> >  
> > -static inline bool tls_is_sk_tx_device_offloaded(struct sock *sk)
> > +static inline bool tls_is_skb_tx_device_offloaded(const struct sk_buff *skb)
> >  {
> > -#ifdef CONFIG_SOCK_VALIDATE_XMIT
> > -	return sk_fullsock(sk) &&
> > +#ifdef CONFIG_TLS_DEVICE
> > +	struct sock *sk = skb->sk;
> > +
> > +	return sk && sk_fullsock(sk) &&
> >  	       (smp_load_acquire(&sk->sk_validate_xmit_skb) ==
> >  	       &tls_validate_xmit_skb);
> >  #else  
> 
> After this change, the only usage of CONFIG_SOCK_VALIDATE_XMIT remains
> in sk_validate_xmit_skb, which has #ifdef CONFIG_TLS_DEVICE inside
> #ifdef CONFIG_SOCK_VALIDATE_XMIT. If feels a little bit weird, given
> that both defines always have the same value, but maybe it's OK if we
> consider that more users can start using sk_validate_xmit_skb in the
> future.

I'm working on another user of CONFIG_SOCK_VALIDATE_XMIT
so let's keep the two separate.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ