Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2107029ybl; Thu, 5 Dec 2019 12:08:24 -0800 (PST) X-Google-Smtp-Source: APXvYqweRWdAb7yS8mPa4ehL4EkAno+fHoigHSfyVGRmg89ZvGh505vQGn5kZWEmYGcROUI8nAB7 X-Received: by 2002:a9d:6084:: with SMTP id m4mr8573187otj.4.1575576504886; Thu, 05 Dec 2019 12:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575576504; cv=none; d=google.com; s=arc-20160816; b=VR0EeyG3jHICsPjodlYGt9mSFfGj8f2rdA9RHZKpwKhSnkkuG2af7DZFHK2/RJIn5m FXpdPku2IasJqsmZLJY5HGK3bmnZP4JsZluSyOEEChCTVydh3DS1uR0tV7cFt+C7gFL/ fFN4UsDy1Eew1rkabaN1YfMzVSqQvbnhNTf1WdHfbKEWr/1GOxgZ7db0ZYeWAraqg9A3 RKBM4wAEInm+gz3uWspLmyvz4TktOqCiiicUX8ejVYkBiS5EFvbafW2p3xRogFZQbQFl jfUw+qli89NnVXb2KnuxUZ9qpg35CgIYN49p5Su4igFLpH9E5U/hte7TzBpcuGpFkD1Q Uzxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=m1aI+cWn+pN+koI1rkc/tO0Oxhn3zWCujvYJiTDdw/U=; b=EqvY7jAQruAwGDphFi7ruHFqOMVBXEM5vZL2e88SbVkiz7KAWZ1fnTT04x1bUnxc3F WV3LNwN7+gbuH0ehDW3fKbMYBgDhIqAuNedUGZz/D8sJbGsSPTwBmG5cPBbYjjLau1Gw BBKafXQIR8/I92WsQ859cEcBEPWkiR7IDd9H3nLS+93lWXUIV3sbNJG/IEXkfOnkGByz rmRLx5FLKtDV54xynzk8N0vEaHhrB8mCTz9aEaJQ0ZLpeeAjAnT5iZNx6AhshEraZyi9 7n06nsGf0zON/WfctkVJtJPyp1wTunHbHUpJvf47pqxYmgeTEreejejOicZ6mASVxn8F hTyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PmZHoUoc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 59si5157023oto.290.2019.12.05.12.08.11; Thu, 05 Dec 2019 12:08:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PmZHoUoc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729430AbfLEUHg (ORCPT + 99 others); Thu, 5 Dec 2019 15:07:36 -0500 Received: from mail-yb1-f194.google.com ([209.85.219.194]:36667 "EHLO mail-yb1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729145AbfLEUHg (ORCPT ); Thu, 5 Dec 2019 15:07:36 -0500 Received: by mail-yb1-f194.google.com with SMTP id v2so2010718ybo.3 for ; Thu, 05 Dec 2019 12:07:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m1aI+cWn+pN+koI1rkc/tO0Oxhn3zWCujvYJiTDdw/U=; b=PmZHoUoc56jE+kMHXtSTDMLYKfmvaZbnf0wOkHA1zKpJEJIt1hDzJVNdQxS0YvopSB hpCZOER0sF/J1ONzolUPdg5WUkrvaWQHevLV2e0q8QlDtcGJgvCaFWfz2m8j5Oo7Xk8A 3UTP5Db8KsGSJbOOzUE8cDeLmyk7i1LSbDxqoP7Ut2+Q1wiggZCISGCy2UtLAd2tsnFf /KUuPENslh6DuxthrE+T2nDhZsK78ZuqiZgAKTb1tNDziUYiixjhp+RIvOTJ20ggSD1i D9DRyb2XP0pGvT9A9UW9UwjJkRqukJcZvpjDJoVK5XJg6e0jFWqlwf19GWOYQ7q+vUSh M+eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m1aI+cWn+pN+koI1rkc/tO0Oxhn3zWCujvYJiTDdw/U=; b=TxwMsd8CJDeDHSicJ2N/JZijntLxInJVoHuQQ3J9t9ykBxuDab7LYM5W0YSHiqccyg SlKfYvzBSnZouaGKyxKmXFIV+YxxuQVjUULoxUtuP4vWVGUdrxI+lxi8FKQLZn9fGq8N ngvhe1jV7QqLZeM22jAhPrQdUklZ5SkFOyTlCAN8Xq1skpmGlsra48q+6riHjYOQGkuv dYWj0+v1AFucwtvHRN+bxJPgfBueGab9CxToW6OHYajuFW4zmnVFEr5/Cjo34THMd7Dm CipXyvRa7rQ2RZzIrKWeUOXrfDKGQ2IlQzN94cep8gQ4DokdyTCVyA/9xjd/qUGjmVd/ ye1A== X-Gm-Message-State: APjAAAW3atTdSBZaeUGSamAsh5QbRd21duhrpuN4cc2JUvUlBc9EpJVl lpRRdi9aesSYwqNBvOzg83fRMNeW X-Received: by 2002:a25:c791:: with SMTP id w139mr6594941ybe.300.1575576454577; Thu, 05 Dec 2019 12:07:34 -0800 (PST) Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com. [209.85.219.173]) by smtp.gmail.com with ESMTPSA id v19sm5130094ywh.60.2019.12.05.12.07.32 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Dec 2019 12:07:33 -0800 (PST) Received: by mail-yb1-f173.google.com with SMTP id h23so2016956ybg.2 for ; Thu, 05 Dec 2019 12:07:32 -0800 (PST) X-Received: by 2002:a25:bc0a:: with SMTP id i10mr7880662ybh.83.1575576452064; Thu, 05 Dec 2019 12:07:32 -0800 (PST) MIME-Version: 1.0 References: <20191204.165528.1483577978366613524.davem@davemloft.net> <20191205064118.8299-1-vvidic@valentin-vidic.from.hr> <20191205113411.5e672807@cakuba.netronome.com> In-Reply-To: <20191205113411.5e672807@cakuba.netronome.com> From: Willem de Bruijn Date: Thu, 5 Dec 2019 15:06:55 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] net/tls: Fix return values to avoid ENOTSUPP To: Jakub Kicinski Cc: Valentin Vidic , Willem de Bruijn , Boris Pismenny , Aviad Yehezkel , John Fastabend , Daniel Borkmann , "David S. Miller" , Network Development , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 5, 2019 at 2:34 PM Jakub Kicinski wrote: > > On Thu, 5 Dec 2019 07:41:18 +0100, Valentin Vidic wrote: > > ENOTSUPP is not available in userspace, for example: > > > > setsockopt failed, 524, Unknown error 524 > > > > Signed-off-by: Valentin Vidic > > > diff --git a/net/tls/tls_device.c b/net/tls/tls_device.c > > index 0683788bbef0..cd91ad812291 100644 > > --- a/net/tls/tls_device.c > > +++ b/net/tls/tls_device.c > > @@ -429,7 +429,7 @@ static int tls_push_data(struct sock *sk, > > > > if (flags & > > ~(MSG_MORE | MSG_DONTWAIT | MSG_NOSIGNAL | MSG_SENDPAGE_NOTLAST)) > > - return -ENOTSUPP; > > + return -EOPNOTSUPP; > > > > if (unlikely(sk->sk_err)) > > return -sk->sk_err; > > @@ -571,7 +571,7 @@ int tls_device_sendpage(struct sock *sk, struct page *page, > > lock_sock(sk); > > > > if (flags & MSG_OOB) { > > - rc = -ENOTSUPP; > > + rc = -EOPNOTSUPP; > > Perhaps the flag checks should return EINVAL? Willem any opinions? No strong opinion. Judging from do_tcp_sendpages MSG_OOB is a supported flag in general for sendpage, so signaling that the TLS variant cannot support that otherwise valid request sounds fine to me. > > > goto out; > > } > > > > @@ -1023,7 +1023,7 @@ int tls_set_device_offload(struct sock *sk, struct tls_context *ctx) > > } > > > > if (!(netdev->features & NETIF_F_HW_TLS_TX)) { > > - rc = -ENOTSUPP; > > + rc = -EOPNOTSUPP; > > goto release_netdev; > > } > > > > @@ -1098,7 +1098,7 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx) > > } > > > > if (!(netdev->features & NETIF_F_HW_TLS_RX)) { > > - rc = -ENOTSUPP; > > + rc = -EOPNOTSUPP; > > goto release_netdev; > > } > > > > diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c > > index bdca31ffe6da..5830b8e02a36 100644 > > --- a/net/tls/tls_main.c > > +++ b/net/tls/tls_main.c > > @@ -496,7 +496,7 @@ static int do_tls_setsockopt_conf(struct sock *sk, char __user *optval, > > /* check version */ > > if (crypto_info->version != TLS_1_2_VERSION && > > crypto_info->version != TLS_1_3_VERSION) { > > - rc = -ENOTSUPP; > > + rc = -EINVAL; > > This one I think Willem asked to be EOPNOTSUPP OTOH. Indeed (assuming no one disagrees). Based on the same rationale: the request may be valid, it just cannot be accommodated (yet).