From: ebiederm@xmission.com (Eric W. Biederman)
To: Christian Brauner <christian.brauner@canonical.com>
Cc: Kirill Tkhai <ktkhai@virtuozzo.com>,
davem@davemloft.net, gregkh@linuxfoundation.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
avagin@virtuozzo.com, serge@hallyn.com
Subject: Re: [PATCH net-next] netns: filter uevents correctly
Date: Fri, 06 Apr 2018 11:48:40 -0500 [thread overview]
Message-ID: <878ta01dsn.fsf@xmission.com> (raw)
In-Reply-To: <20180406160757.GA16281@gmail.com> (Christian Brauner's message of "Fri, 6 Apr 2018 18:07:59 +0200")
Christian Brauner <christian.brauner@canonical.com> writes:
>> At a practical level there should be no receivers. Plus performance
>> issues. At least my memory is that any unprivileged user on the system
>> is allowed to listen to those events.
>
> Any unprivileged user is allowed to listen to uevents if they have
> net_broadcast in the user namespace the uevent socket was opened in;
> unless I'm misreading.
I believe you are.
This code in do_one_broadcast.
if (!net_eq(sock_net(sk), p->net)) {
if (!(nlk->flags & NETLINK_F_LISTEN_ALL_NSID))
return;
if (!peernet_has_id(sock_net(sk), p->net))
return;
if (!file_ns_capable(sk->sk_socket->file, p->net->user_ns,
CAP_NET_BROADCAST))
return;
}
Used to just be:
if (!net_eq(sock_net(sk), p->net))
return;
Which makes sense when you have a shared hash table and a shared mc_list
between network namespaces.
There is a non-container use of network namespaces where you just need
different contexts were ip addresses can overlap etc. In that
configuration where a single program is mananging multiple network
namespaces being able to listen to rtnetlink events in all of them is an
advantage.
For that case a special socket option NETLINK_F_LISTEN_ALL_NSID was
added that allowed one socket to listen for events from multiple network
namespaces.
If we rework the code in af_netlink.c that matters. However for just
understanding uevents you can assume there are no sockets with
NETLINK_F_LISTEN_ALL_NSID set.
Eric
next prev parent reply other threads:[~2018-04-06 16:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-04 19:48 [PATCH net-next] netns: filter uevents correctly Christian Brauner
2018-04-04 20:30 ` [PATCH net] " Christian Brauner
2018-04-04 22:38 ` Eric W. Biederman
2018-04-05 1:27 ` Christian Brauner
2018-04-06 2:02 ` David Miller
2018-04-05 1:35 ` Christian Brauner
2018-04-05 13:01 ` [PATCH net-next] " Kirill Tkhai
2018-04-05 14:07 ` Christian Brauner
2018-04-05 14:26 ` Kirill Tkhai
2018-04-05 14:41 ` Christian Brauner
2018-04-06 3:59 ` Eric W. Biederman
2018-04-06 13:07 ` Christian Brauner
2018-04-06 14:45 ` Eric W. Biederman
2018-04-06 16:07 ` Christian Brauner
2018-04-06 16:48 ` Eric W. Biederman [this message]
2018-04-09 15:46 ` Christian Brauner
2018-04-09 23:21 ` Eric W. Biederman
2018-04-10 14:35 ` Christian Brauner
2018-04-10 15:04 ` Eric W. Biederman
2018-04-11 9:09 ` Christian Brauner
2018-04-11 16:40 ` Eric W. Biederman
2018-04-11 17:03 ` Christian Brauner
2018-04-11 18:37 ` Eric W. Biederman
2018-04-11 18:57 ` Christian Brauner
2018-04-11 19:16 ` Eric W. Biederman
2018-04-11 19:57 ` Christian Brauner
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=878ta01dsn.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=avagin@virtuozzo.com \
--cc=christian.brauner@canonical.com \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=ktkhai@virtuozzo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=serge@hallyn.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