From: Vlad Yasevich <vyasevic@redhat.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] rtnetlink: Mask the rta_type when range checking
Date: Thu, 14 Mar 2013 20:30:46 -0400 [thread overview]
Message-ID: <51426BB6.5030204@redhat.com> (raw)
In-Reply-To: <20130314212821.GC25591@casper.infradead.org>
On 03/14/2013 05:28 PM, Thomas Graf wrote:
> On 03/14/13 at 01:40pm, Vlad Yasevich wrote:
>> So let me rebuff this a bit more intelligently.
>>
>> 1) NLA_F_NESTED is used by netfilter in a lot of places. It seems that
>> only rtnetlink interface doesn't account for it.
>
> Stephen is not wrong, strictly speaking this is an ABI breaker.
>
> However, we have been applying NLA_TYPE_MASK in nla_type() and
> thus in nla_parse(), nlmsg_find_attr(), etc. since the
> introduction of the current kernel netlink API.
>
> static inline int nla_type(const struct nlattr *nla)
> {
> return nla->nla_type & NLA_TYPE_MASK;
> }
>
> I have been attempting to get rid of that ugly attribute parsing
> code in rtnetlink_rcv_msg() but it's hard to get rid of. I shall
> give this another try.
>
>> 2) The following commit:
>>
>> commit 25c71c75ac87508528db053b818944f3650dd7a6
>> Author: stephen hemminger <shemminger@vyatta.com>
>> Date: Tue Nov 13 07:53:05 2012 +0000
>>
>> bridge: bridge port parameters over netlink
>>
>> introduced NLA_F_NESTED usage in rtnetlink for both setlink and
>> getlink, so one could argue that was an ABI change.
>
> You are right, user space applications that do not apply
> NLA_TYPE_MASK will no longer see the IFLA_PROTINFO attribute
> with the above commit.
>
>> prove that without the change I am introducing, one can not use the
>> above mentioned bridge API. Feel free to try it with iproute2
>> patches
>> I sent earlier ([PATCH iproute2 0/2] Add support for bridge port
>> link information).
>
> I am not against your patch but I would love to see the affected
> code paths to no longer rely on the attribute array provided by
> the rtnetlink doit function but instead call nla_parse() themselves
> for the sake of proper validation.
>
Doing a quick check on all the callers for rtnl_register and their
handlers the following do not use nla_parse:
1) dn_fib_rtm_newroute/delroute - Don't seem to care about attribute
types.
2) dn_cache_getroute() - suspect use. relies on rta_buf populated by
rtnetlink_rcv_msg
3) inet_rtm_newroute/delroute - rtm_to_fib_config() uses a custom loop
with nla_type(), so safe.
That's all that a quick look finds. Out of all of them, looks like on
dn_cache_getroute() would be broken.
-vlad
next prev parent reply other threads:[~2013-03-15 0:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 14:18 [PATCH] rtnetlink: Mask the rta_type when range checking Vlad Yasevich
2013-03-13 15:36 ` Stephen Hemminger
2013-03-13 15:41 ` Vlad Yasevich
2013-03-14 17:40 ` Vlad Yasevich
2013-03-14 21:28 ` Thomas Graf
2013-03-15 0:30 ` Vlad Yasevich [this message]
2013-03-15 8:51 ` Thomas Graf
2013-03-17 15:44 ` David Miller
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=51426BB6.5030204@redhat.com \
--to=vyasevic@redhat.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=tgraf@suug.ch \
/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).