net/unix: Add secdata to unix_stream msgs
Subsystems (3)
PATCH v2 1/1 net/unix: Add secdata to unix_stream msgs
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.
--- net/unix/af_unix.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
net/unix/af_unix.c +3 -0
@@ -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 ; }
Signature · 1 line
1.7.1
David Miller
maintainerFrom: Pat Kane <[email protected]>
Date: Tue, 22 Mar 2011 19:38:37 -0500
Quoted 5 lines
The
unix_dgramroutines add secdata to socket messages, but theunix_streamroutines do not. I have added the two missing lines of code.Signed-off-by Pat Kane <[email protected]>
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.
Quoted 29 lines
net/unix/af_unix.c +3
-0@@ -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 ; }Signature · 7 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 9 lines · David Miller
From: Pat Kane <[email protected]>
Date: Tue, 22 Mar 2011 19:38:37 -0500Quoted 5 lines
The
unix_dgramroutines add secdata to socket messages, but theunix_streamroutines do not. I have added the two missing lines of code.Signed-off-by Pat Kane <[email protected]>
Quoted 8 lines
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.
Quoted 30 lines
Quoted 30 lines
net/unix/af_unix.c +3
-0@@ -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 ; }Signature · 7 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Quoted 13 lines · Eric Paris
Quoted 12 lines · David Miller
From: Pat Kane <[email protected]>
Date: Tue, 22 Mar 2011 19:38:37 -0500Quoted 5 lines
The
unix_dgramroutines add secdata to socket messages, but theunix_streamroutines do not. I have added the two missing lines of code.Signed-off-by Pat Kane <[email protected]>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.
Quoted 6 lines
Quoted 4 lines
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.
Quoted 37 lines
Quoted 21 lines
Quoted 21 lines
net/unix/af_unix.c +3
-0@@ -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 ; }Quoted 8 lines
Quoted 8 lines
Signature · 7 lines
1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines
Quoted 2 lines · David Miller
Quoted 1 line
The SELINUX hook implementations even have "
_dgram()" in their names.
The LSM hook that I am having problems with, and that the patch fixes is "secid_to_secctx()" not "socket_getpeersec_dgram()".
Pat
---
Quoted 5 lines · Pat Kane
Quoted 2 lines
Quoted 2 lines · David Miller
Quoted 1 line
The SELINUX hook implementations even have "
_dgram()" in their names.The LSM hook that I am having problems with, and that the patch fixes is "
secid_to_secctx()" not "socket_getpeersec_dgram()".
Can you explain the problem you are having? I'm specifically interested in who is calling secid_to_secctx() on a AF_UNIX stream packet.
Adding the secid token to a AF_UNIX stream packet isn't likely to be the right solution, although until we hear what the core problem is, I'm not sure we can offer any fixes.
--
paul moore
linux @ hp