From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Samuel Thibault <samuel.thibault@labri.fr>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
willemb@google.com, davem@davemloft.net, kuba@kernel.org,
linux-kernel@vger.kernel.org,
Network Development <netdev@vger.kernel.org>
Subject: Re: [PATCH] SO_ZEROCOPY should rather return -ENOPROTOOPT
Date: Tue, 1 Mar 2022 10:21:41 -0500 [thread overview]
Message-ID: <CA+FuTSfVBVr_q6p+HcBL4NAX4z2BS0ZNaSfFF0yxO3QqeNX75Q@mail.gmail.com> (raw)
In-Reply-To: <20220301152017.jkx7amcbfqkoojin@begin>
On Tue, Mar 1, 2022 at 10:20 AM Samuel Thibault
<samuel.thibault@labri.fr> wrote:
>
> 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
> > <samuel.thibault@labri.fr> 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 <samuel.thibault@labri.fr> wrote:
> > > > >
> > > > > ENOTSUPP is documented as "should never be seen by user programs", and
> > > > > is not exposed in <errno.h>, so applications cannot safely check against
> > > > > it. We should rather return the well-known -ENOPROTOOPT.
> > > > >
> > > > > Signed-off-by: Samuel Thibault <samuel.thibault@labri.fr>
> > > > >
> > > > > 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.
Same point though, right? These are not legacy concerns, but specific
to applications written to SO_ZEROCOPY.
I expect that most will just ignore the exact error code and will work
with either.
next prev parent reply other threads:[~2022-03-01 15:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 14:44 [PATCH] SO_ZEROCOPY should rather return -ENOPROTOOPT Samuel Thibault
2022-03-01 14:51 ` Willem de Bruijn
2022-03-01 15:00 ` Samuel Thibault
2022-03-01 15:14 ` Willem de Bruijn
2022-03-01 15:20 ` Samuel Thibault
2022-03-01 15:21 ` Willem de Bruijn [this message]
2022-03-01 15:25 ` Samuel Thibault
2022-03-06 19:22 ` Samuel Thibault
2022-03-07 16:03 ` Willem de Bruijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CA+FuTSfVBVr_q6p+HcBL4NAX4z2BS0ZNaSfFF0yxO3QqeNX75Q@mail.gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=samuel.thibault@labri.fr \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).