linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: linux-security-module@vger.kernel.org
Subject: Re: [RFC v2 PATCH 2/2] kernel: Add SELinux SCTP protocol support
Date: Mon, 20 Mar 2017 17:23:36 +0000	[thread overview]
Message-ID: <20170320172336.GC23553@localhost.localdomain> (raw)
In-Reply-To: <1488487540.19896.108.camel@tycho.nsa.gov>

On Thu, Mar 02, 2017 at 03:45:40PM -0500, Stephen Smalley wrote:
> On Wed, 2017-02-22 at 17:03 +0000, Richard Haines wrote:
<snip>

> > +	return err;
> > +}
> > +
> > +static int selinux_sctp_accept_conn(struct sctp_endpoint *ep,
> > +				    struct sk_buff *skb)
> > +{
> > +	struct sk_security_struct *sksec = ep->base.sk->sk_security;
> > +	int err;
> > +	u32 connsid;
> > +	u32 peersid;
> > +
> > +	/* Have COOKIE ECHO so compute the MLS component for the
> > connection
> > +	 * and store the information in ep. This will only be used
> > by
> > +	 * TCP/peeloff connections as they cause a new socket to be
> > generated.
> 
> Not sure why you say TCP above.  And won't this be true of accept()'d

Probably just a typo, should be SCTP instead.

> sockets too in addition to peeloff ones?

Speaking of accept() path, I think we have an issue there with this
patch, because it's doing:
@@ -7683,8 +7717,6 @@ void sctp_copy_sock(struct sock *newsk, struct
sock *sk,
-       security_sk_clone(sk, newsk);
@@ -7829,6 +7862,11 @@ static void sctp_sock_migrate(struct sock *oldsk,
struct
+       security_sctp_sk_clone(oldep, oldsk, newsk);

But sctp_copy_sock() is called from places other than
sctp_sock_migrate, mainly:
net/sctp/ipv6.c:        sctp_copy_sock(newsk, sk, asoc);
net/sctp/protocol.c:    sctp_copy_sock(newsk, sk, asoc);
Which are on the accept() path.

Ideally it's better to keep the call to security_sctp_sk_clone in
sctp_copy_sock() to get those covered too.

  Marcelo

> 
> > +	 * selinux_sctp_sk_clone() will then plug this into the new
> > socket
> > +	 * as described in Documentation/security/LSM-sctp.txt
> > +	 */
> > +	err = selinux_skb_peerlbl_sid(skb, ep->base.sk->sk_family,
> > &peersid);
> > +	if (err)
> > +		return err;
> > +
> > +	err = selinux_conn_sid(sksec->sid, peersid, &connsid);
> > +	if (err)
> > +		return err;
> > +
> > +	ep->secid = connsid;
> > +	ep->peer_secid = peersid;
> > +
> > +	return 0;
> > +}
> > +
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2017-03-20 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-22 17:03 [RFC v2 PATCH 2/2] kernel: Add SELinux SCTP protocol support Richard Haines
2017-03-02 20:45 ` Stephen Smalley
2017-03-20 17:23   ` Marcelo Ricardo Leitner [this message]
2017-03-22 10:22     ` Richard Haines
2017-03-22 10:11   ` Richard Haines

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=20170320172336.GC23553@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=linux-security-module@vger.kernel.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 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).