Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1914742ybl; Tue, 3 Dec 2019 14:57:33 -0800 (PST) X-Google-Smtp-Source: APXvYqz4oPvh/UsH0fQprfFhYWouT+ArDD8BCIAyR4JUlGuhxsXNfl4wO0PWIx3p6lnPZFV7bnFg X-Received: by 2002:aca:c507:: with SMTP id v7mr8240oif.157.1575413853021; Tue, 03 Dec 2019 14:57:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575413853; cv=none; d=google.com; s=arc-20160816; b=rDrdZ2o6miuSiaQQOuwyPHPBFOXzxFr6idSgclhW3yohmohQmnxy6S0+K00AVrMu+9 4tt4I/osF6wDYXCxsEeGISGnsgOv/4hHaHvOAcg3YoWRHl2B8yJ/RpRhnRKXIdntPqU2 d8Vz/fmhbDcmkOk2zjwQp7G2gNjUem8vjMBrrRCh+6whVAgl2GJSP2m8F3q5RG+lG/Qw cmuCb55ulZDqmyqp2f1smivKEyHcQkyCwoAKOclvxRjDzMTklqUVC6SrUllh9UfGh0uj OYZxONcph7nQJpspdF/m6p9x48alvIHeTjR8265TkyyRetJAbNaQkTFb3QbbrIjM1LDt jLqA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=Cr74USMS7o2KnmyixbloqBJA2JGrzMyz1VPBNGaTjTU=; b=gv3lmjCdioqdQfQg+mevXJ6uSmIjGMkZsq6/t2zgbtaHmznwl6uUX3v3JFZeSvyWO4 vTJJKJOxIu/5Bk7pAGai4sB9jN7fHtvt5VZ/57vDldrtlK2RXy/PWaduv7PPR3g0NU1d RVN+ebwnWTj8KUe85uLkp66OIly3migBH2WDj50zpaXsj6mkfNuVnKWKjsTtYw6EL3KS 73/Q1MEjsGCekZZcNplYdUY627czm2+rTNkOez9PEivfcyr20Hhn/7cDoia9hVSiUer+ GofnCqJUZmS08GidIqDxXvv+Io1F5qA9YKD8Xa7wGWv/5lKW8c8H6Dna/B0drBQumVMG qBxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b="pUTeoB/B"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z18si2090666otq.121.2019.12.03.14.57.21; Tue, 03 Dec 2019 14:57:33 -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=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b="pUTeoB/B"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730389AbfLCWz5 (ORCPT + 99 others); Tue, 3 Dec 2019 17:55:57 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41670 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730384AbfLCWz4 (ORCPT ); Tue, 3 Dec 2019 17:55:56 -0500 Received: by mail-lj1-f195.google.com with SMTP id h23so5721747ljc.8 for ; Tue, 03 Dec 2019 14:55:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=Cr74USMS7o2KnmyixbloqBJA2JGrzMyz1VPBNGaTjTU=; b=pUTeoB/B/c7n3sIbM6o9Y00LsAXCHxNwVMJsa5upgXV/7QLVLHgYcPEKzWZ766NjXa 314xWdi15XbJovZ/FUWSw6LpC7GnkQNQoiJRjh5YkZ7bJrg1Gw38Ysbf5Sho5KU/Z3xx y+V5eeKP/jqO92i8+wC22UvLXbMbNZ4XncW05NyjNTXMYqy7aQMiRIR++55pL7H1Vwne IIpZWLD4l/XYwJ0qAg1FuOI7mFNe2o5wG7yVegvndufwPB4AdXa759iMmJOFdo1OWazz f4AuMBIwHpWm6y4h2vZzmI3aVgRqskwy/M7T/ebOHfDfaEuGEDniAaxF/R1jHY/KnAVA 1uuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=Cr74USMS7o2KnmyixbloqBJA2JGrzMyz1VPBNGaTjTU=; b=PnGiS+vpOY0FuZv7MdyvxHQmeJ7IXKCIu+8Cl9pjEpfLM7lOgvlaFnP+wS4NK6XUSd fWOaeuM1eC4hPfsHGPIuVC/RqmHuiSN+tqeoaKbmKBUQjehodLISDbU+6hxk63SZ73NZ NMVfb0S5UB7PAbKhbmAWP20uqaenJe6XwGkMMj43Bmx7J3l7xu5FAFogHPN4j1ILuWtd LkeRNWA9QXoG7Vm5hLd466tyjAZe1RU2UfQFjrKF0DgkzaT7O816Gv8TWRy7n6L4qKWG lD0l3kS0pwkjMd5uWRcPGwo9oUpmhO9nZlB8xBrQeZOPHJVcNoedIGz73KSUio39yG2N AOsA== X-Gm-Message-State: APjAAAUN2H1MvBgnZ9kxwDTE/ZAQ44V81LqVsq8E7Z4kexBPjMtOe0DV D/B2ldLuYVrixzdTsxqcSdx5ow== X-Received: by 2002:a2e:2c0a:: with SMTP id s10mr25415ljs.193.1575413754281; Tue, 03 Dec 2019 14:55:54 -0800 (PST) Received: from cakuba.netronome.com ([66.60.152.14]) by smtp.gmail.com with ESMTPSA id h14sm91779lfc.2.2019.12.03.14.55.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2019 14:55:54 -0800 (PST) Date: Tue, 3 Dec 2019 14:55:35 -0800 From: Jakub Kicinski To: Valentin Vidic Cc: Boris Pismenny , Aviad Yehezkel , John Fastabend , Daniel Borkmann , "David S. Miller" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/tls: Fix return values for setsockopt Message-ID: <20191203145535.5a416ef3@cakuba.netronome.com> In-Reply-To: <20191203224458.24338-1-vvidic@valentin-vidic.from.hr> References: <20191203224458.24338-1-vvidic@valentin-vidic.from.hr> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 3 Dec 2019 23:44:58 +0100, Valentin Vidic wrote: > ENOTSUPP is not available in userspace: > > setsockopt failed, 524, Unknown error 524 > > Signed-off-by: Valentin Vidic I'm not 100% clear on whether we can change the return codes after they had been exposed to user space for numerous releases.. But if we can - please fix the tools/testing/selftests/net/tls.c test as well, because it expects ENOTSUPP. > 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; > goto err_crypto_info; > } > > @@ -723,7 +723,7 @@ static int tls_init(struct sock *sk) > * share the ulp context. > */ > if (sk->sk_state != TCP_ESTABLISHED) > - return -ENOTSUPP; > + return -ENOTCONN; > > /* allocate tls context */ > write_lock_bh(&sk->sk_callback_lock);