netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Shearman <rshearma@brocade.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	Roopa Prabhu <roopa@cumulusnetworks.com>,
	Tom Herbert <tom@herbertland.com>, Thomas Graf <tgraf@suug.ch>,
	Jiri Benc <jbenc@redhat.com>
Subject: Re: [PATCH net-next 1/3] lwtunnel: autoload of lwt modules
Date: Tue, 16 Feb 2016 14:14:59 +0000	[thread overview]
Message-ID: <56C32EE3.6090802@brocade.com> (raw)
In-Reply-To: <878u2l7j6p.fsf@x220.int.ebiederm.org>

On 15/02/16 21:33, Eric W. Biederman wrote:
> Robert Shearman <rshearma@brocade.com> writes:
>> @@ -85,6 +109,14 @@ int lwtunnel_build_state(struct net_device *dev, u16 encap_type,
>>   	ret = -EOPNOTSUPP;
>>   	rcu_read_lock();
>>   	ops = rcu_dereference(lwtun_encaps[encap_type]);
>> +#ifdef CONFIG_MODULES
>> +	if (!ops) {
>> +		rcu_read_unlock();
>> +		request_module("rtnl-lwt-%s", lwtunnel_encap_str(encap_type));
>> +		rcu_read_lock();
>> +		ops = rcu_dereference(lwtun_encaps[encap_type]);
>> +	}
>> +#endif
>>   	if (likely(ops && ops->build_state))
>>   		ret = ops->build_state(dev, encap, family, cfg, lws);
>>   	rcu_read_unlock();
>
> My memory is fuzzy on how this is done elsewhere but this looks like it
> needs a capability check to ensure that non-root user's can't trigger
> this.
>
> It tends to be problematic if a non-root user can trigger an autoload of
> a known-buggy module.  With a combination of user namespaces and network
> namespaces unprivileged users can cause just about every corner of the
> network stack to be exercised.

The same protections apply to this as to the IFLA_INFO_KIND module 
autoloading, namely by rtnetlink_rcv_msg ensuring that no messages other 
than gets can be done by an unprivileged user:

	type = nlh->nlmsg_type;
...
	type -= RTM_BASE;
...
	kind = type&3;

	if (kind != 2 && !netlink_net_capable(skb, CAP_NET_ADMIN))
		return -EPERM;

The lwtunnel_build_state function is only called by the processing of 
non-get message types.

Is this sufficient or are you looking for something in addition?

Thanks,
Rob

  reply	other threads:[~2016-02-16 14:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 15:42 [PATCH net-next 0/3] lwtunnel: autoload of lwt modules Robert Shearman
2016-02-15 15:42 ` [PATCH net-next 1/3] " Robert Shearman
2016-02-15 16:02   ` Jiri Benc
2016-02-15 16:22     ` Robert Shearman
2016-02-15 16:32       ` Jiri Benc
2016-02-15 18:08         ` Robert Shearman
2016-02-15 21:33   ` Eric W. Biederman
2016-02-16 14:14     ` Robert Shearman [this message]
2016-02-15 15:42 ` [PATCH net-next 2/3] mpls: autoload lwt module Robert Shearman
2016-02-15 15:42 ` [PATCH net-next 3/3] ila: autoload module Robert Shearman
2016-02-19  9:43 ` [PATCH net-next v2 0/3] lwtunnel: autoload of lwt modules Robert Shearman
2016-02-19  9:43   ` [PATCH net-next v2 1/3] " Robert Shearman
2016-02-19  9:43   ` [PATCH net-next v2 2/3] mpls: autoload lwt module Robert Shearman
2016-02-19  9:43   ` [PATCH net-next v2 3/3] ila: autoload module Robert Shearman
2016-02-22  3:00   ` [PATCH net-next v2 0/3] lwtunnel: autoload of lwt modules 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=56C32EE3.6090802@brocade.com \
    --to=rshearma@brocade.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=jbenc@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=tgraf@suug.ch \
    --cc=tom@herbertland.com \
    /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).