netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] sctp: label accepted/peeled off sockets
@ 2015-12-23 18:44 Marcelo Ricardo Leitner
  2015-12-23 20:05 ` Paul Moore
  2015-12-28  5:15 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-12-23 18:44 UTC (permalink / raw)
  To: netdev; +Cc: cluster-devel, pmoore, teigland, Neil Horman, Vlad Yasevich

From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Accepted or peeled off sockets were missing a security label (e.g.
SELinux) which means that socket was in "unlabeled" state.

This patch clones the sock's label from the parent sock and resolves the
issue (similar to AF_BLUETOOTH protocol family).

Cc: Paul Moore <pmoore@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
---
 net/sctp/socket.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 400a14d744834c7a503b338bc68f5f8b5b5dae8e..b67162767b7957b3e9f4f7bf52ab51fc1a3499c8 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -7202,6 +7202,8 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
 
 	if (newsk->sk_flags & SK_FLAGS_TIMESTAMP)
 		net_enable_timestamp();
+
+	security_sk_clone(sk, newsk);
 }
 
 static inline void sctp_copy_descendant(struct sock *sk_to,
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] sctp: label accepted/peeled off sockets
  2015-12-23 18:44 [PATCH net] sctp: label accepted/peeled off sockets Marcelo Ricardo Leitner
@ 2015-12-23 20:05 ` Paul Moore
  2015-12-28  5:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Moore @ 2015-12-23 20:05 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: netdev, cluster-devel, teigland, Neil Horman, Vlad Yasevich,
	selinux, linux-security-module

On Wednesday, December 23, 2015 04:44:09 PM Marcelo Ricardo Leitner wrote:
> From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> 
> Accepted or peeled off sockets were missing a security label (e.g.
> SELinux) which means that socket was in "unlabeled" state.
> 
> This patch clones the sock's label from the parent sock and resolves the
> issue (similar to AF_BLUETOOTH protocol family).
> 
> Cc: Paul Moore <pmoore@redhat.com>
> Cc: David Teigland <teigland@redhat.com>
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
>  net/sctp/socket.c | 2 ++
>  1 file changed, 2 insertions(+)

[NOTE: added the LSM and SELinux lists to the CC line as a FYI]

Proper SCTP support is on the SELinux todo list, but in the meantime it looks 
like the patch below should at least ensure that SCTP sockets inherit their 
parent's label which is probably the best we can hope for right now.

Acked-by: Paul Moore <paul@paul-moore.com>

> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index
> 400a14d744834c7a503b338bc68f5f8b5b5dae8e..b67162767b7957b3e9f4f7bf52ab51fc1
> a3499c8 100644 --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -7202,6 +7202,8 @@ void sctp_copy_sock(struct sock *newsk, struct sock
> *sk,
> 
>  	if (newsk->sk_flags & SK_FLAGS_TIMESTAMP)
>  		net_enable_timestamp();
> +
> +	security_sk_clone(sk, newsk);
>  }
> 
>  static inline void sctp_copy_descendant(struct sock *sk_to,

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] sctp: label accepted/peeled off sockets
  2015-12-23 18:44 [PATCH net] sctp: label accepted/peeled off sockets Marcelo Ricardo Leitner
  2015-12-23 20:05 ` Paul Moore
@ 2015-12-28  5:15 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-12-28  5:15 UTC (permalink / raw)
  To: mleitner; +Cc: netdev, cluster-devel, pmoore, teigland, nhorman, vyasevich

From: Marcelo Ricardo Leitner <mleitner@redhat.com>
Date: Wed, 23 Dec 2015 16:44:09 -0200

> From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> 
> Accepted or peeled off sockets were missing a security label (e.g.
> SELinux) which means that socket was in "unlabeled" state.
> 
> This patch clones the sock's label from the parent sock and resolves the
> issue (similar to AF_BLUETOOTH protocol family).
> 
> Cc: Paul Moore <pmoore@redhat.com>
> Cc: David Teigland <teigland@redhat.com>
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-12-28  5:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-23 18:44 [PATCH net] sctp: label accepted/peeled off sockets Marcelo Ricardo Leitner
2015-12-23 20:05 ` Paul Moore
2015-12-28  5:15 ` David Miller

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