Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats

2016-03-02 Thread Ben Hutchings
On Wed, 2016-03-02 at 01:11 +, Keller, Jacob E wrote: > On Wed, 2016-03-02 at 00:12 +, Ben Hutchings wrote: > > NAK, ethtool is not the only consumer of the ethtool API.  How many > > times do I have to repeat myself? > > > > Ben. > > > > Ok, so essentially forcing drivers to require sta

Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats

2016-03-01 Thread Keller, Jacob E
On Tue, 2016-03-01 at 15:05 -0800, Alexander Duyck wrote: > On Tue, Mar 1, 2016 at 2:58 PM, Keller, Jacob E > 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 eac

Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats

2016-03-01 Thread Keller, Jacob E
On Wed, 2016-03-02 at 00:12 +, Ben Hutchings wrote: > NAK, ethtool is not the only consumer of the ethtool API.  How many > times do I have to repeat myself? > > Ben. > Ok, so essentially forcing drivers to require static sets for the various stats/strings/etc? :( Will have patches to clea

Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats

2016-03-01 Thread Ben Hutchings
On Tue, 2016-03-01 at 14:25 -0800, Jacob Keller wrote: > Since at least 2005, (oldest commit in ethtool.git), the userspace > ethtool implementation has given the size of the memory it has allocated > as the actual size in the ethtool data structures. We previously blindly > ignore this and overwri

Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats

2016-03-01 Thread Alexander Duyck
On Tue, Mar 1, 2016 at 2:58 PM, Keller, Jacob E 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

Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats

2016-03-01 Thread Keller, Jacob E
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...

Re: [PATCH v2] ethtool: check size of user memory before copying strings and stats

2016-03-01 Thread Alexander Duyck
On Tue, Mar 1, 2016 at 2:25 PM, Jacob Keller wrote: > Since at least 2005, (oldest commit in ethtool.git), the userspace > ethtool implementation has given the size of the memory it has allocated > as the actual size in the ethtool data structures. We previously blindly > ignore this and overwrite