Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752037AbdFTTtK (ORCPT ); Tue, 20 Jun 2017 15:49:10 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:33230 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbdFTTtI (ORCPT ); Tue, 20 Jun 2017 15:49:08 -0400 MIME-Version: 1.0 X-Originating-IP: [108.49.102.27] In-Reply-To: <20170619213348.2970-1-aranea@aixah.de> References: <20170619213348.2970-1-aranea@aixah.de> From: Paul Moore Date: Tue, 20 Jun 2017 15:49:05 -0400 Message-ID: Subject: Re: [PATCH] selinux: Assign proper class to PF_UNIX/SOCK_RAW sockets To: Luis Ressel , Stephen Smalley Cc: Eric Paris , James Morris , "Serge E. Hallyn" , selinux@tycho.nsa.gov, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1291 Lines: 34 On Mon, Jun 19, 2017 at 5:33 PM, Luis Ressel wrote: > For PF_UNIX, SOCK_RAW is synonymous with SOCK_DGRAM (cf. > net/unix/af_unix.c). This is a tad obscure, but libpcap uses it. > > Signed-off-by: Luis Ressel > Acked-by: Stephen Smalley > --- > security/selinux/hooks.c | 1 + > 1 file changed, 1 insertion(+) My only concern is what effect this will have on existing policy. Prior to this patch PF_UNIX/SOCK_RAW will result in the generic "socket" class where after this patch it will result in the "unix_dgram_socket". I believe this is the right change, but it seems like this should be wrapped by a policy capability, yes? > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index 819fd6858b49..1a331fba4a3c 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -1275,6 +1275,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc > case SOCK_SEQPACKET: > return SECCLASS_UNIX_STREAM_SOCKET; > case SOCK_DGRAM: > + case SOCK_RAW: > return SECCLASS_UNIX_DGRAM_SOCKET; > } > break; > -- > 2.13.1 -- paul moore www.paul-moore.com