From: Leon Romanovsky <leon@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Arjun Roy <arjunroy.kdev@gmail.com>,
davem@davemloft.net, netdev@vger.kernel.org, arjunroy@google.com,
edumazet@google.com, soheil@google.com,
David Ahern <dsahern@gmail.com>
Subject: Re: [net-next v2] tcp: Explicitly mark reserved field in tcp_zerocopy_receive args.
Date: Tue, 9 Feb 2021 21:01:52 +0200 [thread overview]
Message-ID: <20210209190152.GD139298@unreal> (raw)
In-Reply-To: <20210209085938.579f3187@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On Tue, Feb 09, 2021 at 08:59:38AM -0800, Jakub Kicinski wrote:
> On Tue, 9 Feb 2021 08:15:11 +0200 Leon Romanovsky wrote:
> > At least in my tree, we have the length check:
> > 4155 if (len > sizeof(zc)) {
> > 4156 len = sizeof(zc);
> > 4157 if (put_user(len, optlen))
> > 4158 return -EFAULT;
> > 4159 }
> >
> >
> > Ad David wrote below, the "if (zc.reserved)" is enough.
> >
> > We have following options:
> > 1. Old kernel that have sizeof(sz) upto .reserved and old userspace
> > -> len <= sizeof(sz) - works correctly.
> > 2. Old kernel that have sizeof(sz) upto .reserved and new userspace that
> > sends larger struct -> "f (len > sizeof(zc))" will return -EFAULT
>
> Based on the code you quoted? I don't see how. Maybe I need a vacation.
> put_user() just copies len back to user space after truncation.
It is me who needs to go to vacation, you are right it doesn't return
for lengths larger than sizeof(zc).
>
> > 3. New kernel that have sizeof(sz) beyond reserved and old userspace
> > -> any new added field to struct sz should be checked and anyway it is the same as item 1.
> > 4. New kernel and new userspace
> > -> standard flow.
next prev parent reply other threads:[~2021-02-09 21:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-06 20:36 [net-next v2] tcp: Explicitly mark reserved field in tcp_zerocopy_receive args Arjun Roy
2021-02-06 23:28 ` Jakub Kicinski
2021-02-07 8:26 ` Leon Romanovsky
2021-02-08 18:41 ` Jakub Kicinski
2021-02-09 2:24 ` David Ahern
2021-02-09 2:53 ` Jakub Kicinski
2021-02-09 3:20 ` David Ahern
2021-02-09 6:29 ` Leon Romanovsky
2021-02-09 16:59 ` Jakub Kicinski
2021-02-09 23:46 ` Arjun Roy
2021-02-10 4:35 ` David Ahern
2021-02-10 19:23 ` Arjun Roy
2021-02-09 6:15 ` Leon Romanovsky
2021-02-09 16:59 ` Jakub Kicinski
2021-02-09 19:01 ` Leon Romanovsky [this message]
2021-02-07 17:49 ` David Ahern
2021-02-07 17:53 ` David Ahern
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=20210209190152.GD139298@unreal \
--to=leon@kernel.org \
--cc=arjunroy.kdev@gmail.com \
--cc=arjunroy@google.com \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=soheil@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).