Updated labeled networking patches
Subsystems (5)
v5 cover Updated labeled networking patches
An update on the labeled networking patches I'm targeting for 2.6.25. This latest spin rebases against Linus' latest and adds in the foundation for the fallback/static label patches that were posted earlier. The actual fallback and flow control patches are still not included in this patch set but all of the foundation pieces should now be in place.
Just a word of caution, while these all compile without problems I'm currently having a problem getting the "make modules_install" step to work correctly so I haven't had a chance to test these patches yet.
For those of you using git, you can find these patches here:
* git://git.infradead.org/users/pcmoore/lblnet-2.6_testing
Signature · 7 lines
paul moore linux security @ hp -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 1/8 NetLabel: Add secid token support to the NetLabel secattr struct
This patch adds support to the NetLabel LSM secattr struct for a secid token, paving the way for full LSM/SELinux context support. In this patch adds a fair amount of documentation to the core NetLabel structures used as part of the NetLabel kernel API.
---
include/net/netlabel.h | 95 ++++++++++++++++++++++++++++++++-------- net/ipv4/cipso_ipv4.c | 56 ++++++++++++++---------- security/selinux/ss/mls.c | 10 ++-- security/selinux/ss/services.c | 5 ++ 4 files changed, 120 insertions(+), 46 deletions(-)
include/net/netlabel.h +77 -18
@@ -105,17 +105,49 @@ struct netlbl_dom_map;/* Domain mapping operations */ int netlbl_domhsh_remove (const char *domain,struct netlbl_audit *audit_info); -/* LSM security attributes */ +/* +* LSM security attributes +*/ + +/** +* struct netlbl_lsm_cache - NetLabel LSM security attribute cache +* @refcount: atomic reference counter +* @free: LSM supplied function to free the cache data +* @data: LSM supplied cache data +* +* Description: +* This structure is provided for LSMs which wish to make use of the NetLabel +* caching mechanism to store LSM specific data/attributes in the NetLabel +* cache. If the LSM has to perform a lot of translation from the NetLabel +* security attributes into it's own internal representation then the cache +* mechanism can provide a way to eliminate some or all of that translation +* overhead on a cache hit. +* +*/ struct netlbl_lsm_cache {atomic_t refcount;void (*free) (const void *data);void *data; }; -/* The catmap bitmap field MUST be a power of two in length and large + +/** +* struct netlbl_lsm_secattr_catmap - NetLabel LSM secattr category bitmap +* @startbit: the value of the lowest order bit in the bitmap +* @bitmap: the category bitmap +* @next: pointer to the next bitmap "node" or NULL +* +* Description: +* This structure is used to represent category bitmaps. Due to the large +* number of categories supported by most labeling protocols it is not +* practical to transfer a full bitmap internally so NetLabel adopts a sparse +* bitmap structure modeled after SELinux's ebitmap structure. +* The catmap bitmap field MUST be a power of two in length and large * enough to hold at least 240 bits. Special care (i.e. check the code!) * should be used when changing these values as the LSM implementation * probably has functions which rely on the sizes of these types to speed -* processing. */ +* processing. +* +*/ #define NETLBL_CATMAP_MAPTYPE u64#define NETLBL_CATMAP_MAPCNT 4#define NETLBL_CATMAP_MAPSIZE (sizeof(NETLBL_CATMAP_MAPTYPE) * 8)
@@ -127,22 +159,52 @@ struct netlbl_lsm_secattr_catmap {NETLBL_CATMAP_MAPTYPE bitmap[NETLBL_CATMAP_MAPCNT ];struct netlbl_lsm_secattr_catmap *next; }; + +/** +* struct netlbl_lsm_secattr - NetLabel LSM security attributes +* @flags: indicate which attributes are contained in this structure +* @domain: the NetLabel LSM domain +* @cache: NetLabel LSM specific cache +* @attr.mls: MLS sensitivity label +* @attr.mls.cat: MLS category bitmap +* @attr.mls.lvl: MLS sensitivity level +* @attr.secid: LSM specific secid token +* +* Description: +* This structure is used to pass security attributes between NetLabel and the +* LSM modules. The flags field is used to specify which fields within the +* struct are valid and valid values can be created by bitwise OR'ing the +* NETLBL_SECATTR_* defines. The domain field is typically set by the LSM to +* specify domain specific configuration settings and is not usually used by +* NetLabel itself when returning security attributes to the LSM. +* +*/ #define NETLBL_SECATTR_NONE 0x00000000#define NETLBL_SECATTR_DOMAIN 0x00000001#define NETLBL_SECATTR_CACHE 0x00000002#define NETLBL_SECATTR_MLS_LVL 0x00000004#define NETLBL_SECATTR_MLS_CAT 0x00000008 +#define NETLBL_SECATTR_SECID 0x00000010#define NETLBL_SECATTR_CACHEABLE (NETLBL_SECATTR_MLS_LVL | \ - NETLBL_SECATTR_MLS_CAT) + NETLBL_SECATTR_MLS_CAT | \ + NETLBL_SECATTR_SECID)struct netlbl_lsm_secattr {u32 flags; - +/* there is a 4 byte hole here in 64 bit architectures which we could +* solve by moving the 'flags' field elsewhere in this structure but +* to do so would move push it out of the first cacheline, which is not +* desireable from a performance standpoint as in the case of an +* unlabeled packet (most common) the 'flags' field is the only field +* the LSM is likely to check */ char *domain; - -u32 mls_lvl; -struct netlbl_lsm_secattr_catmap *mls_cat; -struct netlbl_lsm_cache *cache; +union { +struct { +struct netlbl_lsm_secattr_catmap *cat; +u32 lvl; + } mls; +u32 secid; + } attr; };/*
@@ -231,10 +293,7 @@ static inline void netlbl_secattr_catmap_free(*/ static inline void netlbl_secattr_init (struct netlbl_lsm_secattr *secattr) { - secattr->flags =0 ; - secattr->domain =NULL ; - secattr->mls_cat =NULL ; - secattr->cache =NULL ; +memset (secattr,0 ,sizeof (*secattr)); }/**
@@ -248,11 +307,11 @@ static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)*/ static inline void netlbl_secattr_destroy (struct netlbl_lsm_secattr *secattr) { -if (secattr->cache) -netlbl_secattr_cache_free (secattr->cache);kfree (secattr->domain); -if (secattr->mls_cat) -netlbl_secattr_catmap_free (secattr->mls_cat); +if (secattr->flags &NETLBL_SECATTR_CACHE ) +netlbl_secattr_cache_free (secattr->cache); +if (secattr->flags &NETLBL_SECATTR_MLS_CAT ) +netlbl_secattr_catmap_free (secattr->attr.mls.cat); }/**
@@ -300,7 +359,7 @@ int netlbl_secattr_catmap_setrng(struct netlbl_lsm_secattr_catmap *catmap, gfp_t flags);/* -* LSM protocol operations +* LSM protocol operations (NetLabel LSM/kernel API) */ int netlbl_enabled (void ); int netlbl_sock_setattr(struct sock *sk,
net/ipv4/cipso_ipv4.c +34 -22
161 lines not on this page · raw message
security/selinux/ss/mls.c +5 -5
@@ -563,7 +563,7 @@ void mls_export_netlbl_lvl(struct context *context,if (!selinux_mls_enabled)return ; - secattr->mls_lvl = context->range.level[0 ].sens -1 ; + secattr->attr.mls.lvl = context->range.level[0 ].sens -1 ; secattr->flags |=NETLBL_SECATTR_MLS_LVL ; }
@@ -583,7 +583,7 @@ void mls_import_netlbl_lvl(struct context *context,if (!selinux_mls_enabled)return ; - context->range.level[0 ].sens = secattr->mls_lvl +1 ; + context->range.level[0 ].sens = secattr->attr.mls.lvl +1 ; context->range.level[1 ].sens = context->range.level[0 ].sens; }
@@ -606,8 +606,8 @@ int mls_export_netlbl_cat(struct context *context,return 0 ; rc =ebitmap_netlbl_export (&context->range.level[0 ].cat, - &secattr->mls_cat); -if (rc ==0 && secattr->mls_cat !=NULL ) + &secattr->attr.mls.cat); +if (rc ==0 && secattr->attr.mls.cat !=NULL ) secattr->flags |=NETLBL_SECATTR_MLS_CAT ;return rc;
@@ -634,7 +634,7 @@ int mls_import_netlbl_cat(struct context *context,return 0 ; rc =ebitmap_netlbl_import (&context->range.level[0 ].cat, - secattr->mls_cat); + secattr->attr.mls.cat);if (rc !=0 ) goto import_netlbl_cat_failure;
security/selinux/ss/services.c +4 -1
@@ -2547,6 +2547,9 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,default : goto netlbl_secattr_to_sid_return; } + }else if (secattr->flags &NETLBL_SECATTR_SECID ) { + *sid = secattr->attr.secid; + rc =0 ; }else if (secattr->flags &NETLBL_SECATTR_MLS_LVL ) { ctx =sidtab_search (&sidtab, base_sid);if (ctx ==NULL )
@@ -2558,7 +2561,7 @@ int security_netlbl_secattr_to_sid(struct netlbl_lsm_secattr *secattr,mls_import_netlbl_lvl (&ctx_new, secattr);if (secattr->flags &NETLBL_SECATTR_MLS_CAT ) {if (ebitmap_netlbl_import (&ctx_new.range.level[0 ].cat, - secattr->mls_cat) !=0 ) + secattr->attr.mls.cat) !=0 ) goto netlbl_secattr_to_sid_return; ctx_new.range.level[1 ].cat.highbit = ctx_new.range.level[0 ].cat.highbit;
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 2/8 SELinux: add secctx_to_secid() LSM hook
In reply to Paul MooreAdd a secctx_to_secid() LSM hook to go along with the existing secid_to_secctx() LSM hook. This patch also includes a SELinux implementation for this hook.
---
include/linux/security.h | 13 +++++++++++++ security/dummy.c | 6 ++++++ security/security.c | 8 ++++++++ security/selinux/hooks.c | 6 ++++++ 4 files changed, 33 insertions(+), 0 deletions(-)
include/linux/security.h +13 -0
@@ -1183,6 +1183,10 @@ struct request_sock;* Convert secid to security context. * @secid contains the security ID. * @secdata contains the pointer that stores the converted security context. +* @secctx_to_secid: +* Convert security context to secid. +* @secid contains the pointer to the generated security ID. +* @secdata contains the security context. * * @release_secctx: * Release the security context.
@@ -1371,6 +1375,7 @@ struct security_operations {int (*getprocattr)(struct task_struct *p,char *name,char **value);int (*setprocattr)(struct task_struct *p,char *name,void *value,size_t size);int (*secid_to_secctx)(u32 secid,char **secdata,u32 *seclen); +int (*secctx_to_secid)(char *secdata,u32 seclen,u32 *secid);void (*release_secctx)(char *secdata,u32 seclen);#ifdef CONFIG_SECURITY_NETWORK
@@ -1603,6 +1608,7 @@ int security_setprocattr(struct task_struct *p, char *name, void *value, size_tint security_netlink_send (struct sock *sk,struct sk_buff *skb);int security_netlink_recv (struct sk_buff *skb,int cap);int security_secid_to_secctx (u32 secid,char **secdata,u32 *seclen); +int security_secctx_to_secid (char *secdata,u32 seclen,u32 *secid);void security_release_secctx (char *secdata,u32 seclen);#else /* CONFIG_SECURITY */
@@ -2280,6 +2286,13 @@ static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclereturn -EOPNOTSUPP ; } +static inline int security_secctx_to_secid (char *secdata, +u32 seclen, +u32 *secid) +{ +return -EOPNOTSUPP ; +} +static inline void security_release_secctx (char *secdata,u32 seclen) { }
security/dummy.c +6 -0
@@ -928,6 +928,11 @@ static int dummy_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)return -EOPNOTSUPP ; } +static int dummy_secctx_to_secid (char *secdata,u32 seclen,u32 *secid) +{ +return -EOPNOTSUPP ; +} +static void dummy_release_secctx (char *secdata,u32 seclen) { }
@@ -1086,6 +1091,7 @@ void security_fixup_ops (struct security_operations *ops)set_to_dummy_if_null (ops, getprocattr);set_to_dummy_if_null (ops, setprocattr);set_to_dummy_if_null (ops, secid_to_secctx); +set_to_dummy_if_null (ops, secctx_to_secid);set_to_dummy_if_null (ops, release_secctx);#ifdef CONFIG_SECURITY_NETWORK set_to_dummy_if_null (ops, unix_stream_connect);
security/security.c +8 -0
@@ -816,6 +816,14 @@ int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) }EXPORT_SYMBOL (security_secid_to_secctx); +int security_secctx_to_secid (char *secdata,u32 seclen,u32 *secid) +{ +return security_ops->secctx_to_secid (char *secdata, + u32 seclen, + u32 *secid); +} +EXPORT_SYMBOL (security_secctx_to_secid); +void security_release_secctx (char *secdata,u32 seclen) {return security_ops->release_secctx (secdata, seclen);
security/selinux/hooks.c +6 -0
@@ -4710,6 +4710,11 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)return security_sid_to_context (secid, secdata, seclen); } +static int selinux_secctx_to_secid (char *secdata,u32 seclen,u32 *secid) +{ +return security_context_to_sid (secdata, seclen, secid); +} +static void selinux_release_secctx (char *secdata,u32 seclen) {kfree (secdata);
@@ -4898,6 +4903,7 @@ static struct security_operations selinux_ops = { .setprocattr = selinux_setprocattr, .secid_to_secctx = selinux_secid_to_secctx, + .secctx_to_secid = selinux_secctx_to_secid, .release_secctx = selinux_release_secctx, .unix_stream_connect = selinux_socket_unix_stream_connect,
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: [RFC PATCH v5 2/8] SELinux: add secctx_to_secid() LSM hook
security/security.c int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) · line 824
Quoted 6 lines · Paul Moore
security/security.c +6
-0+int security_secctx_to_secid (char *secdata,u32 seclen,u32 *secid) +{ +return security_ops->secctx_to_secid (char *secdata, + u32 seclen, + u32 *secid); +}
Ooops. Luckily I was still able to see well enough through the brown paper bag to fix this ... Sorry about that.
Signature · 7 lines
paul moore linux security @ hp -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 3/8 NetLabel: add IP address family information to the netlbl_skbuff_getattr() function
In reply to Paul MooreIn order to do any sort of IP header inspection of incoming packets we need to know which address family, AF_INET/AF_INET6/etc., it belongs to and since the sk_buff structure does not store this information we need to pass along the address family separate from the packet itself.
---
include/net/netlabel.h | 2 ++ net/netlabel/netlabel_kapi.c | 2 ++ security/selinux/hooks.c | 24 ++++++++++++++++++------ security/selinux/include/netlabel.h | 8 +++++++- security/selinux/netlabel.c | 12 +++++++++--- 5 files changed, 38 insertions(+), 10 deletions(-)
include/net/netlabel.h +2 -0
@@ -367,6 +367,7 @@ int netlbl_sock_setattr(struct sock *sk,int netlbl_sock_getattr (struct sock *sk,struct netlbl_lsm_secattr *secattr);int netlbl_skbuff_getattr (const struct sk_buff *skb, +u16 family,struct netlbl_lsm_secattr *secattr);void netlbl_skbuff_err (struct sk_buff *skb,int error);
@@ -419,6 +420,7 @@ static inline int netlbl_sock_getattr(struct sock *sk,return -ENOSYS ; }static inline int netlbl_skbuff_getattr (const struct sk_buff *skb, +u16 family,struct netlbl_lsm_secattr *secattr) {return -ENOSYS ;
net/netlabel/netlabel_kapi.c +2 -0
@@ -331,6 +331,7 @@ int netlbl_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)/** * netlbl_skbuff_getattr - Determine the security attributes of a packet * @skb: the packet +* @family: protocol family * @secattr: the security attributes * * Description:
@@ -341,6 +342,7 @@ int netlbl_sock_getattr(struct sock *sk, struct netlbl_lsm_secattr *secattr)* */ int netlbl_skbuff_getattr (const struct sk_buff *skb, +u16 family,struct netlbl_lsm_secattr *secattr) { if (CIPSO_V4_OPTEXIST(skb) &&
security/selinux/hooks.c +18 -6
@@ -3192,6 +3192,7 @@ static int selinux_parse_skb(struct sk_buff *skb, struct avc_audit_data *ad,/** * selinux_skb_extlbl_sid - Determine the external label of a packet * @skb: the packet +* @family: protocol family * @sid: the packet's SID * * Description:
@@ -3204,13 +3205,16 @@ static int selinux_parse_skb(struct sk_buff *skb, struct avc_audit_data *ad,* selinux_netlbl_skbuff_getsid(). * */ -static void selinux_skb_extlbl_sid (struct sk_buff *skb,u32 *sid) +static void selinux_skb_extlbl_sid (struct sk_buff *skb, +u16 family, +u32 *sid) {u32 xfrm_sid;u32 nlbl_sid;selinux_skb_xfrm_sid (skb, &xfrm_sid);if (selinux_netlbl_skbuff_getsid (skb, + family, (xfrm_sid ==SECSID_NULL ?SECINITSID_NETMSG : xfrm_sid), &nlbl_sid) !=0 )
@@ -3703,7 +3707,7 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)if (err) goto out; - err =selinux_netlbl_sock_rcv_skb (sksec, skb, &ad); + err =selinux_netlbl_sock_rcv_skb (sksec, skb, family, &ad);if (err) goto out;
@@ -3760,11 +3764,19 @@ static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff * {u32 peer_secid =SECSID_NULL ;int err =0 ; +u16 family; + +if (sock) + family = sock->sk->sk_family; +else if (skb->sk) + family = skb->sk->sk_family; +else + family =PF_UNSPEC ; -if (sock && sock->sk->sk_family ==PF_UNIX ) +if (sock && family ==PF_UNIX )selinux_get_inode_sid (SOCK_INODE (sock), &peer_secid);else if (skb) -selinux_skb_extlbl_sid (skb, &peer_secid); +selinux_skb_extlbl_sid (skb, family, &peer_secid);if (peer_secid ==SECSID_NULL ) err = -EINVAL ;
@@ -3825,7 +3837,7 @@ static int selinux_inet_conn_request(struct sock *sk, struct sk_buff *skb,u32 newsid;u32 peersid; -selinux_skb_extlbl_sid (skb, &peersid); +selinux_skb_extlbl_sid (skb, sk->sk_family, &peersid);if (peersid ==SECSID_NULL ) { req->secid = sksec->sid; req->peer_secid =SECSID_NULL ;
@@ -3863,7 +3875,7 @@ static void selinux_inet_conn_established(struct sock *sk, {struct sk_security_struct *sksec = sk->sk_security; -selinux_skb_extlbl_sid (skb, &sksec->peer_sid); +selinux_skb_extlbl_sid (skb, sk->sk_family, &sksec->peer_sid); } static void selinux_req_classify_flow(const struct request_sock *req,
security/selinux/include/netlabel.h +7 -1
@@ -46,13 +46,17 @@ void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec,void selinux_netlbl_sk_security_clone (struct sk_security_struct *ssec,struct sk_security_struct *newssec); -int selinux_netlbl_skbuff_getsid (struct sk_buff *skb,u32 base_sid,u32 *sid); +int selinux_netlbl_skbuff_getsid (struct sk_buff *skb, +u16 family, +u32 base_sid, +u32 *sid);void selinux_netlbl_sock_graft (struct sock *sk,struct socket *sock);int selinux_netlbl_socket_post_create (struct socket *sock);int selinux_netlbl_inode_permission (struct inode *inode,int mask);int selinux_netlbl_sock_rcv_skb (struct sk_security_struct *sksec,struct sk_buff *skb, +u16 family,struct avc_audit_data *ad); int selinux_netlbl_socket_setsockopt(struct socket *sock, int level,
@@ -83,6 +87,7 @@ static inline void selinux_netlbl_sk_security_clone( }static inline int selinux_netlbl_skbuff_getsid (struct sk_buff *skb, +u16 family,u32 base_sid,u32 *sid) {
@@ -106,6 +111,7 @@ static inline int selinux_netlbl_inode_permission(struct inode *inode, }static inline int selinux_netlbl_sock_rcv_skb (struct sk_security_struct *sksec,struct sk_buff *skb, +u16 family,struct avc_audit_data *ad) {return 0 ;
security/selinux/netlabel.c +9 -3
@@ -141,6 +141,7 @@ void selinux_netlbl_sk_security_clone(struct sk_security_struct *ssec,/** * selinux_netlbl_skbuff_getsid - Get the sid of a packet using NetLabel * @skb: the packet +* @family: protocol family * @base_sid: the SELinux SID to use as a context for MLS only attributes * @sid: the SID *
@@ -150,7 +151,10 @@ void selinux_netlbl_sk_security_clone(struct sk_security_struct *ssec,* assign to the packet. Returns zero on success, negative values on failure. * */ -int selinux_netlbl_skbuff_getsid (struct sk_buff *skb,u32 base_sid,u32 *sid) +int selinux_netlbl_skbuff_getsid (struct sk_buff *skb, +u16 family, +u32 base_sid, +u32 *sid) {int rc;struct netlbl_lsm_secattr secattr;
@@ -161,7 +165,7 @@ int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, u32 base_sid, u32 *sid) }netlbl_secattr_init (&secattr); - rc =netlbl_skbuff_getattr (skb, &secattr); + rc =netlbl_skbuff_getattr (skb, family, &secattr);if (rc ==0 && secattr.flags !=NETLBL_SECATTR_NONE ) { rc =security_netlbl_secattr_to_sid (&secattr, base_sid, sid); if (rc == 0 &&
@@ -289,6 +293,7 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask)* selinux_netlbl_sock_rcv_skb - Do an inbound access check using NetLabel * @sksec: the sock's sk_security_struct * @skb: the packet +* @family: protocol family * @ad: the audit data * * Description:
@@ -299,6 +304,7 @@ int selinux_netlbl_inode_permission(struct inode *inode, int mask)*/ int selinux_netlbl_sock_rcv_skb (struct sk_security_struct *sksec,struct sk_buff *skb, +u16 family,struct avc_audit_data *ad) {int rc;
@@ -310,7 +316,7 @@ int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,return 0 ;netlbl_secattr_init (&secattr); - rc =netlbl_skbuff_getattr (skb, &secattr); + rc =netlbl_skbuff_getattr (skb, family, &secattr);if (rc ==0 && secattr.flags !=NETLBL_SECATTR_NONE ) { rc = security_netlbl_secattr_to_sid(&secattr, SECINITSID_NETMSG,
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 4/8 SELinux: Add a capabilities bitmap to SELinux policy version 22
In reply to Paul MooreAdd a new policy capabilities bitmap to SELinux policy version 22. This bitmap will enable the security server to query the policy to determine which features it supports.
---
security/selinux/Kconfig | 2 - security/selinux/include/security.h | 15 ++++++ security/selinux/selinuxfs.c | 89 +++++++++++++++++++++++++++++++++-- security/selinux/ss/policydb.c | 18 +++++++ security/selinux/ss/policydb.h | 2 + security/selinux/ss/services.c | 67 ++++++++++++++++++++++++++ 6 files changed, 185 insertions(+), 8 deletions(-)
security/selinux/Kconfig +1 -1
@@ -145,7 +145,7 @@ config SECURITY_SELINUX_POLICYDB_VERSION_MAX config SECURITY_SELINUX_POLICYDB_VERSION_MAX_VALUE int "NSA SELinux maximum supported policy format version value" depends on SECURITY_SELINUX_POLICYDB_VERSION_MAX - range 15 21 + range 15 22 default 19 help This option sets the value for the maximum policy format version
security/selinux/include/security.h +14 -1
@@ -25,13 +25,14 @@#define POLICYDB_VERSION_MLS 19#define POLICYDB_VERSION_AVTAB 20#define POLICYDB_VERSION_RANGETRANS 21 +#define POLICYDB_VERSION_POLCAP 22/* Range of policy versions we understand*/ #define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE#ifdef CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX #define POLICYDB_VERSION_MAX CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX_VALUE#else -#define POLICYDB_VERSION_MAX POLICYDB_VERSION_RANGETRANS +#define POLICYDB_VERSION_MAX POLICYDB_VERSION_POLCAP#endif struct netlbl_lsm_secattr ;
@@ -39,8 +40,19 @@ struct netlbl_lsm_secattr;extern int selinux_enabled;extern int selinux_mls_enabled; +/* Policy capabilities */ +enum { +POLICYDB_CAPABILITY_NETPEER , + __POLICYDB_CAPABILITY_MAX +}; +#define POLICYDB_CAPABILITY_MAX (__POLICYDB_CAPABILITY_MAX - 1) + +extern int selinux_policycap_netpeer; +int security_load_policy (void * data,size_t len); +int security_policycap_supported (unsigned int req_cap); +#define SEL_VEC_MAX 32struct av_decision {u32 allowed;
@@ -92,6 +104,7 @@ int security_get_classes(char ***classes, int *nclasses);int security_get_permissions (char *class,char ***perms,int *nperms);int security_get_reject_unknown (void );int security_get_allow_unknown (void ); +int security_get_policycaps (int *len,int **values);#define SECURITY_FS_USE_XATTR 1/* use xattr */ #define SECURITY_FS_USE_TRANS 2/* use transition SIDs, e.g. devpts/tmpfs */
security/selinux/selinuxfs.c +85 -4
143 lines not on this page · raw message
security/selinux/ss/policydb.c +17 -1
@@ -13,6 +13,11 @@* * Added conditional policy language extensions * +* Updated: Hewlett-Packard <[email protected]> +* +* Added support for the policy capability bitmap +* +* Copyright (C) 2007 Hewlett-Packard Development Company, L.P. * Copyright (C) 2004-2005 Trusted Computer Solutions, Inc. * Copyright (C) 2003 - 2004 Tresys Technology, LLC * This program is free software; you can redistribute it and/or modify
@@ -102,6 +107,11 @@ static struct policydb_compat_info policydb_compat[] = { .sym_num = SYM_NUM, .ocon_num = OCON_NUM, }, + { + .version = POLICYDB_VERSION_POLCAP, + .sym_num = SYM_NUM, + .ocon_num = OCON_NUM, + } };static struct policydb_compat_info *policydb_lookup_compat (int version)
@@ -183,6 +193,8 @@ static int policydb_init(struct policydb *p)if (rc) goto out_free_symtab; +ebitmap_init (&p->policycaps); + out:return rc;
@@ -673,8 +685,8 @@ void policydb_destroy(struct policydb *p)ebitmap_destroy (&p->type_attr_map[i]); }kfree (p->type_attr_map); -kfree (p->undefined_perms); +ebitmap_destroy (&p->policycaps);return ; }
@@ -1532,6 +1544,10 @@ int policydb_read(struct policydb *p, void *fp) p->reject_unknown = !!(le32_to_cpu (buf[1 ]) &REJECT_UNKNOWN ); p->allow_unknown = !!(le32_to_cpu (buf[1 ]) &ALLOW_UNKNOWN ); +if (p->policyvers >=POLICYDB_VERSION_POLCAP && +ebitmap_read (&p->policycaps, fp) !=0 ) + goto bad; + info =policydb_lookup_compat (p->policyvers);if (!info) { printk(KERN_ERR "security: unable to find policy compat info "
security/selinux/ss/policydb.h +2 -0
@@ -241,6 +241,8 @@ struct policydb {/* type -> attribute reverse mapping */ struct ebitmap *type_attr_map; +struct ebitmap policycaps; +unsigned int policyvers; unsigned int reject_unknown : 1;
security/selinux/ss/services.c +66 -1
108 lines not on this page · raw message
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 5/8 SELinux: Add new peer permissions to the Flask definitions
In reply to Paul MooreAdd additional Flask definitions to support the new "peer" object class.
---
security/selinux/include/av_perm_to_string.h | 3 +++ security/selinux/include/av_permissions.h | 3 +++ security/selinux/include/class_to_string.h | 7 +++++++ security/selinux/include/flask.h | 1 + 4 files changed, 14 insertions(+), 0 deletions(-)
security/selinux/include/av_perm_to_string.h +3 -0
@@ -159,3 +159,6 @@ S_(SECCLASS_DCCP_SOCKET, DCCP_SOCKET__NODE_BIND, "node_bind") S_(SECCLASS_DCCP_SOCKET, DCCP_SOCKET__NAME_CONNECT, "name_connect") S_(SECCLASS_MEMPROTECT, MEMPROTECT__MMAP_ZERO, "mmap_zero") + S_(SECCLASS_PEER, PEER__FLOW_IN, "flow_in") + S_(SECCLASS_PEER, PEER__FLOW_OUT, "flow_out") +S_ (SECCLASS_PEER ,PEER__RECV ,"recv" )
security/selinux/include/av_permissions.h +3 -0
@@ -824,3 +824,6 @@#define DCCP_SOCKET__NODE_BIND 0x00400000UL#define DCCP_SOCKET__NAME_CONNECT 0x00800000UL#define MEMPROTECT__MMAP_ZERO 0x00000001UL +#define PEER__FLOW_IN 0x00000001UL +#define PEER__FLOW_OUT 0x00000002UL +#define PEER__RECV 0x00000004UL
security/selinux/include/class_to_string.h +7 -0
@@ -64,3 +64,10 @@ S_(NULL) S_("dccp_socket") S_("memprotect") + S_(NULL) + S_(NULL) + S_(NULL) + S_(NULL) + S_(NULL) + S_(NULL) + S_("peer")
security/selinux/include/flask.h +1 -0
@@ -50,6 +50,7 @@#define SECCLASS_KEY 58#define SECCLASS_DCCP_SOCKET 60#define SECCLASS_MEMPROTECT 61 +#define SECCLASS_PEER 68/* * Security identifier indices for initial entities
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 6/8 SELinux: Better integration between peer labeling subsystems
In reply to Paul MooreRename the existing selinux_skb_extlbl_sid() function to selinux_skb_peerlbl_sid() and modify it's behavior such that it now reconciles multiple peer/external labels and if reconciliation is not possible it returns an error to the caller.
---
security/selinux/hooks.c | 90 +++++++++++++++++++++-------------- security/selinux/include/security.h | 2 + security/selinux/ss/services.c | 79 +++++++++++++++++++++++++++++++ 3 files changed, 136 insertions(+), 35 deletions(-)
security/selinux/hooks.c +55 -35
@@ -3190,36 +3190,35 @@ static int selinux_parse_skb(struct sk_buff *skb, struct avc_audit_data *ad, }/** -* selinux_skb_extlbl_sid - Determine the external label of a packet +* selinux_skb_peerlbl_sid - Determine the peer label of a packet * @skb: the packet * @family: protocol family -* @sid: the packet's SID +* @sid: the packet's peer label SID * * Description: -* Check the various different forms of external packet labeling and determine -* the external SID for the packet. If only one form of external labeling is -* present then it is used, if both labeled IPsec and NetLabel labels are -* present then the SELinux type information is taken from the labeled IPsec -* SA and the MLS sensitivity label information is taken from the NetLabel -* security attributes. This bit of "magic" is done in the call to -* selinux_netlbl_skbuff_getsid(). +* Check the various different forms of network peer labeling and determine +* the peer label/SID for the packet; most of the magic actually occurs in +* the security server function security_net_peersid_cmp(). The function +* returns zero if the value in @sid is valid (although it may be SECSID_NULL) +* or -EACCES if @sid is invalid due to inconsistencies with the different +* peer labels. * */ -static void selinux_skb_extlbl_sid (struct sk_buff *skb, -u16 family, -u32 *sid) +static int selinux_skb_peerlbl_sid (struct sk_buff *skb,u16 family,u32 *sid) {u32 xfrm_sid;u32 nlbl_sid;selinux_skb_xfrm_sid (skb, &xfrm_sid); -if (selinux_netlbl_skbuff_getsid (skb, - family, - (xfrm_sid ==SECSID_NULL ? -SECINITSID_NETMSG : xfrm_sid), - &nlbl_sid) !=0 ) - nlbl_sid =SECSID_NULL ; - *sid = (nlbl_sid ==SECSID_NULL ? xfrm_sid : nlbl_sid); +selinux_netlbl_skbuff_getsid (skb, + family, +SECINITSID_NETMSG , + &nlbl_sid); + +if (security_net_peersid_resolve (nlbl_sid, xfrm_sid, sid) !=0 ) +return -EACCES ; + +return 0 ; }/* socket security operations */
@@ -3674,17 +3673,32 @@ out:return err; } +static int selinux_sock_recv_peer_compat (struct sk_security_struct *sksec, +struct sk_buff *skb, +u16 family, +struct avc_audit_data ad) +{ +int err; + + err =selinux_netlbl_sock_rcv_skb (sksec, skb, family, &ad); +if (err) +return err; + +return selinux_xfrm_sock_rcv_skb (sksec->sid, skb, &ad); +} +static int selinux_socket_sock_rcv_skb (struct sock *sk,struct sk_buff *skb) { -u16 family; +u16 family = sk->sk_family;char *addrp; -int len, err =0 ; +int len; +int err;struct avc_audit_data ad;struct sk_security_struct *sksec = sk->sk_security; +int peer_sid; - family = sk->sk_family;if (family !=PF_INET && family !=PF_INET6 ) - goto out; +return 0 ;/* Handle mapped IPv4 packets arriving via IPv6 sockets */ if (family ==PF_INET6 && skb->protocol ==htons (ETH_P_IP ))
@@ -3693,10 +3707,14 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)AVC_AUDIT_DATA_INIT (&ad,NET ); ad.u.net.netif = skb->dev ? skb->dev->name :"[unknown]" ; ad.u.net.family = family; - err =selinux_parse_skb (skb, &ad, &addrp, &len,1 ,NULL );if (err) - goto out; +return err; + +/* Between selinux_compat_net and selinux_policycap_netpeer this is +* starting to get a bit messy - we need to setup a timetable for +* deprecating some of this old/obsolete functionality so we can +* reclaim some level of sanity in this function. */ if (selinux_compat_net) err = selinux_sock_rcv_skb_compat(sk, skb, &ad, family,
@@ -3705,15 +3723,15 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb) err =avc_has_perm (sksec->sid, skb->secmark,SECCLASS_PACKET ,PACKET__RECV , &ad);if (err) - goto out; +return err; - err =selinux_netlbl_sock_rcv_skb (sksec, skb, family, &ad); +if (!selinux_policycap_netpeer) +return selinux_sock_recv_peer_compat (sksec, skb, family, ad); + err =selinux_skb_peerlbl_sid (skb, family, &peer_sid);if (err) - goto out; - - err =selinux_xfrm_sock_rcv_skb (sksec->sid, skb, &ad); -out: -return err; +return err; +return avc_has_perm (sksec->sid, peer_sid, +SECCLASS_PEER ,PEER__RECV , &ad); } static int selinux_socket_getpeersec_stream(struct socket *sock, char __user *optval,
@@ -3776,7 +3794,7 @@ static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *if (sock && family ==PF_UNIX )selinux_get_inode_sid (SOCK_INODE (sock), &peer_secid);else if (skb) -selinux_skb_extlbl_sid (skb, family, &peer_secid); +selinux_skb_peerlbl_sid (skb, family, &peer_secid);if (peer_secid ==SECSID_NULL ) err = -EINVAL ;
@@ -3837,7 +3855,9 @@ static int selinux_inet_conn_request(struct sock *sk, struct sk_buff *skb,u32 newsid;u32 peersid; -selinux_skb_extlbl_sid (skb, sk->sk_family, &peersid); + err =selinux_skb_peerlbl_sid (skb, sk->sk_family, &peersid); +if (err) +return err;if (peersid ==SECSID_NULL ) { req->secid = sksec->sid; req->peer_secid =SECSID_NULL ;
@@ -3875,7 +3895,7 @@ static void selinux_inet_conn_established(struct sock *sk, {struct sk_security_struct *sksec = sk->sk_security; -selinux_skb_extlbl_sid (skb, sk->sk_family, &sksec->peer_sid); +selinux_skb_peerlbl_sid (skb, sk->sk_family, &sksec->peer_sid); } static void selinux_req_classify_flow(const struct request_sock *req,
security/selinux/include/security.h +2 -0
@@ -100,6 +100,8 @@ int security_validate_transition(u32 oldsid, u32 newsid, u32 tasksid,int security_sid_mls_copy (u32 sid,u32 mls_sid,u32 *new_sid); +int security_net_peersid_resolve (u32 nlbl_sid,u32 xfrm_sid,u32 *peer_sid); +int security_get_classes (char ***classes,int *nclasses);int security_get_permissions (char *class,char ***perms,int *nperms);int security_get_reject_unknown (void );
security/selinux/ss/services.c +79 -0
85 lines not on this page · raw message
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 7/8 SELinux: Enable dynamic enable/disable of the network access checks
In reply to Paul MooreThis patch introduces a mechanism for checking when labeled IPsec or SECMARK are in use by keeping introducing a configuration reference counter for each subsystem. In the case of labeled IPsec, whenever a labeled SA or SPD entry is created the labeled IPsec/XFRM reference count is increased and when the entry is removed it is decreased. In the case of SECMARK, when a SECMARK target is created the reference count is increased and later decreased when the target is removed. These reference counters allow SELinux to quickly determine if either of these subsystems are enabled.
NetLabel already has a similar mechanism which provides the netlbl_enabled() function.
This patch also renames the selinux_relabel_packet_permission() function to selinux_secmark_relabel_packet_permission() as the original name and description were misleading in that they referenced a single packet label which is not the case.
---
include/linux/selinux.h | 45 +++++++++++++++++++++++++----- net/netfilter/xt_SECMARK.c | 13 ++++++++- security/selinux/exports.c | 25 +++++++++++++++-- security/selinux/hooks.c | 32 +++++++++++++++++++++- security/selinux/include/xfrm.h | 2 + security/selinux/xfrm.c | 58 ++++++++++++++++++++++++++++++++++++++- 6 files changed, 161 insertions(+), 14 deletions(-)
include/linux/selinux.h +37 -8
@@ -120,16 +120,35 @@ void selinux_get_task_sid(struct task_struct *tsk, u32 *sid);int selinux_string_to_sid (char *str,u32 *sid);/** -* selinux_relabel_packet_permission - check permission to relabel a packet -* @sid: ID value to be applied to network packet (via SECMARK, most likely) +* selinux_secmark_relabel_packet_permission - secmark permission check +* @sid: SECMARK ID value to be applied to network packet * -* Returns 0 if the current task is allowed to label packets with the -* supplied security ID. Note that it is implicit that the packet is always -* being relabeled from the default unlabled value, and that the access -* control decision is made in the AVC. +* Returns 0 if the current task is allowed to set the SECMARK label of +* packets with the supplied security ID. Note that it is implicit that +* the packet is always being relabeled from the default unlabeled value, +* and that the access control decision is made in the AVC. */ -int selinux_relabel_packet_permission (u32 sid); +int selinux_secmark_relabel_packet_permission (u32 sid); +/** +* selinux_secmark_refcount_inc - increments the secmark use counter +* +* SELinux keeps track of the current SECMARK targets in use so it knows +* when to apply SECMARK label access checks to network packets. This +* function incements this reference count to indicate that a new SECMARK +* target has been configured. +*/ +void selinux_secmark_refcount_inc (void ); + +/** +* selinux_secmark_refcount_dec - decrements the secmark use counter +* +* SELinux keeps track of the current SECMARK targets in use so it knows +* when to apply SECMARK label access checks to network packets. This +* function decements this reference count to indicate that one of the +* existing SECMARK targets has been removed/flushed. +*/ +void selinux_secmark_refcount_dec (void );#else static inline int selinux_audit_rule_init(u32 field, u32 op,
@@ -184,11 +203,21 @@ static inline int selinux_string_to_sid(const char *str, u32 *sid)return 0 ; } -static inline int selinux_relabel_packet_permission (u32 sid) +static inline int selinux_secmark_relabel_packet_permission (u32 sid) {return 0 ; } +static inline void selinux_secmark_refcount_inc (void ) +{ +return ; +} + +static inline void selinux_secmark_refcount_dec (void ) +{ +return ; +} +#endif /* CONFIG_SECURITY_SELINUX */ #endif /* _LINUX_SELINUX_H */
net/netfilter/xt_SECMARK.c +12 -1
@@ -72,12 +72,13 @@ static bool checkentry_selinux(struct xt_secmark_target_info *info)return false; } - err =selinux_relabel_packet_permission (sel->selsid); + err =selinux_secmark_relabel_packet_permission (sel->selsid);if (err) { printk(KERN_INFO PFX "unable to obtain relabeling permission\n");return false; } +selinux_secmark_refcount_inc ();return true; }
@@ -109,11 +110,20 @@ static bool checkentry(const char *tablename, const void *entry,return true; } +void destroy (const struct xt_target *target,void *targinfo) +{ +switch (mode) { +case SECMARK_MODE_SEL : +selinux_secmark_refcount_dec (); + } +} +static struct xt_target xt_secmark_target[]__read_mostly = { { .name ="SECMARK" , .family =AF_INET , .checkentry = checkentry, + .destroy = destroy, .target = target, .targetsize =sizeof (struct xt_secmark_target_info ), .table ="mangle" ,
@@ -123,6 +133,7 @@ static struct xt_target xt_secmark_target[] __read_mostly = { .name = "SECMARK", .family = AF_INET6, .checkentry = checkentry, + .destroy = destroy, .target = target, .targetsize = sizeof(struct xt_secmark_target_info), .table = "mangle",
security/selinux/exports.c +23 -2
@@ -17,10 +17,15 @@#include <linux/selinux.h> #include <linux/fs.h> #include <linux/ipc.h> +#include <linux/spinlock.h> #include "security.h" #include "objsec.h" +/* SECMARK reference count */ +static DEFINE_SPINLOCK (selinux_secmark_refcount_lock); +extern u32 selinux_secmark_refcount; +int selinux_sid_to_string (u32 sid,char **ctx,u32 *ctxlen) {if (selinux_enabled)
@@ -74,7 +79,7 @@ int selinux_string_to_sid(char *str, u32 *sid) }EXPORT_SYMBOL_GPL (selinux_string_to_sid); -int selinux_relabel_packet_permission (u32 sid) +int selinux_secmark_relabel_packet_permission (u32 sid) {if (selinux_enabled) {struct task_security_struct *tsec = current->security;
@@ -84,4 +89,20 @@ int selinux_relabel_packet_permission(u32 sid) }return 0 ; } -EXPORT_SYMBOL_GPL (selinux_relabel_packet_permission); +EXPORT_SYMBOL_GPL (selinux_secmark_relabel_packet_permission); + +void selinux_secmark_refcount_inc (void ) +{ +spin_lock (&selinux_secmark_refcount_lock); + selinux_secmark_refcount++; +spin_unlock (&selinux_secmark_refcount_lock); +} +EXPORT_SYMBOL_GPL (selinux_secmark_refcount_inc); + +void selinux_secmark_refcount_dec (void ) +{ +spin_lock (&selinux_secmark_refcount_lock); + selinux_secmark_refcount--; +spin_unlock (&selinux_secmark_refcount_lock); +} +EXPORT_SYMBOL_GPL (selinux_secmark_refcount_dec);
security/selinux/hooks.c +31 -1
@@ -50,6 +50,7 @@#include <net/icmp.h> #include <net/ip.h> /* for local_port_range[] */ #include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */ +#include <net/netlabel.h> #include <asm/uaccess.h> #include <asm/ioctls.h> #include <linux/bitops.h>
@@ -87,6 +88,12 @@ extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);extern int selinux_compat_net;extern struct security_operations *security_ops; +/* SECMARK reference count +* This reference counter is read-only via RCU (see selinux_secmark_enabled()) +* in this file, it is updated by the selinux_secmark_refcount_[inc|dec]() +* functions with spinlocks providing write protection. */ +u32 selinux_secmark_refcount =0 ; +#ifdef CONFIG_SECURITY_SELINUX_DEVELOP int selinux_enforcing =0 ;
@@ -153,6 +160,27 @@ getsecurity_exit:return len; } +/** +* selinux_secmark_enabled - Check to see if SECMARK is currently enabled +* +* Description: +* This function checks the SECMARK reference counter to see if any SECMARK +* targets are currently configured, if the reference counter is greater than +* zero SECMARK is considered to be enabled. Returns true (1) if SECMARK is +* enabled, false (0) if SECMARK is disabled. +* +*/ +static int selinux_secmark_enabled (void ) +{ +int rc; + +rcu_read_lock (); + rc = (selinux_secmark_refcount >0 ?1 :0 ); +rcu_read_unlock (); + +return rc; +} +/* Allocate and free functions for each kind of security blob. */ static int task_alloc_security (struct task_struct *task)
@@ -3719,7 +3747,7 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)if (selinux_compat_net) err =selinux_sock_rcv_skb_compat (sk, skb, &ad, family, addrp, len); -else +else if (!selinux_policycap_netpeer ||selinux_secmark_enabled ()) err =avc_has_perm (sksec->sid, skb->secmark,SECCLASS_PACKET ,PACKET__RECV , &ad);if (err)
@@ -3727,6 +3755,8 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)if (!selinux_policycap_netpeer)return selinux_sock_recv_peer_compat (sksec, skb, family, ad); +if (!netlbl_enabled () && !selinux_xfrm_enabled ()) +return 0 ; err =selinux_skb_peerlbl_sid (skb, family, &peer_sid);if (err)return err;
security/selinux/include/xfrm.h +2 -0
@@ -7,6 +7,8 @@#ifndef _SELINUX_XFRM_H_#define _SELINUX_XFRM_H_ +int selinux_xfrm_enabled (void ); +int selinux_xfrm_policy_alloc (struct xfrm_policy *xp,struct xfrm_user_sec_ctx *sec_ctx);int selinux_xfrm_policy_clone (struct xfrm_policy *old,struct xfrm_policy *new);
security/selinux/xfrm.c +56 -2
106 lines not on this page · raw message
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
RFC PATCH v5 8/8 SELinux: allow NetLabel to directly cache SIDs
In reply to Paul MooreNow that the SELinux NetLabel "base SID" is always the netmsg initial SID we can do a big optimization - caching the SID and not just the MLS attributes. This not only saves a lot of per-packet memory allocations and copies but it has a nice side effect of removing a chunk of code.
---
security/selinux/hooks.c | 5 - security/selinux/include/netlabel.h | 6 -- security/selinux/include/security.h | 2 - security/selinux/netlabel.c | 55 ++++++++++------ security/selinux/ss/services.c | 124 ++++++----------------------------- 5 files changed, 56 insertions(+), 136 deletions(-)
security/selinux/hooks.c +1 -4
@@ -3238,10 +3238,7 @@ static int selinux_skb_peerlbl_sid(struct sk_buff *skb, u16 family, u32 *sid)u32 nlbl_sid;selinux_skb_xfrm_sid (skb, &xfrm_sid); -selinux_netlbl_skbuff_getsid (skb, - family, -SECINITSID_NETMSG , - &nlbl_sid); +selinux_netlbl_skbuff_getsid (skb, family, &nlbl_sid);if (security_net_peersid_resolve (nlbl_sid, xfrm_sid, sid) !=0 )return -EACCES ;
security/selinux/include/netlabel.h +1 -5
@@ -46,10 +46,7 @@ void selinux_netlbl_sk_security_init(struct sk_security_struct *ssec,void selinux_netlbl_sk_security_clone (struct sk_security_struct *ssec,struct sk_security_struct *newssec); -int selinux_netlbl_skbuff_getsid (struct sk_buff *skb, -u16 family, -u32 base_sid, -u32 *sid); +int selinux_netlbl_skbuff_getsid (struct sk_buff *skb,u16 family,u32 *sid);void selinux_netlbl_sock_graft (struct sock *sk,struct socket *sock);int selinux_netlbl_socket_post_create (struct socket *sock);
@@ -88,7 +85,6 @@ static inline void selinux_netlbl_sk_security_clone(static inline int selinux_netlbl_skbuff_getsid (struct sk_buff *skb,u16 family, -u32 base_sid,u32 *sid) { *sid =SECSID_NULL ;
security/selinux/include/security.h +0 -2
@@ -123,7 +123,6 @@ int security_genfs_sid(const char *fstype, char *name, u16 sclass,#ifdef CONFIG_NETLABEL int security_netlbl_secattr_to_sid (struct netlbl_lsm_secattr *secattr, -u32 base_sid,u32 *sid); int security_netlbl_sid_to_secattr(u32 sid,
@@ -131,7 +130,6 @@ int security_netlbl_sid_to_secattr(u32 sid,#else static inline int security_netlbl_secattr_to_sid (struct netlbl_lsm_secattr *secattr, -u32 base_sid,u32 *sid) {return -EIDRM ;
security/selinux/netlabel.c +34 -21
91 lines not on this page · raw message
security/selinux/ss/services.c +20 -104
180 lines not on this page · raw message
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.