Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp4073991pxm; Tue, 1 Mar 2022 10:40:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRTZhqnFt1eLqr1Bc9T/EwD9hdkRkv/tbUOgmk90UvModvKWmo9zF/Ta+ms8j1ealh5q2+ X-Received: by 2002:a17:906:b887:b0:6ce:36cb:1e18 with SMTP id hb7-20020a170906b88700b006ce36cb1e18mr20291669ejb.95.1646160051707; Tue, 01 Mar 2022 10:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646160051; cv=none; d=google.com; s=arc-20160816; b=d7D9+Lf8iwWH/dty6pcmVnlY6bvaPVm1WNaMWZpGNkm9XvU/jpCDBxH538mkviKti+ QWkIQfOaq5+gdAA4RHiNNahp519vrY1wHPkS13vsqlnSfgk6WhI4t7L7YVJFjuOwypYy wt6RwapgThkydnrCnvTxFr3wAKcIBwLAutuNDpEp1wHJXoctnmpyVgnYM7A37/IPTVQL RsK4za22SYQnqJ6dDQn43LXgQ/1YT4C54N4Uoe1g9yoqApAxVk6cT+EQdYh7qF+AZdPM kzsKOUIRtFTQvvp5AMlPbEFzxIvXcMA60Cazf7aJdhN44yJz/B9Xa9sfb/GvuzWOTBVs h6wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:organization:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=hN/km4bq37RemKTxxsk14oeEHa6x3GtXqWi8EY3o/uw=; b=fsLwNxD+jqvo7ibFLlVuLhP23RIkSSla+GwsE7fqG6r2+7y/q14KJDzD2P+ufpf7Qw tr/BTV34tgp+GdrSE58zKaAPnrAHRWQ5yrT0NzLYJFEniYyR9Aghhh6E/omIXI4u/pxc Xk/XYuGtVjglUMxLVBjeCj+3uidiYUSQTycf6yGoD5ZUhkGPHXq7ILQEmN0geR3Mwl9H 1+RDCHPAUb47fMYLAw2NBaqralz09Dzw7u0WQf+YMvYjQroj6uQbdia+E5K8JBFJASVs cRks6n5NDqAAcVuIT5PuM4YxLFFrOtrMnLUxc5JfEZfJqGSB6JRphAENgYIa/JDDT3u8 lOYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=labri.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a05640203ce00b004109fbe1d1asi8567123edw.462.2022.03.01.10.40.28; Tue, 01 Mar 2022 10:40:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=labri.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235646AbiCAPVB (ORCPT + 99 others); Tue, 1 Mar 2022 10:21:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234154AbiCAPVA (ORCPT ); Tue, 1 Mar 2022 10:21:00 -0500 Received: from v-zimmta03.u-bordeaux.fr (v-zimmta03.u-bordeaux.fr [147.210.215.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D10C4B861; Tue, 1 Mar 2022 07:20:19 -0800 (PST) Received: from v-zimmta03.u-bordeaux.fr (localhost [127.0.0.1]) by v-zimmta03.u-bordeaux.fr (Postfix) with ESMTP id F0A661800A8C; Tue, 1 Mar 2022 16:20:17 +0100 (CET) Received: from begin (nat-inria-interne-54-gw-02-bso.bordeaux.inria.fr [194.199.1.54]) by v-zimmta03.u-bordeaux.fr (Postfix) with ESMTPSA id A0EDE1800A82; Tue, 1 Mar 2022 16:20:17 +0100 (CET) Received: from samy by begin with local (Exim 4.95) (envelope-from ) id 1nP4IT-00BrCg-Dm; Tue, 01 Mar 2022 16:20:17 +0100 Date: Tue, 1 Mar 2022 16:20:17 +0100 From: Samuel Thibault To: Willem de Bruijn Cc: willemb@google.com, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, Network Development Subject: Re: [PATCH] SO_ZEROCOPY should rather return -ENOPROTOOPT Message-ID: <20220301152017.jkx7amcbfqkoojin@begin> Mail-Followup-To: Samuel Thibault , Willem de Bruijn , willemb@google.com, davem@davemloft.net, kuba@kernel.org, linux-kernel@vger.kernel.org, Network Development References: <20220301144453.snstwdjy3kmpi4zf@begin> <20220301150028.romzjw2b4aczl7kf@begin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: I am not organized User-Agent: NeoMutt/20170609 (1.8.3) X-AV-Checked: ClamAV using ClamSMTP X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Willem de Bruijn, le mar. 01 mars 2022 10:14:18 -0500, a ecrit: > On Tue, Mar 1, 2022 at 10:00 AM Samuel Thibault > wrote: > > > > Willem de Bruijn, le mar. 01 mars 2022 09:51:45 -0500, a ecrit: > > > On Tue, Mar 1, 2022 at 9:44 AM Samuel Thibault wrote: > > > > > > > > ENOTSUPP is documented as "should never be seen by user programs", and > > > > is not exposed in , so applications cannot safely check against > > > > it. We should rather return the well-known -ENOPROTOOPT. > > > > > > > > Signed-off-by: Samuel Thibault > > > > > > > > diff --git a/net/core/sock.c b/net/core/sock.c > > > > index 4ff806d71921..6e5b84194d56 100644 > > > > --- a/net/core/sock.c > > > > +++ b/net/core/sock.c > > > > @@ -1377,9 +1377,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname, > > > > if (!(sk_is_tcp(sk) || > > > > (sk->sk_type == SOCK_DGRAM && > > > > sk->sk_protocol == IPPROTO_UDP))) > > > > - ret = -ENOTSUPP; > > > > + ret = -ENOPROTOOPT; > > > > } else if (sk->sk_family != PF_RDS) { > > > > - ret = -ENOTSUPP; > > > > + ret = -ENOPROTOOPT; > > > > } > > > > if (!ret) { > > > > if (val < 0 || val > 1) > > > > > > That should have been a public error code. Perhaps rather EOPNOTSUPP. > > > > > > The problem with a change now is that it will confuse existing > > > applications that check for -524 (ENOTSUPP). > > > > They were not supposed to hardcord -524... > > > > Actually, they already had to check against EOPNOTSUPP to support older > > kernels, so EOPNOTSUPP is not supposed to pose a problem. > > Which older kernels returned EOPNOTSUPP on SO_ZEROCOPY? Sorry, bad copy/paste, I meant ENOPROTOOPT. Samuel