[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1298938233.2569.30.camel@bwh-desktop>
Date: Tue, 01 Mar 2011 00:10:33 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Kees Cook <kees.cook@...onical.com>
Cc: David Miller <davem@...emloft.net>,
Alexander Duyck <alexander.h.duyck@...el.com>,
Santwona Behera <santwona.behera@....com>,
netdev@...r.kernel.org
Subject: Re: [PATCHv2 net-next-2.6] ethtool: Compat handling for struct
ethtool_rxnfc
On Mon, 2011-02-28 at 15:51 -0800, Kees Cook wrote:
> Hi Ben,
>
> On Mon, Feb 28, 2011 at 09:55:41PM +0000, Ben Hutchings wrote:
> > I'm not sure whether more checks on rule_cnt are required for security
> > or whether compat_alloc_user_space() and copy_in_user() can be relied on
> > to limit any buffer overrun to the user process's own memory. It looks
> > like this is safe on x86.
>
> I'm less familiar with the compat world, but it looks sane to me. All the
> copy_in_user() calls are calculated based on structure sizes, right? Except
> for the rule_cnt one, which was already bounds-checked for output.
[...]
No, because the native ioctl implementation writes out the actual number
of rules to rxnfc->rule_cnt and we then read that back into rule_cnt
before performing the copy from rxnfc->rule_locs to
compat_rxnfc->rule_locs. So userland can race with us and modify that
value.
We could use the original value of rule_cnt to calculate the size to
copy; it would just mean copying more than we need to most of the time.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists