Skip to contentSkip to conversation

flowcache: Fix kernel panic in flow_cache_flush_task

PATCH Applied Miroslav Urbanek 3 participants 4 messages Feb 5, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 flowcache: Fix kernel panic in flow_cache_flush_task

flow_cache_flush_task references a structure member flow_cache_gc_work where it should reference flow_cache_flush_task instead.

Kernel panic occurs on kernels using IPsec during XFRM garbage

collection. The garbage collection interval can be shortened using the following sysctl settings:

net.ipv4.xfrm4_gc_thresh=4
net.ipv6.xfrm6_gc_thresh=4

With the default settings, our productions servers crash approximately once a week. With the settings above, they crash immediately.

Fixes ca925cf1534e ("flowcache: Make flow cache name space aware")
---
 net/core/flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/flow.c +1 -1
index a0348fd..1033725 100644
@@ -379,7 +379,7 @@ done:
 static void flow_cache_flush_task(struct work_struct *work)
 {
 	struct netns_xfrm *xfrm = container_of(work, struct netns_xfrm,
-						flow_cache_gc_work);
+						flow_cache_flush_work);
 	struct net *net = container_of(xfrm, struct net, xfrm);
 
 	flow_cache_flush(net);
Signature · 1 line
2.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Miroslav Urbanek

flow_cache_flush_task references a structure member flow_cache_gc_work where it should reference flow_cache_flush_task instead.

Kernel panic occurs on kernels using IPsec during XFRM garbage

collection. The garbage collection interval can be shortened using the following sysctl settings:

net.ipv4.xfrm4_gc_thresh=4
net.ipv6.xfrm6_gc_thresh=4

Quoted 8 lines

With the default settings, our productions servers crash approximately once a week. With the settings above, they crash immediately.

Fixes ca925cf1534e ("flowcache: Make flow cache name space aware")

---

Nice catch !

Ok, but you do not need to cc so many people/lists

netdev is fine, and we usually CC patch author, just in case.

#2 lore raw

Thanks for the tip. It's my first kernel patch, so I wanted to make sure it won't get lost :-)

Anyway, I also looked into the function flow_cache_fini. Isn't it necessary to flush/cancel scheduled works here? Something like:

flush_work(&net->xfrm.flow_cache_flush_work);
flush_work(&net->xfrm.flow_cache_gc_work);

I'm not sure if it is a bug or not. Could it happen that there is a scheduled work while the kernel calls flow_cache_fini?

I originally suspected this was the real bug we hit, but we don't use net namespaces, so our kernels never call flow_cache_fini.

Quoted 9 lines

Nice catch !

Ok, but you do not need to cc so many people/lists

netdev is fine, and we usually CC patch author, just in case.

maintainer Applied
#3 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Thu, 05 Feb 2015 08:44:08 -0800

Quoted 20 lines · Miroslav Urbanek
Quoted 10 lines

flow_cache_flush_task references a structure member flow_cache_gc_work where it should reference flow_cache_flush_task instead.

Kernel panic occurs on kernels using IPsec during XFRM garbage

collection. The garbage collection interval can be shortened using the following sysctl settings:

net.ipv4.xfrm4_gc_thresh=4
net.ipv6.xfrm6_gc_thresh=4

Quoted 8 lines

With the default settings, our productions servers crash approximately once a week. With the settings above, they crash immediately.

Fixes ca925cf1534e ("flowcache: Make flow cache name space aware")

---

Quoted 7 lines

Nice catch !

Ok, but you do not need to cc so many people/lists

netdev is fine, and we usually CC patch author, just in case.

Applied, thanks.