Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1133634pxa; Wed, 5 Aug 2020 23:50:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwazdVjuGIXqLtj7Ru3g4jeFvDO0JDhcJeQOuYLGFAsmVcQW8RtT6LMmrbwaAJSsgdGbiNJ X-Received: by 2002:a50:fd16:: with SMTP id i22mr2646710eds.281.1596696655716; Wed, 05 Aug 2020 23:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596696655; cv=none; d=google.com; s=arc-20160816; b=KiwURNf1RKV0DU8MKCZDuWWzaOag1BPjTRSAe0WKXMCdpdGicBJXIJPXQu3IxJubEG oKGrAM0S3K290HqgU4NyTqir5JhQcZly8hV4axHeyPXOZnXN9Rszl95FbWYksPMYeCEa YpGQhzh7yxavXWGhjmylV5wEcBAS/xIm6z60Akczc26z8vjj2mtaSY7081t2IpqXUllp jhZCK+B/bYMIj8Kppvd1aOe/wm837C6Wla8v1YQsD2HThwNvw1Y4vlv5sE5Dr10UrR9y Z847+KN0ZnBoQrp5kWwhwqpRDIVS9QVN1goLc6VB/yFqFAcDTBruxTFyzvO5FFxO5G80 MZdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=jMdVmYwGXiIYLvWOLqIoFFo26s0zsQrJkTXS75n/DlY=; b=PAP/lj5guIfT7X5PK4Y0nL9wTQLrrZQnY5UC/A5b8y37vFEfdCdhMAblXkfZTgE8NT OMQ6qK+li6J6l+LAIq7o1vqwfN/UrZ4AHPUS+w6A8s9iuz0rmh+HIAb1takA36eR7LDt HI/MOgAgToHf3U2WywJ9vQJUkUWzdMy/ZoBY3Lc8UDVChXcqdg0tZGCGDlX9a4qDcBIV ylB9jrrmBTkEzm3D1WfQGfVJRzkVjMNxbz5t/JcyqOQpNdkNSICkEnnR7Y098ys9Pdva 4PTrRSVnFDWBDM4PKxH4mPyzNb2Ozac9fnXpl6IGlrKMpFqIzxexzoZ1LmYA0O7lJZky ohRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l21si2718303ejx.722.2020.08.05.23.50.32; Wed, 05 Aug 2020 23:50:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728328AbgHFGuY (ORCPT + 99 others); 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) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on magratgarlick.emantor.de X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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