aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-10-25 03:45:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-25 03:45:31 -0400
commit36b8d186e6cc8e32cb5227f5645a58e1bc0af190 (patch)
tree1000ad26e189e6ff2c53fb7eeff605f59c7ad94e /security/selinux
parentcd85b557414fe4cd44ea6608825e96612a5fe2b2 (diff)
parentc45ed235abf1b0b6666417e3c394f18717976acd (diff)
Merge branch 'next' of git://selinuxproject.org/~jmorris/linux-security
* 'next' of git://selinuxproject.org/~jmorris/linux-security: (95 commits) TOMOYO: Fix incomplete read after seek. Smack: allow to access /smack/access as normal user TOMOYO: Fix unused kernel config option. Smack: fix: invalid length set for the result of /smack/access Smack: compilation fix Smack: fix for /smack/access output, use string instead of byte Smack: domain transition protections (v3) Smack: Provide information for UDS getsockopt(SO_PEERCRED) Smack: Clean up comments Smack: Repair processing of fcntl Smack: Rule list lookup performance Smack: check permissions from user space (v2) TOMOYO: Fix quota and garbage collector. TOMOYO: Remove redundant tasklist_lock. TOMOYO: Fix domain transition failure warning. TOMOYO: Remove tomoyo_policy_memory_lock spinlock. TOMOYO: Simplify garbage collector. TOMOYO: Fix make namespacecheck warnings. target: check hex2bin result encrypted-keys: check hex2bin result ...
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/exports.c1
-rw-r--r--security/selinux/hooks.c13
-rw-r--r--security/selinux/include/avc_ss.h6
-rw-r--r--security/selinux/include/security.h8
-rw-r--r--security/selinux/netlink.c2
-rw-r--r--security/selinux/nlmsgtab.c1
-rw-r--r--security/selinux/selinuxfs.c5
-rw-r--r--security/selinux/ss/conditional.c2
-rw-r--r--security/selinux/ss/conditional.h1
-rw-r--r--security/selinux/ss/policydb.c2
-rw-r--r--security/selinux/ss/services.c3
11 files changed, 23 insertions, 21 deletions
diff --git a/security/selinux/exports.c b/security/selinux/exports.c
index 90664385dead..e75dd94e2d2b 100644
--- a/security/selinux/exports.c
+++ b/security/selinux/exports.c
@@ -12,6 +12,7 @@
12 * as published by the Free Software Foundation. 12 * as published by the Free Software Foundation.
13 */ 13 */
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/selinux.h>
15 16
16#include "security.h" 17#include "security.h"
17 18
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 266a2292451d..e545b9f67072 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -89,14 +89,14 @@
89#include "xfrm.h" 89#include "xfrm.h"
90#include "netlabel.h" 90#include "netlabel.h"
91#include "audit.h" 91#include "audit.h"
92#include "avc_ss.h"
92 93
93#define NUM_SEL_MNT_OPTS 5 94#define NUM_SEL_MNT_OPTS 5
94 95
95extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
96extern struct security_operations *security_ops; 96extern struct security_operations *security_ops;
97 97
98/* SECMARK reference count */ 98/* SECMARK reference count */
99atomic_t selinux_secmark_refcount = ATOMIC_INIT(0); 99static atomic_t selinux_secmark_refcount = ATOMIC_INIT(0);
100 100
101#ifdef CONFIG_SECURITY_SELINUX_DEVELOP 101#ifdef CONFIG_SECURITY_SELINUX_DEVELOP
102int selinux_enforcing; 102int selinux_enforcing;
@@ -279,10 +279,6 @@ static void superblock_free_security(struct super_block *sb)
279 kfree(sbsec); 279 kfree(sbsec);
280} 280}
281 281
282/* The security server must be initialized before
283 any labeling or access decisions can be provided. */
284extern int ss_initialized;
285
286/* The file system's label must be initialized prior to use. */ 282/* The file system's label must be initialized prior to use. */
287 283
288static const char *labeling_behaviors[6] = { 284static const char *labeling_behaviors[6] = {
@@ -2097,9 +2093,6 @@ static int selinux_bprm_secureexec(struct linux_binprm *bprm)
2097 return (atsecure || cap_bprm_secureexec(bprm)); 2093 return (atsecure || cap_bprm_secureexec(bprm));
2098} 2094}
2099 2095
2100extern struct vfsmount *selinuxfs_mount;
2101extern struct dentry *selinux_null;
2102
2103/* Derived from fs/exec.c:flush_old_files. */ 2096/* Derived from fs/exec.c:flush_old_files. */
2104static inline void flush_unauthorized_files(const struct cred *cred, 2097static inline void flush_unauthorized_files(const struct cred *cred,
2105 struct files_struct *files) 2098 struct files_struct *files)
@@ -5803,8 +5796,6 @@ static int selinux_disabled;
5803 5796
5804int selinux_disable(void) 5797int selinux_disable(void)
5805{ 5798{
5806 extern void exit_sel_fs(void);
5807
5808 if (ss_initialized) { 5799 if (ss_initialized) {
5809 /* Not permitted after initial policy load. */ 5800 /* Not permitted after initial policy load. */
5810 return -EINVAL; 5801 return -EINVAL;
diff --git a/security/selinux/include/avc_ss.h b/security/selinux/include/avc_ss.h
index 4677aa519b04..d5c328452df0 100644
--- a/security/selinux/include/avc_ss.h
+++ b/security/selinux/include/avc_ss.h
@@ -18,5 +18,11 @@ struct security_class_mapping {
18 18
19extern struct security_class_mapping secclass_map[]; 19extern struct security_class_mapping secclass_map[];
20 20
21/*
22 * The security server must be initialized before
23 * any labeling or access decisions can be provided.
24 */
25extern int ss_initialized;
26
21#endif /* _SELINUX_AVC_SS_H_ */ 27#endif /* _SELINUX_AVC_SS_H_ */
22 28
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h
index 3ba4feba048a..d871e8ad2103 100644
--- a/security/selinux/include/security.h
+++ b/security/selinux/include/security.h
@@ -216,6 +216,14 @@ struct selinux_kernel_status {
216 216
217extern void selinux_status_update_setenforce(int enforcing); 217extern void selinux_status_update_setenforce(int enforcing);
218extern void selinux_status_update_policyload(int seqno); 218extern void selinux_status_update_policyload(int seqno);
219extern void selinux_complete_init(void);
220extern int selinux_disable(void);
221extern void exit_sel_fs(void);
222extern struct dentry *selinux_null;
223extern struct vfsmount *selinuxfs_mount;
224extern void selnl_notify_setenforce(int val);
225extern void selnl_notify_policyload(u32 seqno);
226extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm);
219 227
220#endif /* _SELINUX_SECURITY_H_ */ 228#endif /* _SELINUX_SECURITY_H_ */
221 229
diff --git a/security/selinux/netlink.c b/security/selinux/netlink.c
index 36ac257cec9a..ce3f481558d8 100644
--- a/security/selinux/netlink.c
+++ b/security/selinux/netlink.c
@@ -19,6 +19,8 @@
19#include <linux/selinux_netlink.h> 19#include <linux/selinux_netlink.h>
20#include <net/net_namespace.h> 20#include <net/net_namespace.h>
21 21
22#include "security.h"
23
22static struct sock *selnl; 24static struct sock *selnl;
23 25
24static int selnl_msglen(int msgtype) 26static int selnl_msglen(int msgtype)
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c
index 8b02b2137da2..0920ea3bf599 100644
--- a/security/selinux/nlmsgtab.c
+++ b/security/selinux/nlmsgtab.c
@@ -21,6 +21,7 @@
21 21
22#include "flask.h" 22#include "flask.h"
23#include "av_permissions.h" 23#include "av_permissions.h"
24#include "security.h"
24 25
25struct nlmsg_perm { 26struct nlmsg_perm {
26 u16 nlmsg_type; 27 u16 nlmsg_type;
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index 55d92cbb177a..f46658722c78 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -75,8 +75,6 @@ static char policy_opened;
75/* global data for policy capabilities */ 75/* global data for policy capabilities */
76static struct dentry *policycap_dir; 76static struct dentry *policycap_dir;
77 77
78extern void selnl_notify_setenforce(int val);
79
80/* Check whether a task is allowed to use a security operation. */ 78/* Check whether a task is allowed to use a security operation. */
81static int task_has_security(struct task_struct *tsk, 79static int task_has_security(struct task_struct *tsk,
82 u32 perms) 80 u32 perms)
@@ -278,7 +276,6 @@ static ssize_t sel_write_disable(struct file *file, const char __user *buf,
278 char *page = NULL; 276 char *page = NULL;
279 ssize_t length; 277 ssize_t length;
280 int new_value; 278 int new_value;
281 extern int selinux_disable(void);
282 279
283 length = -ENOMEM; 280 length = -ENOMEM;
284 if (count >= PAGE_SIZE) 281 if (count >= PAGE_SIZE)
@@ -478,7 +475,7 @@ static struct vm_operations_struct sel_mmap_policy_ops = {
478 .page_mkwrite = sel_mmap_policy_fault, 475 .page_mkwrite = sel_mmap_policy_fault,
479}; 476};
480 477
481int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma) 478static int sel_mmap_policy(struct file *filp, struct vm_area_struct *vma)
482{ 479{
483 if (vma->vm_flags & VM_SHARED) { 480 if (vma->vm_flags & VM_SHARED) {
484 /* do not allow mprotect to make mapping writable */ 481 /* do not allow mprotect to make mapping writable */
diff --git a/security/selinux/ss/conditional.c b/security/selinux/ss/conditional.c
index a53373207fb4..2ec904177fe0 100644
--- a/security/selinux/ss/conditional.c
+++ b/security/selinux/ss/conditional.c
@@ -555,7 +555,7 @@ static int cond_write_av_list(struct policydb *p,
555 return 0; 555 return 0;
556} 556}
557 557
558int cond_write_node(struct policydb *p, struct cond_node *node, 558static int cond_write_node(struct policydb *p, struct cond_node *node,
559 struct policy_file *fp) 559 struct policy_file *fp)
560{ 560{
561 struct cond_expr *cur_expr; 561 struct cond_expr *cur_expr;
diff --git a/security/selinux/ss/conditional.h b/security/selinux/ss/conditional.h
index 3f209c635295..4d1f87466508 100644
--- a/security/selinux/ss/conditional.h
+++ b/security/selinux/ss/conditional.h
@@ -13,6 +13,7 @@
13#include "avtab.h" 13#include "avtab.h"
14#include "symtab.h" 14#include "symtab.h"
15#include "policydb.h" 15#include "policydb.h"
16#include "../include/conditional.h"
16 17
17#define COND_EXPR_MAXDEPTH 10 18#define COND_EXPR_MAXDEPTH 10
18 19
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 2381d0ded228..a7f61d52f05c 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -1743,8 +1743,6 @@ static int policydb_bounds_sanity_check(struct policydb *p)
1743 return 0; 1743 return 0;
1744} 1744}
1745 1745
1746extern int ss_initialized;
1747
1748u16 string_to_security_class(struct policydb *p, const char *name) 1746u16 string_to_security_class(struct policydb *p, const char *name)
1749{ 1747{
1750 struct class_datum *cladatum; 1748 struct class_datum *cladatum;
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c
index f6917bc0aa05..185f849a26f6 100644
--- a/security/selinux/ss/services.c
+++ b/security/selinux/ss/services.c
@@ -70,8 +70,6 @@
70#include "ebitmap.h" 70#include "ebitmap.h"
71#include "audit.h" 71#include "audit.h"
72 72
73extern void selnl_notify_policyload(u32 seqno);
74
75int selinux_policycap_netpeer; 73int selinux_policycap_netpeer;
76int selinux_policycap_openperm; 74int selinux_policycap_openperm;
77 75
@@ -1790,7 +1788,6 @@ static void security_load_policycaps(void)
1790 POLICYDB_CAPABILITY_OPENPERM); 1788 POLICYDB_CAPABILITY_OPENPERM);
1791} 1789}
1792 1790
1793extern void selinux_complete_init(void);
1794static int security_preserve_bools(struct policydb *p); 1791static int security_preserve_bools(struct policydb *p);
1795 1792
1796/** 1793/**