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: <Z0g5M4oFCUCxiDQo@gauss3.secunet.de>
Date: Thu, 28 Nov 2024 10:34:43 +0100
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Jianbo Liu <jianbol@...dia.com>
CC: Leon Romanovsky <leon@...nel.org>, Christian Langrock
	<christian.langrock@...unet.com>, Herbert Xu <herbert@...dor.apana.org.au>,
	<netdev@...r.kernel.org>, Patrisious Haddad <phaddad@...dia.com>
Subject: Re: [PATCH ipsec-rc] xfrm: replay: Fix the update of
 replay_esn->oseq_hi for GSO

On Thu, Nov 28, 2024 at 09:48:10AM +0800, Jianbo Liu wrote:
> 
> 
> On 11/12/2024 8:10 PM, Leon Romanovsky wrote:
> > From: Jianbo Liu <jianbol@...dia.com>
> > 
> > When skb needs GSO and wrap around happens, if xo->seq.low (seqno of
> > the first skb segment) is before the last seq number but oseq (seqno
> > of the last segment) is after it, xo->seq.low is still bigger than
> > replay_esn->oseq while oseq is smaller than it, so the update of
> > replay_esn->oseq_hi is missed for this case wrap around because of
> > the change in the cited commit.
> > 
> > For example, if sending a packet with gso_segs=3 while old
> > replay_esn->oseq=0xfffffffe, we calculate:
> >      xo->seq.low = 0xfffffffe + 1 = 0x0xffffffff
> >      oseq = 0xfffffffe + 3 = 0x1
> > (oseq < replay_esn->oseq) is true, but (xo->seq.low <
> > replay_esn->oseq) is false, so replay_esn->oseq_hi is not incremented.
> > 
> > To fix this issue, change the outer checking back for the update of
> > replay_esn->oseq_hi. And add new checking inside for the update of
> > packet's oseq_hi.
> > 
> > Fixes: 4b549ccce941 ("xfrm: replay: Fix ESN wrap around for GSO")
> > Signed-off-by: Jianbo Liu <jianbol@...dia.com>
> > Reviewed-by: Patrisious Haddad <phaddad@...dia.com>
> > Signed-off-by: Leon Romanovsky <leonro@...dia.com>
> > ---
> >   net/xfrm/xfrm_replay.c | 10 ++++++----
> >   1 file changed, 6 insertions(+), 4 deletions(-)
> > 
> > diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c
> > index bc56c6305725..235bbefc2aba 100644
> > --- a/net/xfrm/xfrm_replay.c
> > +++ b/net/xfrm/xfrm_replay.c
> > @@ -714,10 +714,12 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff
> >   			oseq += skb_shinfo(skb)->gso_segs;
> >   		}
> > -		if (unlikely(xo->seq.low < replay_esn->oseq)) {
> > -			XFRM_SKB_CB(skb)->seq.output.hi = ++oseq_hi;
> > -			xo->seq.hi = oseq_hi;
> > -			replay_esn->oseq_hi = oseq_hi;
> > +		if (unlikely(oseq < replay_esn->oseq)) {
> > +			replay_esn->oseq_hi = ++oseq_hi;
> > +			if (xo->seq.low < replay_esn->oseq) {
> > +				XFRM_SKB_CB(skb)->seq.output.hi = oseq_hi;
> > +				xo->seq.hi = oseq_hi;
> > +			}
> >   			if (replay_esn->oseq_hi == 0) {
> >   				replay_esn->oseq--;
> >   				replay_esn->oseq_hi--;
> 
> Gentle ping ...

I've applied that already to the ipsec tree. Just forgot to
send the 'applied' mail.

Anyway, applied thanks a lot!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ