* [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able
@ 2007-10-05 19:32 Paul Moore
2007-10-05 19:32 ` [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22 Paul Moore
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Paul Moore @ 2007-10-05 19:32 UTC (permalink / raw)
To: selinux
I've updated the first two patches in this series based on Eric's comments
(thanks again Eric) and added a new patch which provides a way to determine if
labeled IPsec and SECMARK have been configured. If they have been actively
configured we assume that they are enabled. This is similar to the existing
netlbl_enabled() function and should allow us to dynamically enable/disable
the network access controls when using the new flow control checks as well the
local packet receive check when the new controls are active (i.e. new policy).
The SECMARK changes here are a bit on the ugly side, but due to it's ability to
be compiled as a module are options are somewhat limited. If anyone has some
great ideas on the topic I'd love to hear them.
I've also updated the git tree for those of you who prefer to look at things
that way:
* git://git.infradead.org/users/pcmoore/lblnet-2.6_testing
--
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22
2007-10-05 19:32 [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able Paul Moore
@ 2007-10-05 19:32 ` Paul Moore
2007-10-10 18:16 ` Stephen Smalley
2007-10-05 19:32 ` [RFC PATCH v4 2/3] [SELinux] Better integration between peer labeling subsystems Paul Moore
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Paul Moore @ 2007-10-05 19:32 UTC (permalink / raw)
To: selinux
Add 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 | 62 ++++++++++++++++++++++++
6 files changed, 181 insertions(+), 7 deletions(-)
diff --git a/security/selinux/Kconfig b/security/selinux/Kconfig
index b32a459..2b517d6 100644
--- a/security/selinux/Kconfig
+++ b/security/selinux/Kconfig
@@ -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
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index 83bdd4d..cc53ce4 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -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 32
struct av_decision {
u32 allowed;
@@ -90,6 +102,7 @@ int security_sid_mls_copy(u32 sid, u32 mls_sid, u32 *new_sid);
int security_get_classes(char ***classes, int *nclasses);
int security_get_permissions(char *class, char ***perms, int *nperms);
+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 */
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index c9e92da..3baeae8 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -2,6 +2,11 @@
*
* Added conditional policy language extensions
*
+ * Updated: Hewlett-Packard <paul.moore@hp.com>
+ *
+ * Added support for the policy capability bitmap
+ *
+ * Copyright (C) 2007 Hewlett-Packard Development Company, L.P.
* Copyright (C) 2003 - 2004 Tresys Technology, LLC
* Copyright (C) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
* This program is free software; you can redistribute it and/or modify
@@ -35,6 +40,11 @@
#include "objsec.h"
#include "conditional.h"
+/* Policy capability filenames */
+static char *policycap_names[] = {
+ "network_peer_controls"
+};
+
unsigned int selinux_checkreqprot = CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE;
#ifdef CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT
@@ -71,6 +81,9 @@ static int *bool_pending_values = NULL;
static struct dentry *class_dir = NULL;
static unsigned long last_class_ino;
+/* global data for policy capabilities */
+static struct dentry *policycap_dir = NULL;
+
extern void selnl_notify_setenforce(int val);
/* Check whether a task is allowed to use a security operation. */
@@ -108,10 +121,11 @@ enum sel_inos {
static unsigned long sel_last_ino = SEL_INO_NEXT - 1;
-#define SEL_INITCON_INO_OFFSET 0x01000000
-#define SEL_BOOL_INO_OFFSET 0x02000000
-#define SEL_CLASS_INO_OFFSET 0x04000000
-#define SEL_INO_MASK 0x00ffffff
+#define SEL_INITCON_INO_OFFSET 0x01000000
+#define SEL_BOOL_INO_OFFSET 0x02000000
+#define SEL_CLASS_INO_OFFSET 0x04000000
+#define SEL_POLICYCAP_INO_OFFSET 0x08000000
+#define SEL_INO_MASK 0x00ffffff
#define TMPBUFLEN 12
static ssize_t sel_read_enforce(struct file *filp, char __user *buf,
@@ -243,6 +257,7 @@ static const struct file_operations sel_policyvers_ops = {
/* declaration for sel_write_load */
static int sel_make_bools(void);
static int sel_make_classes(void);
+static int sel_make_policycap(void);
/* declaration for sel_make_class_dirs */
static int sel_make_dir(struct inode *dir, struct dentry *dentry,
@@ -303,6 +318,12 @@ static ssize_t sel_write_load(struct file * file, const char __user * buf,
}
ret = sel_make_classes();
+ if (ret) {
+ length = ret;
+ goto out1;
+ }
+
+ ret = sel_make_policycap();
if (ret)
length = ret;
else
@@ -1384,6 +1405,24 @@ static const struct file_operations sel_perm_ops = {
.read = sel_read_perm,
};
+static ssize_t sel_read_policycap(struct file *file, char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ int value;
+ char tmpbuf[TMPBUFLEN];
+ ssize_t length;
+ unsigned long i_ino = file->f_path.dentry->d_inode->i_ino;
+
+ value = security_policycap_supported(i_ino & SEL_INO_MASK);
+ length = scnprintf(tmpbuf, TMPBUFLEN, "%d", value);
+
+ return simple_read_from_buffer(buf, count, ppos, tmpbuf, length);
+}
+
+static const struct file_operations sel_policycap_ops = {
+ .read = sel_read_policycap,
+};
+
static int sel_make_perm_files(char *objclass, int classvalue,
struct dentry *dir)
{
@@ -1530,6 +1569,36 @@ out:
return rc;
}
+static int sel_make_policycap(void)
+{
+ unsigned int iter;
+ struct dentry *dentry = NULL;
+ struct inode *inode = NULL;
+
+ sel_remove_entries(policycap_dir);
+
+ for (iter = 0; iter <= POLICYDB_CAPABILITY_MAX; iter++) {
+ if (iter < ARRAY_SIZE(policycap_names))
+ dentry = d_alloc_name(policycap_dir,
+ policycap_names[iter]);
+ else
+ dentry = d_alloc_name(policycap_dir, "unknown");
+
+ if (dentry == NULL)
+ return -ENOMEM;
+
+ inode = sel_make_inode(policycap_dir->d_sb, S_IFREG | S_IRUGO);
+ if (inode == NULL)
+ return -ENOMEM;
+
+ inode->i_fop = &sel_policycap_ops;
+ inode->i_ino = iter | SEL_POLICYCAP_INO_OFFSET;
+ d_add(dentry, inode);
+ }
+
+ return 0;
+}
+
static int sel_make_dir(struct inode *dir, struct dentry *dentry,
unsigned long *ino)
{
@@ -1656,6 +1725,18 @@ static int sel_fill_super(struct super_block * sb, void * data, int silent)
class_dir = dentry;
+ dentry = d_alloc_name(sb->s_root, "policy_capabilities");
+ if (!dentry) {
+ ret = -ENOMEM;
+ goto err;
+ }
+
+ ret = sel_make_dir(root_inode, dentry, &sel_last_ino);
+ if (ret)
+ goto err;
+
+ policycap_dir = dentry;
+
out:
return ret;
err:
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index f05f97a..4c82a83 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -13,6 +13,11 @@
*
* Added conditional policy language extensions
*
+ * Updated: Hewlett-Packard <paul.moore@hp.com>
+ *
+ * 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_avtab;
+ ebitmap_init(&p->policycaps);
+
out:
return rc;
@@ -677,6 +689,8 @@ void policydb_destroy(struct policydb *p)
}
kfree(p->type_attr_map);
+ ebitmap_destroy(&p->policycaps);
+
return;
}
@@ -1531,6 +1545,10 @@ int policydb_read(struct policydb *p, void *fp)
}
}
+ 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 "
diff --git a/security/selinux/ss/policydb.h b/security/selinux/ss/policydb.h
index 8319d5f..e621048 100644
--- a/security/selinux/ss/policydb.h
+++ b/security/selinux/ss/policydb.h
@@ -241,6 +241,8 @@ struct policydb {
/* type -> attribute reverse mapping */
struct ebitmap *type_attr_map;
+ struct ebitmap policycaps;
+
unsigned int policyvers;
};
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 6100fc0..7059400 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -16,12 +16,13 @@
* Updated: Hewlett-Packard <paul.moore@hp.com>
*
* Added support for NetLabel
+ * Added support for the policy capability bitmap
*
* Updated: Chad Sellers <csellers@tresys.com>
*
* Added validation of kernel classes and permissions
*
- * Copyright (C) 2006 Hewlett-Packard Development Company, L.P.
+ * Copyright (C) 2006 - 2007 Hewlett-Packard Development Company, L.P.
* Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
* Copyright (C) 2003 - 2004, 2006 Tresys Technology, LLC
* Copyright (C) 2003 Red Hat, Inc., James Morris <jmorris@redhat.com>
@@ -59,6 +60,8 @@
extern void selnl_notify_policyload(u32 seqno);
unsigned int policydb_loaded_version;
+int selinux_policycap_netpeer;
+
/*
* This is declared in avc.c
*/
@@ -1304,6 +1307,9 @@ int security_load_policy(void *data, size_t len)
return -EINVAL;
}
policydb_loaded_version = policydb.policyvers;
+ selinux_policycap_netpeer =
+ ebitmap_get_bit(&policydb.policycaps,
+ POLICYDB_CAPABILITY_NETPEER);
ss_initialized = 1;
seqno = ++latest_granting;
LOAD_UNLOCK;
@@ -2102,6 +2108,60 @@ err:
return rc;
}
+/**
+ * security_get_policycaps - Query the loaded policy for its capabilities
+ * @len: the number of capability bits
+ * @values: the capability bit array
+ *
+ * Description:
+ * Get an array of the policy capabilities in @values where each entry in
+ * @values is either true (1) or false (0) depending the policy's support of
+ * that feature. The policy capabilities are defined by the
+ * POLICYDB_CAPABILITY_* enums. The size of the array is stored in @len and it
+ * is up to the caller to free the array in @values. Returns zero on success,
+ * negative values on failure.
+ *
+ */
+int security_get_policycaps(int *len, int **values)
+{
+ int rc = -ENOMEM;
+ unsigned int iter;
+
+ POLICY_RDLOCK;
+
+ *values = kcalloc(POLICYDB_CAPABILITY_MAX, sizeof(int), GFP_ATOMIC);
+ if (*values == NULL)
+ goto out;
+ for (iter = 0; iter < POLICYDB_CAPABILITY_MAX; iter++)
+ (*values)[iter] = ebitmap_get_bit(&policydb.policycaps, iter);
+ *len = POLICYDB_CAPABILITY_MAX;
+
+out:
+ POLICY_RDUNLOCK;
+ return rc;
+}
+
+/**
+ * security_policycap_supported - Check for a specific policy capability
+ * @req_cap: capability
+ *
+ * Description:
+ * This function queries the currently loaded policy to see if it supports the
+ * capability specified by @req_cap. Returns true (1) if the capability is
+ * supported, false (0) if it isn't supported.
+ *
+ */
+int security_policycap_supported(unsigned int req_cap)
+{
+ int rc;
+
+ POLICY_RDLOCK;
+ rc = ebitmap_get_bit(&policydb.policycaps, req_cap);
+ POLICY_RDUNLOCK;
+
+ return rc;
+}
+
struct selinux_audit_rule {
u32 au_seqno;
struct context au_ctxt;
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH v4 2/3] [SELinux] Better integration between peer labeling subsystems
2007-10-05 19:32 [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able Paul Moore
2007-10-05 19:32 ` [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22 Paul Moore
@ 2007-10-05 19:32 ` Paul Moore
2007-10-05 19:33 ` [RFC PATCH v4 3/3] [SELinux] Enable dynamic enable/disable of the network access checks Paul Moore
2007-10-07 21:53 ` [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able James Morris
3 siblings, 0 replies; 11+ messages in thread
From: Paul Moore @ 2007-10-05 19:32 UTC (permalink / raw)
To: selinux
Rename 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 | 42 ++++++++++---------
security/selinux/include/security.h | 2 +
security/selinux/ss/services.c | 79 +++++++++++++++++++++++++++++++++++
3 files changed, 104 insertions(+), 19 deletions(-)
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 0753b20..9923c01 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3132,32 +3132,31 @@ 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
- * @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, u32 *sid)
+static int selinux_skb_peerlbl_sid(struct sk_buff *skb, u32 *sid)
{
u32 xfrm_sid;
u32 nlbl_sid;
selinux_skb_xfrm_sid(skb, &xfrm_sid);
- if (selinux_netlbl_skbuff_getsid(skb,
- (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, SECINITSID_NETMSG, &nlbl_sid);
+
+ if (security_net_peersid_resolve(nlbl_sid, xfrm_sid, sid) != 0)
+ return -EACCES;
+
+ return 0;
}
/* socket security operations */
@@ -3640,6 +3639,9 @@ static int selinux_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (err)
goto out;
+ /* XXX - make use of selinux_skb_peerlbl_sid() here but only once we
+ * have the new peer object class in place */
+
err = selinux_netlbl_sock_rcv_skb(sksec, skb, &ad);
if (err)
goto out;
@@ -3701,7 +3703,7 @@ static int selinux_socket_getpeersec_dgram(struct socket *sock, struct sk_buff *
if (sock && sock->sk->sk_family == PF_UNIX)
selinux_get_inode_sid(SOCK_INODE(sock), &peer_secid);
else if (skb)
- selinux_skb_extlbl_sid(skb, &peer_secid);
+ selinux_skb_peerlbl_sid(skb, &peer_secid);
if (peer_secid == SECSID_NULL)
err = -EINVAL;
@@ -3762,7 +3764,9 @@ static int selinux_inet_conn_request(struct sock *sk, struct sk_buff *skb,
u32 newsid;
u32 peersid;
- selinux_skb_extlbl_sid(skb, &peersid);
+ err = selinux_skb_peerlbl_sid(skb, &peersid);
+ if (err)
+ return err;
if (peersid == SECSID_NULL) {
req->secid = sksec->sid;
req->peer_secid = SECSID_NULL;
@@ -3800,7 +3804,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_peerlbl_sid(skb, &sksec->peer_sid);
}
static void selinux_req_classify_flow(const struct request_sock *req,
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index cc53ce4..f193693 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -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_policycaps(int *len, int **values);
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index 7059400..338aa09 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -2013,6 +2013,85 @@ out:
return rc;
}
+/**
+ * security_net_peersid_resolve - Compare and resolve two network peer SIDs
+ * @nlbl_sid: NetLabel SID
+ * @xfrm_sid: XFRM SID
+ *
+ * Description:
+ * Compare the @nlbl_sid and @xfrm_sid values and if the two SIDs can be
+ * resolved into a single SID it is returned via @peer_sid and the function
+ * returns zero. Otherwise @peer_sid is set to SECSID_NULL and the function
+ * returns a negative value. A table summarizing the behavior is below:
+ *
+ * | function return | @sid
+ * ------------------------------+-----------------+-----------------
+ * no peer labels | 0 | SECSID_NULL
+ * single peer label | 0 | <peer_label>
+ * multiple, consistent labels | 0 | <peer_label>
+ * multiple, inconsistent labels | -<errno> | SECSID_NULL
+ *
+ */
+int security_net_peersid_resolve(u32 nlbl_sid, u32 xfrm_sid, u32 *peer_sid)
+{
+ int rc;
+ struct context *nlbl_ctx;
+ struct context *xfrm_ctx;
+
+ /* handle the common (which also happens to be the set of easy) cases
+ * right away, these two if statements catch everything involving a
+ * single or absent peer SID/label */
+ if (xfrm_sid == SECSID_NULL) {
+ *peer_sid = nlbl_sid;
+ return 0;
+ }
+ if (nlbl_sid == SECSID_NULL) {
+ *peer_sid = xfrm_sid;
+ return 0;
+ }
+
+ /* we don't need to check ss_initialized here since the only way both
+ * nlbl_sid and xfrm_sid are not equal to SECSID_NULL would be if the
+ * security server was initialized and ss_initialized was true */
+ if (!selinux_mls_enabled) {
+ *peer_sid = SECSID_NULL;
+ return 0;
+ }
+
+ POLICY_RDLOCK;
+
+ nlbl_ctx = sidtab_search(&sidtab, nlbl_sid);
+ if (!nlbl_ctx) {
+ printk(KERN_ERR
+ "security_sid_mls_cmp: unrecognized SID %d\n",
+ nlbl_sid);
+ rc = -EINVAL;
+ goto out_slowpath;
+ }
+ xfrm_ctx = sidtab_search(&sidtab, xfrm_sid);
+ if (!xfrm_ctx) {
+ printk(KERN_ERR
+ "security_sid_mls_cmp: unrecognized SID %d\n",
+ xfrm_sid);
+ rc = -EINVAL;
+ goto out_slowpath;
+ }
+ rc = (mls_context_cmp(nlbl_ctx, xfrm_ctx) ? 0 : -EACCES);
+
+out_slowpath:
+ POLICY_RDUNLOCK;
+ if (rc == 0)
+ /* at present NetLabel SIDs/labels really only carry MLS
+ * information so if the MLS portion of the NetLabel SID
+ * matches the MLS portion of the labeled XFRM SID/label
+ * then pass along the XFRM SID as it has the most peer label
+ * information */
+ *peer_sid = xfrm_sid;
+ else
+ *peer_sid = SECSID_NULL;
+ return rc;
+}
+
static int get_classes_callback(void *k, void *d, void *args)
{
struct class_datum *datum = d;
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [RFC PATCH v4 3/3] [SELinux] Enable dynamic enable/disable of the network access checks
2007-10-05 19:32 [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able Paul Moore
2007-10-05 19:32 ` [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22 Paul Moore
2007-10-05 19:32 ` [RFC PATCH v4 2/3] [SELinux] Better integration between peer labeling subsystems Paul Moore
@ 2007-10-05 19:33 ` Paul Moore
2007-10-07 21:53 ` [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able James Morris
3 siblings, 0 replies; 11+ messages in thread
From: Paul Moore @ 2007-10-05 19:33 UTC (permalink / raw)
To: selinux
This 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 | 27 ++++++++++++++++++
security/selinux/include/xfrm.h | 2 +
security/selinux/xfrm.c | 58 ++++++++++++++++++++++++++++++++++++++-
6 files changed, 157 insertions(+), 13 deletions(-)
diff --git a/include/linux/selinux.h b/include/linux/selinux.h
index d1b7ca6..691170b 100644
--- a/include/linux/selinux.h
+++ b/include/linux/selinux.h
@@ -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 */
diff --git a/net/netfilter/xt_SECMARK.c b/net/netfilter/xt_SECMARK.c
index c83779a..18cd936 100644
--- a/net/netfilter/xt_SECMARK.c
+++ b/net/netfilter/xt_SECMARK.c
@@ -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",
diff --git a/security/selinux/exports.c b/security/selinux/exports.c
index b6f9694..eec5dd5 100644
--- a/security/selinux/exports.c
+++ b/security/selinux/exports.c
@@ -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);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 9923c01..857c05d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -85,6 +85,12 @@ extern unsigned int policydb_loaded_version;
extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
extern int selinux_compat_net;
+/* 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;
@@ -151,6 +157,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)
diff --git a/security/selinux/include/xfrm.h b/security/selinux/include/xfrm.h
index 31929e3..729d86e 100644
--- a/security/selinux/include/xfrm.h
+++ b/security/selinux/include/xfrm.h
@@ -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);
diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
index ba715f4..ad99350 100644
--- a/security/selinux/xfrm.c
+++ b/security/selinux/xfrm.c
@@ -43,6 +43,8 @@
#include <linux/tcp.h>
#include <linux/skbuff.h>
#include <linux/xfrm.h>
+#include <linux/spinlock.h>
+#include <linux/rcupdate.h>
#include <net/xfrm.h>
#include <net/checksum.h>
#include <net/udp.h>
@@ -52,6 +54,9 @@
#include "objsec.h"
#include "xfrm.h"
+/* Labeled XFRM instance counter */
+static DEFINE_SPINLOCK(selinux_xfrm_refcount_lock);
+static u32 selinux_xfrm_refcount = 0;
/*
* Returns true if an LSM/SELinux context
@@ -71,6 +76,44 @@ static inline int selinux_authorizable_xfrm(struct xfrm_state *x)
return selinux_authorizable_ctx(x->security);
}
+/**
+ * selinux_xfrm_enabled - Determine if labeled XFRM is enabled
+ *
+ * Description:
+ * This function checks to see if there are any labeled SAs or entries in the
+ * SPD. If there are then labeled XFRM is currently enabled, if not it is
+ * currently disabled. Returns true (1) if labeled XFRM is enabled, false (0)
+ * if labeled XFRM is disabled.
+ *
+ */
+int selinux_xfrm_enabled(void)
+{
+ int rc;
+
+ rcu_read_lock();
+ rc = (selinux_xfrm_refcount > 0 ? 1 : 0);
+ rcu_read_unlock();
+
+ return rc;
+}
+
+/**
+ * selinux_xfrm_refcount_adj - Adjust the labeled XFRM reference count
+ *
+ * Description:
+ * Adjust the labeled XFRM reference count which is used to determine if the
+ * labeled XFRM functionality is currently enabled/in-use.
+ *
+ */
+static void selinux_xfrm_refcount_adj(int adj)
+{
+ unsigned long sl_flags;
+
+ spin_lock_irqsave(&selinux_xfrm_refcount_lock, sl_flags);
+ selinux_xfrm_refcount += adj;
+ spin_unlock_irqrestore(&selinux_xfrm_refcount_lock, sl_flags);
+}
+
/*
* LSM hook implementation that authorizes that a flow can use
* a xfrm policy rule.
@@ -293,6 +336,9 @@ int selinux_xfrm_policy_alloc(struct xfrm_policy *xp,
BUG_ON(!uctx);
err = selinux_xfrm_sec_ctx_alloc(&xp->security, uctx, 0);
+ if (err == 0)
+ selinux_xfrm_refcount_adj(1);
+
return err;
}
@@ -340,10 +386,13 @@ int selinux_xfrm_policy_delete(struct xfrm_policy *xp)
struct xfrm_sec_ctx *ctx = xp->security;
int rc = 0;
- if (ctx)
+ if (ctx) {
rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
SECCLASS_ASSOCIATION,
ASSOCIATION__SETCONTEXT, NULL);
+ if (rc == 0)
+ selinux_xfrm_refcount_adj(-1);
+ }
return rc;
}
@@ -360,6 +409,8 @@ int selinux_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *uct
BUG_ON(!x);
err = selinux_xfrm_sec_ctx_alloc(&x->security, uctx, secid);
+ if (err == 0)
+ selinux_xfrm_refcount_adj(1);
return err;
}
@@ -382,10 +433,13 @@ int selinux_xfrm_state_delete(struct xfrm_state *x)
struct xfrm_sec_ctx *ctx = x->security;
int rc = 0;
- if (ctx)
+ if (ctx) {
rc = avc_has_perm(tsec->sid, ctx->ctx_sid,
SECCLASS_ASSOCIATION,
ASSOCIATION__SETCONTEXT, NULL);
+ if (rc == 0)
+ selinux_xfrm_refcount_adj(-1);
+ }
return rc;
}
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able
2007-10-05 19:32 [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able Paul Moore
` (2 preceding siblings ...)
2007-10-05 19:33 ` [RFC PATCH v4 3/3] [SELinux] Enable dynamic enable/disable of the network access checks Paul Moore
@ 2007-10-07 21:53 ` James Morris
2007-10-07 23:55 ` Paul Moore
3 siblings, 1 reply; 11+ messages in thread
From: James Morris @ 2007-10-07 21:53 UTC (permalink / raw)
To: Paul Moore; +Cc: selinux, Eric Paris
I think it'd be good to get these into 2.6.24. Any acks/nacks ?
--
James Morris
<jmorris@namei.org>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able
2007-10-07 21:53 ` [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able James Morris
@ 2007-10-07 23:55 ` Paul Moore
2007-10-08 12:06 ` Paul Moore
0 siblings, 1 reply; 11+ messages in thread
From: Paul Moore @ 2007-10-07 23:55 UTC (permalink / raw)
To: James Morris; +Cc: selinux, Eric Paris
On Sunday 07 October 2007 5:53:11 pm James Morris wrote:
> I think it'd be good to get these into 2.6.24. Any acks/nacks ?
Technically the ability to dynamically enable/disable the network access
controls alters user visible behavior and could cause complaints from users.
Granted, the chance of someone complaining about a missing unlabeled_t access
check when they haven't explicitly configured labeled networking is pretty
slim, but it still is possible and I don't want to knowingly cause things to
break.
It's tempting from a performance point of view to run with this now, but I
personally tend to think it's best to wait and implement it in policy rev 22
when we can hide it behind the new capability bitmap field (my thinking is
that it goes in with the new peer permission class and flow controls).
--
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able
2007-10-07 23:55 ` Paul Moore
@ 2007-10-08 12:06 ` Paul Moore
0 siblings, 0 replies; 11+ messages in thread
From: Paul Moore @ 2007-10-08 12:06 UTC (permalink / raw)
To: James Morris; +Cc: selinux, Eric Paris
On Sunday 07 October 2007 7:55:26 pm Paul Moore wrote:
> On Sunday 07 October 2007 5:53:11 pm James Morris wrote:
> > I think it'd be good to get these into 2.6.24. Any acks/nacks ?
Sorry, I thought you were asking just about the last patch (dynamic
enable/disable) and not the whole patchset.
I don't think we're going to be ready for 2.6.24 with these patches. My goal
at this point is to get these three patches, the new unified peer label
access controls and the work Venkat has been doing on flow control into
2.6.25. This should give us plenty of time to get the userspace pieces into
place and perform a decent amount of testing on the whole combination.
--
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22
2007-10-05 19:32 ` [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22 Paul Moore
@ 2007-10-10 18:16 ` Stephen Smalley
2007-10-10 18:31 ` Paul Moore
0 siblings, 1 reply; 11+ messages in thread
From: Stephen Smalley @ 2007-10-10 18:16 UTC (permalink / raw)
To: Paul Moore; +Cc: selinux
On Fri, 2007-10-05 at 15:32 -0400, Paul Moore wrote:
> Add 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 | 62 ++++++++++++++++++++++++
> 6 files changed, 181 insertions(+), 7 deletions(-)
>
> diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
> index 6100fc0..7059400 100644
> --- a/security/selinux/ss/services.c
> +++ b/security/selinux/ss/services.c
> @@ -59,6 +60,8 @@
> extern void selnl_notify_policyload(u32 seqno);
> unsigned int policydb_loaded_version;
>
> +int selinux_policycap_netpeer;
> +
> /*
> * This is declared in avc.c
> */
> @@ -1304,6 +1307,9 @@ int security_load_policy(void *data, size_t len)
> return -EINVAL;
> }
> policydb_loaded_version = policydb.policyvers;
> + selinux_policycap_netpeer =
> + ebitmap_get_bit(&policydb.policycaps,
> + POLICYDB_CAPABILITY_NETPEER);
> ss_initialized = 1;
> seqno = ++latest_granting;
> LOAD_UNLOCK;
Only handles the initial policy load case, not reloads.
--
Stephen Smalley
National Security Agency
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22
2007-10-10 18:16 ` Stephen Smalley
@ 2007-10-10 18:31 ` Paul Moore
2007-10-10 21:02 ` Eric Paris
0 siblings, 1 reply; 11+ messages in thread
From: Paul Moore @ 2007-10-10 18:31 UTC (permalink / raw)
To: Stephen Smalley; +Cc: selinux
On Wednesday 10 October 2007 2:16:34 pm Stephen Smalley wrote:
> On Fri, 2007-10-05 at 15:32 -0400, Paul Moore wrote:
> > @@ -1304,6 +1307,9 @@ int security_load_policy(void *data, size_t len)
> > return -EINVAL;
> > }
> > policydb_loaded_version = policydb.policyvers;
> > + selinux_policycap_netpeer =
> > + ebitmap_get_bit(&policydb.policycaps,
> > + POLICYDB_CAPABILITY_NETPEER);
> > ss_initialized = 1;
> > seqno = ++latest_granting;
> > LOAD_UNLOCK;
>
> Only handles the initial policy load case, not reloads.
So it does, thanks. I just added the same assignment further down in the
security_load_policy() function to handle the reload case.
--
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22
2007-10-10 18:31 ` Paul Moore
@ 2007-10-10 21:02 ` Eric Paris
2007-10-10 21:41 ` Paul Moore
0 siblings, 1 reply; 11+ messages in thread
From: Eric Paris @ 2007-10-10 21:02 UTC (permalink / raw)
To: Paul Moore; +Cc: Stephen Smalley, selinux
On 10/10/07, Paul Moore <paul.moore@hp.com> wrote:
> On Wednesday 10 October 2007 2:16:34 pm Stephen Smalley wrote:
> > On Fri, 2007-10-05 at 15:32 -0400, Paul Moore wrote:
> > > @@ -1304,6 +1307,9 @@ int security_load_policy(void *data, size_t len)
> > > return -EINVAL;
> > > }
> > > policydb_loaded_version = policydb.policyvers;
> > > + selinux_policycap_netpeer =
> > > + ebitmap_get_bit(&policydb.policycaps,
> > > + POLICYDB_CAPABILITY_NETPEER);
> > > ss_initialized = 1;
> > > seqno = ++latest_granting;
> > > LOAD_UNLOCK;
> >
> > Only handles the initial policy load case, not reloads.
>
> So it does, thanks. I just added the same assignment further down in the
> security_load_policy() function to handle the reload case.
Do we expect to have more of these? are we going to keep making
load_policy larger and larger or should this type of assignment just
be made in its own function to start with?
-Eric
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22
2007-10-10 21:02 ` Eric Paris
@ 2007-10-10 21:41 ` Paul Moore
0 siblings, 0 replies; 11+ messages in thread
From: Paul Moore @ 2007-10-10 21:41 UTC (permalink / raw)
To: Eric Paris; +Cc: Stephen Smalley, selinux
On Wednesday 10 October 2007 5:02:15 pm Eric Paris wrote:
> On 10/10/07, Paul Moore <paul.moore@hp.com> wrote:
> > On Wednesday 10 October 2007 2:16:34 pm Stephen Smalley wrote:
> > > On Fri, 2007-10-05 at 15:32 -0400, Paul Moore wrote:
> > > > @@ -1304,6 +1307,9 @@ int security_load_policy(void *data, size_t
> > > > len) return -EINVAL;
> > > > }
> > > > policydb_loaded_version = policydb.policyvers;
> > > > + selinux_policycap_netpeer =
> > > > + ebitmap_get_bit(&policydb.policycaps,
> > > > + POLICYDB_CAPABILITY_NETPEER);
> > > > ss_initialized = 1;
> > > > seqno = ++latest_granting;
> > > > LOAD_UNLOCK;
> > >
> > > Only handles the initial policy load case, not reloads.
> >
> > So it does, thanks. I just added the same assignment further down in the
> > security_load_policy() function to handle the reload case.
>
> Do we expect to have more of these? are we going to keep making
> load_policy larger and larger or should this type of assignment just
> be made in its own function to start with?
My crystal ball is a bit hazy, but I think it's reasonable to expect that we
will get more of these variables in the future. I'll move it out to a
separate function unless I hear any strong objections.
--
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 majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-10-10 21:41 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05 19:32 [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able Paul Moore
2007-10-05 19:32 ` [RFC PATCH v4 1/3] [SELinux] Add a capabilities bitmap to SELinux policy version 22 Paul Moore
2007-10-10 18:16 ` Stephen Smalley
2007-10-10 18:31 ` Paul Moore
2007-10-10 21:02 ` Eric Paris
2007-10-10 21:41 ` Paul Moore
2007-10-05 19:32 ` [RFC PATCH v4 2/3] [SELinux] Better integration between peer labeling subsystems Paul Moore
2007-10-05 19:33 ` [RFC PATCH v4 3/3] [SELinux] Enable dynamic enable/disable of the network access checks Paul Moore
2007-10-07 21:53 ` [RFC PATCH v4 0/3] Added new checks for labeled IPsec & SECMARK [en|dis]able James Morris
2007-10-07 23:55 ` Paul Moore
2007-10-08 12:06 ` Paul Moore
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.