BACKPORT: Smack: File receive for sockets
authorCasey Schaufler <casey@schaufler-ca.com>
Mon, 7 Dec 2015 22:34:32 +0000 (14:34 -0800)
committerRafal Krypa <r.krypa@samsung.com>
Fri, 18 Nov 2016 10:56:58 +0000 (11:56 +0100)
commitc55043bb91794555e3628af7a9229480570877c6
tree0f56e680bd49d1ffa9d28892dae64fe285f39ac6
parentafd2ff9b7e1b367172f18ba7f693dfb62bdcb2dc
BACKPORT: Smack: File receive for sockets

The existing file receive hook checks for access on
the file inode even for UDS. This is not right, as
the inode is not used by Smack to make access checks
for sockets. This change checks for an appropriate
access relationship between the receiving (current)
process and the socket. If the process can't write
to the socket's send label or the socket's receive
label can't write to the process fail.

This will allow the legitimate cases, where the
socket sender and socket receiver can freely communicate.
Only strangly set socket labels should cause a problem.

Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
(cherry-picked from upstream 79be093500791cc25cc31bcaec5a4db62e21497b)
security/smack/smack_lsm.c