From patchwork Thu Aug 6 06:49:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rouven Czerwinski X-Patchwork-Id: 262691 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2070C38142 for ; Thu, 6 Aug 2020 11:04:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D2D1522CE3 for ; Thu, 6 Aug 2020 11:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728339AbgHFGuY (ORCPT ); Thu, 6 Aug 2020 02:50:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727800AbgHFGuX (ORCPT ); Thu, 6 Aug 2020 02:50:23 -0400 Received: from magratgarlick.emantor.de (magratgarlick.emantor.de [IPv6:2a01:4f8:c17:c88::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E14C8C061574; Wed, 5 Aug 2020 23:50:22 -0700 (PDT) Received: by magratgarlick.emantor.de (Postfix, from userid 114) id D7DC510C96B; Thu, 6 Aug 2020 08:50:14 +0200 (CEST) Received: from localhost (200116b82871d502e89ff5a9718d1cab.dip.versatel-1u1.de [IPv6:2001:16b8:2871:d502:e89f:f5a9:718d:1cab]) by magratgarlick.emantor.de (Postfix) with ESMTPSA id 84D9410C5FB; Thu, 6 Aug 2020 08:50:11 +0200 (CEST) From: Rouven Czerwinski To: Boris Pismenny , Aviad Yehezkel , John Fastabend , Daniel Borkmann , Jakub Kicinski , "David S. Miller" Cc: kernel@pengutronix.de, Rouven Czerwinski , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next] net/tls: allow MSG_CMSG_COMPAT in sendmsg Date: Thu, 6 Aug 2020 08:49:06 +0200 Message-Id: <20200806064906.14421-1-r.czerwinski@pengutronix.de> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- net/tls/tls_sw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) base-commit: c1055b76ad00aed0e8b79417080f212d736246b6 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);