From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754661AbbIICWm (ORCPT ); Tue, 8 Sep 2015 22:22:42 -0400 Received: from fr-hpida-esg-01.alcatel-lucent.com ([135.245.210.20]:48375 "EHLO smtp-fr.alcatel-lucent.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753228AbbIICWX (ORCPT ); Tue, 8 Sep 2015 22:22:23 -0400 From: "Michael J. Coss" To: gregkh@linuxfoundation.org, davem@davemloft.net, linux-kernel@vger.kernel.org, containers@lists.linuxcontainers.org Cc: serge.hallyn@ubuntu.com, stgraber@ubuntu.com, "Michael J. Coss" Subject: [PATCH 1/3] lib/kobject_uevent.c: disable broadcast of uevents to other namespaces Date: Tue, 8 Sep 2015 22:10:28 -0400 Message-Id: <51c185b6fa89f0b8e9e7dcaffb3c21c975c84302.1441762578.git.michael.coss@alcatel-lucent.com> X-Mailer: git-send-email 2.4.6 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Restrict sending uevents to only those listeners operating in the same network namespace as the system init process. This is the first step toward allowing policy control of the forwarding of events to other namespaces in userspace. Signed-off-by: Michael J. Coss --- lib/kobject_uevent.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index f6c2c1e..d791e33 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -295,6 +295,10 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, if (!netlink_has_listeners(uevent_sock, 1)) continue; + /* forward event only to the host systems network namespaces */ + if (!net_eq(sock_net(uevent_sock), &init_net)) + continue; + /* allocate message with the maximum possible size */ len = strlen(action_string) + strlen(devpath) + 2; skb = alloc_skb(len + env->buflen, GFP_KERNEL); -- 2.4.6