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: <tencent_4CE06FA903D8DCB54F951A30@qq.com>
Date:	Wed, 19 Feb 2014 10:07:14 +0800
From:	"Xianpeng Zhao" <673321875@...com>
To:	"Steffen Klassert" 
	<steffen.klassert@...unet.com>
Cc:	"netdev" <netdev@...r.kernel.org>,
	"alan" <alan@...rguk.ukuu.org.uk>
Subject: Re: Fw:[Bug 70471] xfrm policy node will double unlink.

Hi Steffen,

      This problem is happened when running stress test; Very little chance can get this case.

      As you say, add a long time sleep in function xfrm_policy_bysel_ctx between __xfrm_policy_unlink and 
xfrm_policy_kill, will reproduce this issue manually. 

      About my patch, I am not sure it is OK, because after it patched, the issue had reproduced once, but after some days test recently, have not reproduced again. 

      But I can make sure when __xfrm_policy_unlink find the node had been removed, return NULL instead of delete again will fix this problem.

      What's your suggestions?

------------------
Best Regards
Xianpeng

------------------ Original ------------------
From:  "Steffen Klassert";<steffen.klassert@...unet.com>;
Date:  Tue, Feb 18, 2014 04:37 PM
To:  "Xianpeng Zhao"<673321875@...com>; 
Cc:  "netdev"<netdev@...r.kernel.org>; "alan"<alan@...rguk.ukuu.org.uk>; 
Subject:  Re: Fw:[Bug 70471] xfrm policy node will double unlink.



On Tue, Feb 18, 2014 at 10:55:57AM +0800, Xianpeng Zhao wrote:
> Hi Group,
>      I found a problem about xfrm policy.
> 
>      In corner case, xfrm policy node will be double unlinked from the list.
> 
>     The scenario like this:
>     In thread context, After removed the node from list, before remove the xfrm policy expire timer. At this point, a timer interrupt come, and call the run_timer_softirq to execute the xfrm_policy_timer to remove the expired policy node; because this policy node had already removed from list. this remove will cause the node double unlinked.

Good catch!

I wonder why I've never seen this. Do you have a reproducer for this bug?

Looks like it is sufficient to reinitialize the bydst hlist in
__xfrm_policy_unlink(). Then hlist_unhashed() will notice that
this policy is not linked.

Does the patch below help?


diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 121399d..225f439 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1156,7 +1156,7 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
 	if (hlist_unhashed(&pol->bydst))
 		return NULL;
 
-	hlist_del(&pol->bydst);
+	hlist_del_init(&pol->bydst);
 	hlist_del(&pol->byidx);
 	list_del(&pol->walk.all);
 	net->xfrm.policy_count[dir]--;
.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ