Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id u7ML7h8K020485 for ; Mon, 22 Aug 2016 17:07:43 -0400 Message-ID: <1471900037.19333.6.camel@trentalancia.net> Subject: Re: [PATCH v3] Classify AF_ALG sockets (was: Differentiate between Unix Stream Socket and Sequential Packet Socket) From: Guido Trentalancia To: Paul Moore Cc: selinux@tycho.nsa.gov Date: Mon, 22 Aug 2016 23:07:17 +0200 In-Reply-To: References: <1471709886.22998.1.camel@trentalancia.net> <89E5C3EA-9794-4496-A195-1C997A5BBF44@trentalancia.net> <43BE5B4F-9AE4-4EDB-825A-F1C15042B385@trentalancia.net> <1471799849.2544.2.camel@trentalancia.net> <1471870947.2354.1.camel@trentalancia.net> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Hello Paul. Thanks for providing your feedback. On Mon, 22/08/2016 at 16.17 -0400, Paul Moore wrote: > On Mon, Aug 22, 2016 at 9:02 AM, Guido Trentalancia > wrote: > > > > Modify the SELinux kernel code so that it is able to classify > > sockets with > > the new AF_ALG namespace (used for the user-space interface to the > > kernel > > Crypto API). > > > > A companion patch has been created for the Reference Policy and it > > will be > > posted to its mailing list, once this patch is merged. > > > > Signed-off-by: Guido Trentalancia > > --- > >  security/selinux/hooks.c            |    5 +++-- > >  security/selinux/include/classmap.h |    2 ++ > >  2 files changed, 5 insertions(+), 2 deletions(-) > > > > --- linux-4.7.1-orig/security/selinux/hooks.c   2016-08-21 > > 18:20:52.788066467 +0200 > > +++ linux-4.7.1/security/selinux/hooks.c        2016-08-21 > > 18:23:48.603479911 +0200 > > @@ -1316,6 +1315,8 @@ static inline u16 socket_type_to_securit > >                 return SECCLASS_KEY_SOCKET; > >         case PF_APPLETALK: > >                 return SECCLASS_APPLETALK_SOCKET; > > +       case PF_ALG: > > +               return SECCLASS_ALG_SOCKET; > >         } > > Because this patch changes the object class for existing permission > checks you will need to wrap this with a policy capability, see > selinux_policycap_netpeer for an example. I have posted a revised version of the patch (v4). By the way, I think libsepol needs to be patched too. And, of course, the Reference Policy (the patch is ready). -- Guido