From: "ira.weiny" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Haggai Eran <haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] IB/sa: Restrict SA Netlink to admin users
Date: Mon, 10 Aug 2015 17:58:30 -0400 [thread overview]
Message-ID: <20150810215829.GA12260@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <55C8407C.6060103-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
On Mon, Aug 10, 2015 at 09:11:08AM +0300, Haggai Eran wrote:
> On 07/08/2015 00:08, ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org wrote:
> > @@ -754,6 +764,12 @@ static int ib_nl_handle_resolve_resp(struct sk_buff *skb,
> > int found = 0;
> > int ret;
> >
> > + if (!ns_capable(sock_net(skb->sk)->user_ns, CAP_NET_ADMIN)) {
> > + pr_warn_ratelimited("SA netlink: invalid perm for response: `%s'.\n",
> > + current->comm);
> > + return -EPERM;
> > + }
> > +
> > spin_lock_irqsave(&ib_nl_request_lock, flags);
> > list_for_each_entry(query, &ib_nl_request_list, list) {
> > /*
>
> Maybe I'm missing something, but I thought you would want to check the
> capability with init_user_ns as the target, since the SA queries will
> affect all namespaces, not just the one that sent the response.
I'm not an expert in namespaces but these checks are only concerned with the
network namespace of the process which is acting as an SA proxy (via netlink).
AFAIK a user can't elevate a network namespace that the SA proxy is running in.
While you are correct that this data does affect all namespaces who are using a
particular port, this does not matter. The SA data for that port is applicable
no matter which network namespace an application running on that port is in.
Furthermore, the check in netlink_bind also uses the socket namespace to
restrict the use of multicast. This plus my checks should allow an admin to
place the SA proxy (ibacm in our test cases) in an alternate network namespace
if they so desire. But this is independent to the namespace which may be used
for data applications.
All that said, I did find the netlink_net_capable helper call which I should
have used instead. I'll work up a v2 today.
Thanks,
Ira
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-08-10 21:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 21:08 [PATCH] IB/sa: Restrict SA Netlink to admin users ira.weiny-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1438895310-6087-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-08-10 6:11 ` Haggai Eran
[not found] ` <55C8407C.6060103-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-08-10 21:58 ` ira.weiny [this message]
[not found] ` <20150810215829.GA12260-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-08-11 5:38 ` Jason Gunthorpe
[not found] ` <20150811053810.GA13314-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-08-11 11:27 ` Wan, Kaike
[not found] ` <3F128C9216C9B84BB6ED23EF16290AFB18540085-8k97q/ur5Z1cIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-08-11 16:27 ` ira.weiny
2015-08-11 16:26 ` ira.weiny
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=20150810215829.GA12260@phlsvsds.ph.intel.com \
--to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=haggaie-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.