Skip to contentSkip to conversation

pull request (net-next): ipsec-next 2017-09-01

PATCH New Steffen Klassert 2 participants 4 messages Sep 1, 2017

Subsystems (3)
lore
Share & tools
lore

Steffen Klassert

author maintainer
#0 lore raw

This should be the last ipsec-next pull request for this release cycle:

1) Support netdevice ESP trailer removal when decryption is offloaded. From Yossi Kuperman.

2) Fix overwritten return value of copy_sec_ctx().

Please pull or let me know if there are problems.

Thanks!

The following changes since commit acfb98b99647aa7dc7c111db52d5f4199d2b641f:

liquidio: fix crash in presence of zeroed-out base address regs (2017-08-30 22:07:09 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

for you to fetch changes up to 8598112d04af21cf6c895670e72dcb8a9f58e74f:

xfrm: Fix return value check of copy_sec_ctx. (2017-08-31 10:37:00 +0200)

----------------------------------------------------------------
Steffen Klassert (1):
xfrm: Fix return value check of copy_sec_ctx.

Yossi Kuperman (1):
xfrm: Add support for network devices capable of removing the ESP trailer

 include/net/xfrm.h    |  1 +
 net/ipv4/esp4.c       | 70 ++++++++++++++++++++++++++++++++++-----------------
 net/ipv6/esp6.c       | 51 ++++++++++++++++++++++++++-----------
 net/xfrm/xfrm_input.c |  5 ++++
 net/xfrm/xfrm_user.c  |  4 +--
 5 files changed, 91 insertions(+), 40 deletions(-)
author maintainer
#1 lore raw

PATCH 1/2 xfrm: Add support for network devices capable of removing the ESP trailer

From: Yossi Kuperman <[email protected]>

In conjunction with crypto offload [1], removing the ESP trailer by hardware can potentially improve the performance by avoiding (1) a cache miss incurred by reading the nexthdr field and (2) the necessity to calculate the csum value of the trailer in order to keep skb->csum valid.

This patch introduces the changes to the xfrm stack and merely serves as an infrastructure. Subsequent patch to mlx5 driver will put this to a good use.

[1] https://www.mail-archive.com/[email protected]/msg175733.html

---
 include/net/xfrm.h    |  1 +
 net/ipv4/esp4.c       | 70 ++++++++++++++++++++++++++++++++++-----------------
 net/ipv6/esp6.c       | 51 ++++++++++++++++++++++++++-----------
 net/xfrm/xfrm_input.c |  5 ++++
 4 files changed, 89 insertions(+), 38 deletions(-)
include/net/xfrm.h +1 -0
index 9c7b70c..f002a2c 100644
@@ -1019,6 +1019,7 @@ struct xfrm_offload {
 #define	CRYPTO_FALLBACK		8
 #define	XFRM_GSO_SEGMENT	16
 #define	XFRM_GRO		32
+#define	XFRM_ESP_NO_TRAILER	64
 
 	__u32			status;
 #define CRYPTO_SUCCESS				1
net/ipv4/esp4.c +47 -23

104 lines not on this page · raw message

net/ipv6/esp6.c +36 -15

91 lines not on this page · raw message

net/xfrm/xfrm_input.c +5 -0
index f07eec5..2515cd2 100644
@@ -247,6 +247,11 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
 					goto drop;
 				}
 
+				if (xo->status & CRYPTO_INVALID_PROTOCOL) {
+					XFRM_INC_STATS(net, LINUX_MIB_XFRMINSTATEPROTOERROR);
+					goto drop;
+				}
+
 				XFRM_INC_STATS(net, LINUX_MIB_XFRMINBUFFERERROR);
 				goto drop;
 			}
Signature · 1 line
2.7.4
author maintainer
#2 lore raw

PATCH 2/2 xfrm: Fix return value check of copy_sec_ctx.

In reply to Steffen Klassert

A recent commit added an output_mark. When copying this output_mark, the return value of copy_sec_ctx is overwitten without a check. Fix this by copying the output_mark before the security context.

Fixes 077fbac405bf ("net: xfrm: support setting an output mark.")
---
 net/xfrm/xfrm_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/xfrm/xfrm_user.c +2 -2
index cc3268d..490132d 100644
@@ -900,13 +900,13 @@ static int copy_to_user_state_extra(struct xfrm_state *x,
 		ret = copy_user_offload(&x->xso, skb);
 	if (ret)
 		goto out;
-	if (x->security)
-		ret = copy_sec_ctx(x->security, skb);
 	if (x->props.output_mark) {
 		ret = nla_put_u32(skb, XFRMA_OUTPUT_MARK, x->props.output_mark);
 		if (ret)
 			goto out;
 	}
+	if (x->security)
+		ret = copy_sec_ctx(x->security, skb);
 out:
 	return ret;
 }
Signature · 1 line
2.7.4
maintainer
#3 lore raw
In reply to Steffen Klassert

From: Steffen Klassert <[email protected]>
Date: Fri, 1 Sep 2017 09:30:44 +0200

Quoted 9 lines

This should be the last ipsec-next pull request for this release cycle:

1) Support netdevice ESP trailer removal when decryption is offloaded. From Yossi Kuperman.

2) Fix overwritten return value of copy_sec_ctx().

Please pull or let me know if there are problems.

Pulled, thanks Steffen.