All of lore.kernel.org
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Eric Paris <eparis@redhat.com>
Cc: David Miller <davem@davemloft.net>,
	pekane52@gmail.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, cxzhang@watson.ibm.com,
	sds@tycho.nsa.gov, jmorris@namei.org, eparis@parisplace.org,
	paul.moore@hp.com, LSM <linux-security-module@vger.kernel.org>
Subject: Re: [PATCH v2] net/unix: Add secdata to unix_stream msgs
Date: Wed, 23 Mar 2011 09:11:32 -0700	[thread overview]
Message-ID: <4D8A1BB4.4030709@schaufler-ca.com> (raw)
In-Reply-To: <1300895847.28871.13.camel@unknown001a4b0c2895>

On 3/23/2011 8:57 AM, Eric Paris wrote:
> On Tue, 2011-03-22 at 19:32 -0700, David Miller wrote:
>> From: Pat Kane <pekane52@gmail.com>
>> Date: Tue, 22 Mar 2011 19:38:37 -0500
>>
>>> The unix_dgram routines add secdata to socket messages,
>>> but the unix_stream routines do not. I have added the
>>> two missing lines of code.
>>>
>>> Signed-off-by: Pat Kane <pekane52@gmail.com>
>> The security hooks appear to be only intended to operate on datagram
>> sockets, and as such I think the omission of UNIX stream sockets was
>> very much on purpose.
>>
>> The SELINUX hook implementations even have "_dgram()" in their names.
>>
>> Catherine Zhang added to CC: as she last made modifications to these
>> hooks.
> And I'll add Paul Moore as I think he understands the intersection
> of /net and /security better than anyone.

Paul is definitely the man on this. I've also added the LSM list,
as while SELinux is the only current user of secdata that may not
always be the case.


>>> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
>>> index 1663e1a..8753cdd 100644
>>> --- a/net/unix/af_unix.c
>>> +++ b/net/unix/af_unix.c
>>> @@ -1642,6 +1642,8 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
>>>  		max_level = err + 1;
>>>  		fds_sent = true;
>>>  
>>> +		unix_get_secdata(siocb->scm, skb);
>>> +
>>>  		err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
>>>  		if (err) {
>>>  			kfree_skb(skb);
>>> @@ -1930,6 +1932,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
>>>  		} else {
>>>  			/* Copy credentials */
>>>  			scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
>>> +			unix_set_secdata(siocb->scm, skb);
>>>  			check_creds = 1;
>>>  		}
>>>  
>>> -- 
>>> 1.7.1
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at  http://www.tux.org/lkml/
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
>


  reply	other threads:[~2011-03-23 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23  0:38 [PATCH v2] net/unix: Add secdata to unix_stream msgs Pat Kane
2011-03-23  2:32 ` David Miller
2011-03-23 15:57   ` Eric Paris
2011-03-23 16:11     ` Casey Schaufler [this message]
2011-03-23 20:23       ` Pat Kane
2011-03-23 22:16         ` Paul Moore

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=4D8A1BB4.4030709@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=cxzhang@watson.ibm.com \
    --cc=davem@davemloft.net \
    --cc=eparis@parisplace.org \
    --cc=eparis@redhat.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paul.moore@hp.com \
    --cc=pekane52@gmail.com \
    --cc=sds@tycho.nsa.gov \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.