netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Keller, Jacob E" <jacob.e.keller@intel.com>
To: "alexander.duyck@gmail.com" <alexander.duyck@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"bhutchings@solarflare.com" <bhutchings@solarflare.com>,
	"jeff@garzik.org" <jeff@garzik.org>,
	"Rustad, Mark D" <mark.d.rustad@intel.com>,
	"mirq-linux@rere.qmqm.pl" <mirq-linux@rere.qmqm.pl>
Subject: Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats
Date: Tue, 1 Mar 2016 23:47:25 +0000	[thread overview]
Message-ID: <1456876045.9520.23.camel@intel.com> (raw)
In-Reply-To: <CAKgT0Uf6vFZ++E-8=dW=dO9Ohq4VGwc-DymyX_jA5VShMrS5Vw@mail.gmail.com>

On Tue, 2016-03-01 at 15:05 -0800, Alexander Duyck wrote:
> On Tue, Mar 1, 2016 at 2:58 PM, Keller, Jacob E
> <jacob.e.keller@intel.com> wrote:
> > 
> > On Tue, 2016-03-01 at 14:31 -0800, Alexander Duyck wrote:
> > > 
> > > This still has the potential to provide garbage data.  What you
> > > should
> > > probably do at each stage is make sure the length matches with
> > > the
> > > exact value that you would expect.
> > > 
> > Sure, an exact check could be done instead, however...
> > 
> > > 
> > > I assume you cannot have any fields shuffle on you?  What I mean
> > > by
> > > that is that you don't want to have a setup with 4 Tx and 4 Rx
> > > rings
> > > where you then replace it with 1 Tx and 7 Rx rings and try to
> > > populate
> > > the same data into a setup where the strings reported are for 4
> > > Tx
> > > and
> > > 4 Rx.  You should double check that the length can be used as a
> > > means
> > > of identifying exactly what strings will be where.
> > > 
> > > - Alex
> > 
> > Darn. Looks like you're right. It would be theoretically possible
> > for
> > the number of queues (or other variables) to change such that the
> > size
> > matches but the data no longer lines up against the strings.
> > 
> > For queues, I don't think we're vulnerable on the fm10k driver,
> > because
> > we only use combined queues. However, we already have support for
> > "debug-statistics" which shows extra stats plus some stats per
> > virtual
> > function. I am not sure if these could change within the time
> > window to
> > result in garbage data.
> > 
> > I don't know how much of a real world problem this would be though.
> > 
> > I'm guessing it's more reason to promote the idea of converting to
> > some
> > new tool based on netlink.
> Yeah, we had basically pushed the issue under the rug by using a
> static layout for statistics.
> 

Yep.

> Was the motivation for getting rid of the static layout just to
> declutter the display?  I know I have gotten into the habit of just
> piping ethtool -S through a "| grep -v :\ 0" to drop any of the
> unused
> stats from the display.  Also you may see issues depending on how the
> stats might be parsed by user-space scripts if you start modifying
> what is displayed and what is not.
> 

Generally, I'm not too concerned about specific user-scripts parsing
since these already have to be heavily dependent on the driver in
question (since each driver has their own naming scheme).

I added a while back the private flag "debug-statistics" to enable a
bunch of extra statistics which weren't always relevant.

In some cases, like the queue size change it was done in order to
simply remove clutter of 128 queueus when many systems would only use a
few of those. Just doing grep -v :\ 0 will remove these lines, true.

However, that doesn't help the debug-statistics case, where we have a
ton of statistics which may be relevant to some debugging, but aren't
really useful to see all the time. In addition, it also shows stats for
VFs in this mode as well.

Thanks,
Jake

  reply	other threads:[~2016-03-01 23:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 22:25 [PATCH v2] ethtool: check size of user memory before copying strings and stats Jacob Keller
2016-03-01 22:31 ` Alexander Duyck
2016-03-01 22:58   ` Keller, Jacob E
2016-03-01 23:05     ` Alexander Duyck
2016-03-01 23:47       ` Keller, Jacob E [this message]
2016-03-02  0:12 ` Ben Hutchings
2016-03-02  1:11   ` Keller, Jacob E
2016-03-02 10:48     ` Ben Hutchings

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=1456876045.9520.23.camel@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=alexander.duyck@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=jeff@garzik.org \
    --cc=mark.d.rustad@intel.com \
    --cc=mirq-linux@rere.qmqm.pl \
    --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;
as well as URLs for NNTP newsgroup(s).