Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3985605pxm; Tue, 1 Mar 2022 09:00:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJySz7Zhi+HaeATzzVESPAAm/3MZ+1IjtPz1HEmR8jxW4ONu4fJ3/rrkM3SMctJyLNv6tghw X-Received: by 2002:a05:6830:314c:b0:5af:dc8a:d066 with SMTP id c12-20020a056830314c00b005afdc8ad066mr10402481ots.28.1646154048058; Tue, 01 Mar 2022 09:00:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646154047; cv=none; d=google.com; s=arc-20160816; b=rz1su0xx5vTdlyagBz7qBROAgIaCQJxKRsRtKwtfuzt/Ox7XnMF0D2/p2ZafeLW5Js F1NOMEzAOr+DtRprHWODv0S0cOlL2OiPQqLzW/dZYJ7iD8ujTnfhf+e+JmEyiuZOJ7fg P7LbyMSoV1Oqb+k96k/87eC6b+QIj90UYXrUaTVPJAR4zFr+MJCJ6feWEXisI9lhpzgA 7aQfrccw0auYlKDtVFUXPU0FRB7tSg5pUYY68bGShFwmIxmicOUoBa5wsHRa3oracZv8 NAbGZmdhTWH6MS/e44AnTWDZGlR0HvDHuosZtyZjkTJk97Am73NhiF6d19n4l8zFeMJb UUtg== 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=M7BFmE/L2VokWD3eOKHAyJe2WU08gOJ2u4q9N0apjYc=; b=sk/KXhmMcWptnL1ClcE2fy+3DHCenNlXwKPW0xg2TAp7Z2/aDbYgqaAbPgw/Cz9mww VtW8kH5U8AR4hdDfsZeS8I6y1Gp7Kqdba3PPc1CZWbosYDycU7UDZPAVGKKrQKIPH3AD VtB8MNtsv3M4Lf4XcjLKbKfQobenJUoLK+Yr4Q0dRlZ2kYhHx6kgIRq3sRw24hw036Qi NsMzCC3o3KG55QaZfcRCIUMdxwvS1YBOK3yyBrPhJV5fugRDmz/CGps9LQJhjk/0YETy qGsW4zNmEeijGFzIsmoC+ELceY/SDTk+kjqsTFkWg3mO9XztvbVhxEt04tGwvusRtDAQ vSaw== 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 e22-20020a63db16000000b00378473f69d7si11398416pgg.428.2022.03.01.09.00.30; Tue, 01 Mar 2022 09:00:47 -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 S234737AbiCAPBQ (ORCPT + 99 others); Tue, 1 Mar 2022 10:01:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232934AbiCAPBO (ORCPT ); Tue, 1 Mar 2022 10:01:14 -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 2998A20F6E for ; Tue, 1 Mar 2022 07:00:30 -0800 (PST) Received: from v-zimmta03.u-bordeaux.fr (localhost [127.0.0.1]) by v-zimmta03.u-bordeaux.fr (Postfix) with ESMTP id 0844C1800A88; Tue, 1 Mar 2022 16:00:29 +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 AB9541800A86; Tue, 1 Mar 2022 16:00:28 +0100 (CET) Received: from samy by begin with local (Exim 4.95) (envelope-from ) id 1nP3zI-00BqZC-Fw; Tue, 01 Mar 2022 16:00:28 +0100 Date: Tue, 1 Mar 2022 16:00:28 +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: <20220301150028.romzjw2b4aczl7kf@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> 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 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. Samuel