Re: [PATCH 1/3] lib/kobject_uevent.c: disable broadcast of uevents to other namespaces

2015-09-11 Thread Michael J Coss
On 9/10/2015 8:36 PM, Eric W. Biederman wrote:
> "Michael J. Coss"  writes:
>
>> 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.
> This limitation whould be better if we only skipped network namespaces
> where you are sending spoofed uevents.
>
> As it sits this has the possibility to break userspace.
>
> Eric
>
While I don't necessarily see how this could cause an issue with
userspace, I agree that it could be made to work that way and accomplish
the same goal and be even more transparent.  I would think that it would
require some state in the network namespace that would be settable to
say enable/disable host uevent broadcasts across this particular netlink
socket.

---Michael J Coss
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] lib/kobject_uevent.c: disable broadcast of uevents to other namespaces

2015-09-11 Thread Michael J Coss
On 9/10/2015 8:36 PM, Eric W. Biederman wrote:
> "Michael J. Coss"  writes:
>
>> 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.
> This limitation whould be better if we only skipped network namespaces
> where you are sending spoofed uevents.
>
> As it sits this has the possibility to break userspace.
>
> Eric
>
While I don't necessarily see how this could cause an issue with
userspace, I agree that it could be made to work that way and accomplish
the same goal and be even more transparent.  I would think that it would
require some state in the network namespace that would be settable to
say enable/disable host uevent broadcasts across this particular netlink
socket.

---Michael J Coss
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] lib/kobject_uevent.c: disable broadcast of uevents to other namespaces

2015-09-10 Thread Eric W. Biederman
"Michael J. Coss"  writes:

> 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.

This limitation whould be better if we only skipped network namespaces
where you are sending spoofed uevents.

As it sits this has the possibility to break userspace.

Eric

> 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), _net))
> + continue;
> +
>   /* allocate message with the maximum possible size */
>   len = strlen(action_string) + strlen(devpath) + 2;
>   skb = alloc_skb(len + env->buflen, GFP_KERNEL);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] lib/kobject_uevent.c: disable broadcast of uevents to other namespaces

2015-09-10 Thread Eric W. Biederman
"Michael J. Coss"  writes:

> 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.

This limitation whould be better if we only skipped network namespaces
where you are sending spoofed uevents.

As it sits this has the possibility to break userspace.

Eric

> 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), _net))
> + continue;
> +
>   /* allocate message with the maximum possible size */
>   len = strlen(action_string) + strlen(devpath) + 2;
>   skb = alloc_skb(len + env->buflen, GFP_KERNEL);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] lib/kobject_uevent.c: disable broadcast of uevents to other namespaces

2015-09-08 Thread Michael J. Coss
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), _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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] lib/kobject_uevent.c: disable broadcast of uevents to other namespaces

2015-09-08 Thread Michael J. Coss
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), _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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/