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]
Message-ID: <CANn89i+t9t5ca=r6ZKw7s-HrxzgJjCB6hmWLccKmmxg8H=HUUA@mail.gmail.com>
Date: Mon, 18 Dec 2023 12:07:50 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Zhang Yiqun <zhangyiqun@...tium.com.cn>
Cc: steffen.klassert@...unet.com, herbert@...dor.apana.org.au, 
	davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com, 
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] xfrm: Use spin_lock_bh() in xfrm_input()

On Mon, Dec 18, 2023 at 9:43 AM Zhang Yiqun <zhangyiqun@...tium.com.cn> wrote:
>
> This patch is to change spin_lock() into spin_lock_bh(), which can
> disable bottem half in calling. If we leave this as spin_lock(),
> it may stuck in a deadlock, because the callback in bottem half in
> crypto driver will also call xfrm_input() again.
>
> Signed-off-by: Zhang Yiqun <zhangyiqun@...tium.com.cn>

When was the bug added ?
We need a FIxes: tag.

Also a stack trace to show the deadlock (or lockdep complaint ) would
be needed as well.

> ---
>  net/xfrm/xfrm_input.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
> index bd4ce21d76d7..f4cd46d73b1e 100644
> --- a/net/xfrm/xfrm_input.c
> +++ b/net/xfrm/xfrm_input.c
> @@ -581,7 +581,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
>                 }
>
>  lock:
> -               spin_lock(&x->lock);
> +               spin_lock_bh(&x->lock);
>
>                 if (unlikely(x->km.state != XFRM_STATE_VALID)) {
>                         if (x->km.state == XFRM_STATE_ACQ)
> @@ -607,7 +607,7 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
>                         goto drop_unlock;
>                 }
>
> -               spin_unlock(&x->lock);
> +               spin_unlock_bh(&x->lock);
>
>                 if (xfrm_tunnel_check(skb, x, family)) {
>                         XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEMODEERROR);

This patch is not correct anyway.
There are five places in xfrm_input() where x->lock is either locked
or unlocked.

Please tell us how this was tested.
Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ