From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Maxim Georgiev <glipus@gmail.com>,
kory.maincent@bootlin.com, netdev@vger.kernel.org,
maxime.chevallier@bootlin.com
Subject: Re: [PATCH net-next RFC] Add NDOs for hardware timestamp get/set
Date: Sat, 1 Apr 2023 19:08:29 +0300 [thread overview]
Message-ID: <20230401160829.7tbxnm5l3ke5ggvr@skbuf> (raw)
In-Reply-To: <20230330223519.36ce7d23@kernel.org>
On Thu, Mar 30, 2023 at 10:35:19PM -0700, Jakub Kicinski wrote:
> > case SIOCSHWTSTAMP:
> > err = net_hwtstamp_validate(ifr);
> > if (err)
> > return err;
> > - fallthrough;
> > + return dev_hwtstamp(dev, ifr, cmd);
>
> Let's refactor this differently, we need net_hwtstamp_validate()
> to run on the same in-kernel copy as we'll send down to the driver.
> If we copy_from_user() twice we may validate a different thing
> than the driver will end up seeing (ToCToU).
I'm not sure I understand this. Since net_hwtstamp_validate() already
contains a copy_from_user() call, don't we already call copy_to_user()
twice (the second time being in all SIOCSHWTSTAMP handlers from drivers)?
Perhaps I don't understand what is it that can change the contents
of the ifreq structure, which would make this a potential issue for
ndo_hwtstamp_set() that isn't an issue for ndo_eth_ioctl()...
next prev parent reply other threads:[~2023-04-01 16:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-31 4:56 [PATCH net-next RFC] Add NDOs for hardware timestamp get/set Maxim Georgiev
2023-03-31 5:35 ` Jakub Kicinski
2023-03-31 17:51 ` Max Georgiev
2023-03-31 18:10 ` Jakub Kicinski
2023-04-01 18:16 ` Vladimir Oltean
2023-04-01 19:12 ` Vladimir Oltean
2023-04-01 19:24 ` Jakub Kicinski
2023-04-01 19:30 ` Vladimir Oltean
2023-04-01 20:18 ` Vladimir Oltean
2023-04-02 14:28 ` Max Georgiev
2023-04-02 16:56 ` Vladimir Oltean
2023-04-01 16:08 ` Vladimir Oltean [this message]
2023-04-01 17:55 ` Jakub Kicinski
2023-04-01 18:20 ` Vladimir Oltean
2023-04-01 18:22 ` Vladimir Oltean
2023-04-01 19:14 ` Jakub Kicinski
2023-04-01 19:19 ` Vladimir Oltean
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=20230401160829.7tbxnm5l3ke5ggvr@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=glipus@gmail.com \
--cc=kory.maincent@bootlin.com \
--cc=kuba@kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
/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