All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Florian Westphal <fw@strlen.de>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next] mptcp: ignore unsupported msg flags
Date: Thu, 15 Apr 2021 11:44:19 +0200	[thread overview]
Message-ID: <20210415094419.GI14932@breakpoint.cc> (raw)
In-Reply-To: <bb30887a053765e34b6b7c0cf0db887b45397cd3.camel@redhat.com>

Paolo Abeni <pabeni@redhat.com> wrote:
> Looking at the code even MSG_DONTWAIT, MSG_EOR, MSG_MORE, MSG_OOB
> MSG_ZEROCOPY has some effect on TCP.

We handle DONTWAIT in mptcp, and the other ones, afaics, do not result
in a user-visible change (i.e., if we would not support DONTWAIT, we
would cause userspace do block in send() even if userspace specifically
asked for us not to, so that would be a bug).

But for the others I think ignoring is fine.

> MSG_ZEROCOPY needs to be enabled via setsockopt()
> 
> Currently we implement MSG_DONTWAIT, silently ignore MSG_MORE and we
> bail on MSG_OOB, MSG_EOR, MSG_ZEROCOPY
> 
> > > should we define a 'bail on use' mask with a subset of the above? The
> > > candidates I see are:
> >  
> > > MSG_TRUNC
> > > MSG_PEEK
> > > MSG_OOB
> > 
> > Looks like we only need to handle FASTOPEN.
> 
> LGTM, for sendmsg() sake: ignoring MSG_OOB and MSG_EOR does not look
> too evil to me ;)

Agree.

> Than there is recvmsg()...
> 
> With a quick code inspections looks like TCP support:
> MSG_PEEK, MSG_TRUNC, MSG_OOB, MSG_WAITALL, MSG_DONTWAIT, MSG_DONTWAIT, 
> MSG_ERRQUEUE
> 
> MSG_ERRQUEUE requires to be enabled via IP_RECVERR()
> 
> We currently implement MSG_WAITALL and MSG_DONTWAIT, soon MSG_PEEK and
> we bail on all the others.
> 
> Ignoring MSG_ERRQUEUE or MSG_TRUNC may silently break user-space
> application.

Indeed.

> I think we could provide a dummy impl for MSG_ERRQUEUE: always
> returning empty msg, which will be consistent with the lack of
> setsockopt support. We could even call into inet_recv_error(), as the
> relevant queue will always be empty, and could possibly simplify a
> complete implementation someday.
> 
> I also think we should bail on MSG_TRUNC, and silently ignore all the
> others.
> 
> WDYT?

Sounds good.  MSG_TRUNC support should be easy to add as well.

      reply	other threads:[~2021-04-15  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 15:23 [PATCH mptcp-next] mptcp: ignore unsupported msg flags Paolo Abeni
2021-04-14 15:51 ` Florian Westphal
2021-04-14 16:07   ` Paolo Abeni
2021-04-15  8:27     ` Florian Westphal
2021-04-15  9:33       ` Paolo Abeni
2021-04-15  9:44         ` Florian Westphal [this message]

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=20210415094419.GI14932@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=mptcp@lists.linux.dev \
    --cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.