linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] net/tls: allow MSG_CMSG_COMPAT in sendmsg
@ 2020-08-06  6:49 Rouven Czerwinski
  2020-08-06 18:46 ` Jakub Kicinski
  2020-08-08  0:41 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Rouven Czerwinski @ 2020-08-06  6:49 UTC (permalink / raw)
  To: Boris Pismenny, Aviad Yehezkel, John Fastabend, Daniel Borkmann,
	Jakub Kicinski, David S. Miller
  Cc: kernel, Rouven Czerwinski, netdev, linux-kernel

Trying to use ktls on a system with 32-bit userspace and 64-bit kernel
results in a EOPNOTSUPP message during sendmsg:

  setsockopt(3, SOL_TLS, TLS_TX, …, 40) = 0
  sendmsg(3, …, msg_flags=0}, 0) = -1 EOPNOTSUPP (Operation not supported)

The tls_sw implementation does strict flag checking and does not allow
the MSG_CMSG_COMPAT flag, which is set if the message comes in through
the compat syscall.

This patch adds MSG_CMSG_COMPAT to the flag check to allow the usage of
the TLS SW implementation on systems using the compat syscall path.

Note that the same check is present in the sendmsg path for the TLS
device implementation, however the flag hasn't been added there for lack
of testing hardware.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 net/tls/tls_sw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c
index 24f64bc0de18..a332ae123bda 100644
--- a/net/tls/tls_sw.c
+++ b/net/tls/tls_sw.c
@@ -935,7 +935,8 @@ int tls_sw_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
 	int ret = 0;
 	int pending;
 
-	if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL))
+	if (msg->msg_flags & ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL |
+			       MSG_CMSG_COMPAT))
 		return -EOPNOTSUPP;
 
 	mutex_lock(&tls_ctx->tx_lock);

base-commit: c1055b76ad00aed0e8b79417080f212d736246b6
-- 
2.27.0


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

end of thread, other threads:[~2020-08-08  0:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06  6:49 [PATCH v2 net-next] net/tls: allow MSG_CMSG_COMPAT in sendmsg Rouven Czerwinski
2020-08-06 18:46 ` Jakub Kicinski
2020-08-07  8:26   ` Rouven Czerwinski
2020-08-07 12:27     ` Rouven Czerwinski
2020-08-07 18:04       ` Jakub Kicinski
2020-08-08  0:41 ` David Miller

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).