netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC ipsec-next] Temporary SA allocation and OOM
@ 2014-01-26  9:50 Horia Geanta
  2014-01-26  9:50 ` [RFC ipsec-next] xfrm: avoid creating temporary SA when there are no listeners Horia Geanta
  0 siblings, 1 reply; 3+ messages in thread
From: Horia Geanta @ 2014-01-26  9:50 UTC (permalink / raw)
  To: Steffen Klassert, David S. Miller; +Cc: netdev

Hi,

In the cases where:
-policies are in place
-there are no key managers registered to PF_KEY / NETLINK XFRM events
-xfrm_states are not available (no KM to negotiate them)

xfrm_state_find will be called for every IPsec packet entering the system.
A temporary SA is allocated; however, since there are no KMs, km_query()
fails to send an ACQUIRE notification and the temporary SA is
immediately garbage collected.

This leads to OOM, considering the fact that SA alloc/free is performed
for each packet and garbage collection does not keep up the pace when
traffic rate is high.

I am attaching as RFC a patch that checks whether there are
any KMs registered before allocating the temporary SA.

A new callback - is_alive - is added to the xfrm_mgr.
If is_alive returns true, there are many chances that km_query() won't fail,
thus temporary SA won't be freed (at least not until it expires - 30s default).
This alleviates the strain caused by very frequent memory allocation.

Thanks,
Horia

Horia Geanta (1):
  xfrm: avoid creating temporary SA when there are no listeners

 include/net/xfrm.h    | 15 +++++++++++++++
 net/key/af_key.c      | 20 ++++++++++++++++++++
 net/xfrm/xfrm_state.c | 31 +++++++++++++++++++++++++++++++
 net/xfrm/xfrm_user.c  |  6 ++++++
 4 files changed, 72 insertions(+)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-28  7:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-26  9:50 [RFC ipsec-next] Temporary SA allocation and OOM Horia Geanta
2014-01-26  9:50 ` [RFC ipsec-next] xfrm: avoid creating temporary SA when there are no listeners Horia Geanta
2014-01-28  7:59   ` Steffen Klassert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).