Patch "xfrm: Reinject transport-mode packets through tasklet" has been added to the 4.14-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
xfrm: Reinject transport-mode packets through tasklet
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
xfrm-reinject-transport-mode-packets-through-tasklet.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Wed Feb 28 16:23:28 CET 2018
From: Herbert Xu <[email protected]>
Date: Fri, 15 Dec 2017 16:40:44 +1100
Subject: xfrm: Reinject transport-mode packets through tasklet
From: Herbert Xu <[email protected]>
[ Upstream commit acf568ee859f098279eadf551612f103afdacb4e ]
This is an old bugbear of mine:
https://www.mail-archive.com/[email protected]/msg03894.html
By crafting special packets, it is possible to cause recursion in our kernel when processing transport-mode packets at levels that are only limited by packet size.
The easiest one is with DNAT, but an even worse one is where UDP encapsulation is used in which case you just have to insert an UDP encapsulation header in between each level of recursion.
This patch avoids this problem by reinjecting tranport-mode packets through a tasklet.
--- include/net/xfrm.h | 3 ++ net/ipv4/xfrm4_input.c | 12 +++++++++- net/ipv6/xfrm6_input.c | 10 +++++++- net/xfrm/xfrm_input.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-)
include/net/xfrm.h +3 -0
@@ -1570,6 +1570,9 @@ int xfrm_init_state(struct xfrm_state *xint xfrm_prepare_input (struct xfrm_state *x,struct sk_buff *skb);int xfrm_input (struct sk_buff *skb,int nexthdr,__be32 spi,int encap_type);int xfrm_input_resume (struct sk_buff *skb,int nexthdr); +int xfrm_trans_queue (struct sk_buff *skb, +int (*finish)(struct net *,struct sock *, +struct sk_buff *));int xfrm_output_resume (struct sk_buff *skb,int err);int xfrm_output (struct sock *sk,struct sk_buff *skb);int xfrm_inner_extract_output (struct xfrm_state *x,struct sk_buff *skb);
net/ipv4/xfrm4_input.c +11 -1
@@ -23,6 +23,12 @@ int xfrm4_extract_input(struct xfrm_statreturn xfrm4_extract_header (skb); } +static int xfrm4_rcv_encap_finish2 (struct net *net,struct sock *sk, +struct sk_buff *skb) +{ +return dst_input (skb); +} +static inline int xfrm4_rcv_encap_finish (struct net *net,struct sock *sk,struct sk_buff *skb) {
@@ -33,7 +39,11 @@ static inline int xfrm4_rcv_encap_finish iph->tos, skb->dev)) goto drop; } -return dst_input (skb); + +if (xfrm_trans_queue (skb, xfrm4_rcv_encap_finish2)) + goto drop; + +return 0 ; drop:kfree_skb (skb);return NET_RX_DROP ;
net/ipv6/xfrm6_input.c +9 -1
@@ -32,6 +32,14 @@ int xfrm6_rcv_spi(struct sk_buff *skb, i }EXPORT_SYMBOL (xfrm6_rcv_spi); +static int xfrm6_transport_finish2 (struct net *net,struct sock *sk, +struct sk_buff *skb) +{ +if (xfrm_trans_queue (skb, ip6_rcv_finish)) +__kfree_skb (skb); +return -1 ; +} +int xfrm6_transport_finish (struct sk_buff *skb,int async) {struct xfrm_offload *xo =xfrm_offload (skb);
@@ -56,7 +64,7 @@ int xfrm6_transport_finish(struct sk_bufNF_HOOK (NFPROTO_IPV6 ,NF_INET_PRE_ROUTING ,dev_net (skb->dev),NULL , skb, skb->dev,NULL , - ip6_rcv_finish); + xfrm6_transport_finish2);return -1 ; }
net/xfrm/xfrm_input.c +57 -0
91 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/lib-mpi-fix-umul_ppmm-for-mips64r6.patch queue-4.14/xfrm-reinject-transport-mode-packets-through-tasklet.patch queue-4.14/crypto-inside-secure-per-request-invalidation.patch queue-4.14/crypto-inside-secure-fix-request-allocations-in-invalidation-path.patch queue-4.14/crypto-af_alg-fix-race-around-ctx-rcvused-by-making-it-atomic_t.patch queue-4.14/crypto-inside-secure-free-requests-even-if-their-handling-failed.patch