aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-27 16:26:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-27 16:26:03 -0400
commite22619a29fcdb513b7bc020e84225bb3b5914259 (patch)
tree1d1d72a4c8cebad4f2d2bf738395ca4ececa95ec /security/selinux/hooks.c
parent78c10e556ed904d5bfbd71e9cadd8ce8f25d6982 (diff)
parentb3bddffd35a0b77eee89760eb94cafa18dc431f5 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security
Pull security subsystem updates from James Morris: "The main change in this kernel is Casey's generalized LSM stacking work, which removes the hard-coding of Capabilities and Yama stacking, allowing multiple arbitrary "small" LSMs to be stacked with a default monolithic module (e.g. SELinux, Smack, AppArmor). See https://lwn.net/Articles/636056/ This will allow smaller, simpler LSMs to be incorporated into the mainline kernel and arbitrarily stacked by users. Also, this is a useful cleanup of the LSM code in its own right" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (38 commits) tpm, tpm_crb: fix le64_to_cpu conversions in crb_acpi_add() vTPM: set virtual device before passing to ibmvtpm_reset_crq tpm_ibmvtpm: remove unneccessary message level. ima: update builtin policies ima: extend "mask" policy matching support ima: add support for new "euid" policy condition ima: fix ima_show_template_data_ascii() Smack: freeing an error pointer in smk_write_revoke_subj() selinux: fix setting of security labels on NFS selinux: Remove unused permission definitions selinux: enable genfscon labeling for sysfs and pstore files selinux: enable per-file labeling for debugfs files. selinux: update netlink socket classes signals: don't abuse __flush_signals() in selinux_bprm_committed_creds() selinux: Print 'sclass' as string when unrecognized netlink message occurs Smack: allow multiple labels in onlycap Smack: fix seq operations in smackfs ima: pass iint to ima_add_violation() ima: wrap event related data to the new ima_event_data structure integrity: add validity checks for 'path' parameter ...
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c567
1 files changed, 262 insertions, 305 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index ffa5a642629a..623108199641 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -29,7 +29,7 @@
29#include <linux/tracehook.h> 29#include <linux/tracehook.h>
30#include <linux/errno.h> 30#include <linux/errno.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <linux/security.h> 32#include <linux/lsm_hooks.h>
33#include <linux/xattr.h> 33#include <linux/xattr.h>
34#include <linux/capability.h> 34#include <linux/capability.h>
35#include <linux/unistd.h> 35#include <linux/unistd.h>
@@ -403,6 +403,7 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)
403 return sbsec->behavior == SECURITY_FS_USE_XATTR || 403 return sbsec->behavior == SECURITY_FS_USE_XATTR ||
404 sbsec->behavior == SECURITY_FS_USE_TRANS || 404 sbsec->behavior == SECURITY_FS_USE_TRANS ||
405 sbsec->behavior == SECURITY_FS_USE_TASK || 405 sbsec->behavior == SECURITY_FS_USE_TASK ||
406 sbsec->behavior == SECURITY_FS_USE_NATIVE ||
406 /* Special handling. Genfs but also in-core setxattr handler */ 407 /* Special handling. Genfs but also in-core setxattr handler */
407 !strcmp(sb->s_type->name, "sysfs") || 408 !strcmp(sb->s_type->name, "sysfs") ||
408 !strcmp(sb->s_type->name, "pstore") || 409 !strcmp(sb->s_type->name, "pstore") ||
@@ -724,7 +725,12 @@ static int selinux_set_mnt_opts(struct super_block *sb,
724 } 725 }
725 726
726 if (strcmp(sb->s_type->name, "proc") == 0) 727 if (strcmp(sb->s_type->name, "proc") == 0)
727 sbsec->flags |= SE_SBPROC; 728 sbsec->flags |= SE_SBPROC | SE_SBGENFS;
729
730 if (!strcmp(sb->s_type->name, "debugfs") ||
731 !strcmp(sb->s_type->name, "sysfs") ||
732 !strcmp(sb->s_type->name, "pstore"))
733 sbsec->flags |= SE_SBGENFS;
728 734
729 if (!sbsec->behavior) { 735 if (!sbsec->behavior) {
730 /* 736 /*
@@ -1188,8 +1194,6 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1188 switch (protocol) { 1194 switch (protocol) {
1189 case NETLINK_ROUTE: 1195 case NETLINK_ROUTE:
1190 return SECCLASS_NETLINK_ROUTE_SOCKET; 1196 return SECCLASS_NETLINK_ROUTE_SOCKET;
1191 case NETLINK_FIREWALL:
1192 return SECCLASS_NETLINK_FIREWALL_SOCKET;
1193 case NETLINK_SOCK_DIAG: 1197 case NETLINK_SOCK_DIAG:
1194 return SECCLASS_NETLINK_TCPDIAG_SOCKET; 1198 return SECCLASS_NETLINK_TCPDIAG_SOCKET;
1195 case NETLINK_NFLOG: 1199 case NETLINK_NFLOG:
@@ -1198,14 +1202,28 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1198 return SECCLASS_NETLINK_XFRM_SOCKET; 1202 return SECCLASS_NETLINK_XFRM_SOCKET;
1199 case NETLINK_SELINUX: 1203 case NETLINK_SELINUX:
1200 return SECCLASS_NETLINK_SELINUX_SOCKET; 1204 return SECCLASS_NETLINK_SELINUX_SOCKET;
1205 case NETLINK_ISCSI:
1206 return SECCLASS_NETLINK_ISCSI_SOCKET;
1201 case NETLINK_AUDIT: 1207 case NETLINK_AUDIT:
1202 return SECCLASS_NETLINK_AUDIT_SOCKET; 1208 return SECCLASS_NETLINK_AUDIT_SOCKET;
1203 case NETLINK_IP6_FW: 1209 case NETLINK_FIB_LOOKUP:
1204 return SECCLASS_NETLINK_IP6FW_SOCKET; 1210 return SECCLASS_NETLINK_FIB_LOOKUP_SOCKET;
1211 case NETLINK_CONNECTOR:
1212 return SECCLASS_NETLINK_CONNECTOR_SOCKET;
1213 case NETLINK_NETFILTER:
1214 return SECCLASS_NETLINK_NETFILTER_SOCKET;
1205 case NETLINK_DNRTMSG: 1215 case NETLINK_DNRTMSG:
1206 return SECCLASS_NETLINK_DNRT_SOCKET; 1216 return SECCLASS_NETLINK_DNRT_SOCKET;
1207 case NETLINK_KOBJECT_UEVENT: 1217 case NETLINK_KOBJECT_UEVENT:
1208 return SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET; 1218 return SECCLASS_NETLINK_KOBJECT_UEVENT_SOCKET;
1219 case NETLINK_GENERIC:
1220 return SECCLASS_NETLINK_GENERIC_SOCKET;
1221 case NETLINK_SCSITRANSPORT:
1222 return SECCLASS_NETLINK_SCSITRANSPORT_SOCKET;
1223 case NETLINK_RDMA:
1224 return SECCLASS_NETLINK_RDMA_SOCKET;
1225 case NETLINK_CRYPTO:
1226 return SECCLASS_NETLINK_CRYPTO_SOCKET;
1209 default: 1227 default:
1210 return SECCLASS_NETLINK_SOCKET; 1228 return SECCLASS_NETLINK_SOCKET;
1211 } 1229 }
@@ -1220,12 +1238,13 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1220 return SECCLASS_SOCKET; 1238 return SECCLASS_SOCKET;
1221} 1239}
1222 1240
1223#ifdef CONFIG_PROC_FS 1241static int selinux_genfs_get_sid(struct dentry *dentry,
1224static int selinux_proc_get_sid(struct dentry *dentry, 1242 u16 tclass,
1225 u16 tclass, 1243 u16 flags,
1226 u32 *sid) 1244 u32 *sid)
1227{ 1245{
1228 int rc; 1246 int rc;
1247 struct super_block *sb = dentry->d_inode->i_sb;
1229 char *buffer, *path; 1248 char *buffer, *path;
1230 1249
1231 buffer = (char *)__get_free_page(GFP_KERNEL); 1250 buffer = (char *)__get_free_page(GFP_KERNEL);
@@ -1236,26 +1255,20 @@ static int selinux_proc_get_sid(struct dentry *dentry,
1236 if (IS_ERR(path)) 1255 if (IS_ERR(path))
1237 rc = PTR_ERR(path); 1256 rc = PTR_ERR(path);
1238 else { 1257 else {
1239 /* each process gets a /proc/PID/ entry. Strip off the 1258 if (flags & SE_SBPROC) {
1240 * PID part to get a valid selinux labeling. 1259 /* each process gets a /proc/PID/ entry. Strip off the
1241 * e.g. /proc/1/net/rpc/nfs -> /net/rpc/nfs */ 1260 * PID part to get a valid selinux labeling.
1242 while (path[1] >= '0' && path[1] <= '9') { 1261 * e.g. /proc/1/net/rpc/nfs -> /net/rpc/nfs */
1243 path[1] = '/'; 1262 while (path[1] >= '0' && path[1] <= '9') {
1244 path++; 1263 path[1] = '/';
1264 path++;
1265 }
1245 } 1266 }
1246 rc = security_genfs_sid("proc", path, tclass, sid); 1267 rc = security_genfs_sid(sb->s_type->name, path, tclass, sid);
1247 } 1268 }
1248 free_page((unsigned long)buffer); 1269 free_page((unsigned long)buffer);
1249 return rc; 1270 return rc;
1250} 1271}
1251#else
1252static int selinux_proc_get_sid(struct dentry *dentry,
1253 u16 tclass,
1254 u32 *sid)
1255{
1256 return -EINVAL;
1257}
1258#endif
1259 1272
1260/* The inode's security attributes must be initialized before first use. */ 1273/* The inode's security attributes must be initialized before first use. */
1261static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry) 1274static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dentry)
@@ -1412,7 +1425,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
1412 /* Default to the fs superblock SID. */ 1425 /* Default to the fs superblock SID. */
1413 isec->sid = sbsec->sid; 1426 isec->sid = sbsec->sid;
1414 1427
1415 if ((sbsec->flags & SE_SBPROC) && !S_ISLNK(inode->i_mode)) { 1428 if ((sbsec->flags & SE_SBGENFS) && !S_ISLNK(inode->i_mode)) {
1416 /* We must have a dentry to determine the label on 1429 /* We must have a dentry to determine the label on
1417 * procfs inodes */ 1430 * procfs inodes */
1418 if (opt_dentry) 1431 if (opt_dentry)
@@ -1435,7 +1448,8 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent
1435 if (!dentry) 1448 if (!dentry)
1436 goto out_unlock; 1449 goto out_unlock;
1437 isec->sclass = inode_mode_to_security_class(inode->i_mode); 1450 isec->sclass = inode_mode_to_security_class(inode->i_mode);
1438 rc = selinux_proc_get_sid(dentry, isec->sclass, &sid); 1451 rc = selinux_genfs_get_sid(dentry, isec->sclass,
1452 sbsec->flags, &sid);
1439 dput(dentry); 1453 dput(dentry);
1440 if (rc) 1454 if (rc)
1441 goto out_unlock; 1455 goto out_unlock;
@@ -1990,12 +2004,6 @@ static int selinux_binder_transfer_file(struct task_struct *from,
1990static int selinux_ptrace_access_check(struct task_struct *child, 2004static int selinux_ptrace_access_check(struct task_struct *child,
1991 unsigned int mode) 2005 unsigned int mode)
1992{ 2006{
1993 int rc;
1994
1995 rc = cap_ptrace_access_check(child, mode);
1996 if (rc)
1997 return rc;
1998
1999 if (mode & PTRACE_MODE_READ) { 2007 if (mode & PTRACE_MODE_READ) {
2000 u32 sid = current_sid(); 2008 u32 sid = current_sid();
2001 u32 csid = task_sid(child); 2009 u32 csid = task_sid(child);
@@ -2007,25 +2015,13 @@ static int selinux_ptrace_access_check(struct task_struct *child,
2007 2015
2008static int selinux_ptrace_traceme(struct task_struct *parent) 2016static int selinux_ptrace_traceme(struct task_struct *parent)
2009{ 2017{
2010 int rc;
2011
2012 rc = cap_ptrace_traceme(parent);
2013 if (rc)
2014 return rc;
2015
2016 return task_has_perm(parent, current, PROCESS__PTRACE); 2018 return task_has_perm(parent, current, PROCESS__PTRACE);
2017} 2019}
2018 2020
2019static int selinux_capget(struct task_struct *target, kernel_cap_t *effective, 2021static int selinux_capget(struct task_struct *target, kernel_cap_t *effective,
2020 kernel_cap_t *inheritable, kernel_cap_t *permitted) 2022 kernel_cap_t *inheritable, kernel_cap_t *permitted)
2021{ 2023{
2022 int error; 2024 return current_has_perm(target, PROCESS__GETCAP);
2023
2024 error = current_has_perm(target, PROCESS__GETCAP);
2025 if (error)
2026 return error;
2027
2028 return cap_capget(target, effective, inheritable, permitted);
2029} 2025}
2030 2026
2031static int selinux_capset(struct cred *new, const struct cred *old, 2027static int selinux_capset(struct cred *new, const struct cred *old,
@@ -2033,13 +2029,6 @@ static int selinux_capset(struct cred *new, const struct cred *old,
2033 const kernel_cap_t *inheritable, 2029 const kernel_cap_t *inheritable,
2034 const kernel_cap_t *permitted) 2030 const kernel_cap_t *permitted)
2035{ 2031{
2036 int error;
2037
2038 error = cap_capset(new, old,
2039 effective, inheritable, permitted);
2040 if (error)
2041 return error;
2042
2043 return cred_has_perm(old, new, PROCESS__SETCAP); 2032 return cred_has_perm(old, new, PROCESS__SETCAP);
2044} 2033}
2045 2034
@@ -2056,12 +2045,6 @@ static int selinux_capset(struct cred *new, const struct cred *old,
2056static int selinux_capable(const struct cred *cred, struct user_namespace *ns, 2045static int selinux_capable(const struct cred *cred, struct user_namespace *ns,
2057 int cap, int audit) 2046 int cap, int audit)
2058{ 2047{
2059 int rc;
2060
2061 rc = cap_capable(cred, ns, cap, audit);
2062 if (rc)
2063 return rc;
2064
2065 return cred_has_capability(cred, cap, audit); 2048 return cred_has_capability(cred, cap, audit);
2066} 2049}
2067 2050
@@ -2139,12 +2122,12 @@ static int selinux_vm_enough_memory(struct mm_struct *mm, long pages)
2139{ 2122{
2140 int rc, cap_sys_admin = 0; 2123 int rc, cap_sys_admin = 0;
2141 2124
2142 rc = selinux_capable(current_cred(), &init_user_ns, CAP_SYS_ADMIN, 2125 rc = cred_has_capability(current_cred(), CAP_SYS_ADMIN,
2143 SECURITY_CAP_NOAUDIT); 2126 SECURITY_CAP_NOAUDIT);
2144 if (rc == 0) 2127 if (rc == 0)
2145 cap_sys_admin = 1; 2128 cap_sys_admin = 1;
2146 2129
2147 return __vm_enough_memory(mm, pages, cap_sys_admin); 2130 return cap_sys_admin;
2148} 2131}
2149 2132
2150/* binprm security operations */ 2133/* binprm security operations */
@@ -2193,10 +2176,6 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
2193 struct inode *inode = file_inode(bprm->file); 2176 struct inode *inode = file_inode(bprm->file);
2194 int rc; 2177 int rc;
2195 2178
2196 rc = cap_bprm_set_creds(bprm);
2197 if (rc)
2198 return rc;
2199
2200 /* SELinux context only depends on initial program or script and not 2179 /* SELinux context only depends on initial program or script and not
2201 * the script interpreter */ 2180 * the script interpreter */
2202 if (bprm->cred_prepared) 2181 if (bprm->cred_prepared)
@@ -2320,7 +2299,7 @@ static int selinux_bprm_secureexec(struct linux_binprm *bprm)
2320 PROCESS__NOATSECURE, NULL); 2299 PROCESS__NOATSECURE, NULL);
2321 } 2300 }
2322 2301
2323 return (atsecure || cap_bprm_secureexec(bprm)); 2302 return !!atsecure;
2324} 2303}
2325 2304
2326static int match_file(const void *p, struct file *file, unsigned fd) 2305static int match_file(const void *p, struct file *file, unsigned fd)
@@ -2451,10 +2430,12 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm)
2451 for (i = 0; i < 3; i++) 2430 for (i = 0; i < 3; i++)
2452 do_setitimer(i, &itimer, NULL); 2431 do_setitimer(i, &itimer, NULL);
2453 spin_lock_irq(&current->sighand->siglock); 2432 spin_lock_irq(&current->sighand->siglock);
2454 if (!(current->signal->flags & SIGNAL_GROUP_EXIT)) { 2433 if (!fatal_signal_pending(current)) {
2455 __flush_signals(current); 2434 flush_sigqueue(&current->pending);
2435 flush_sigqueue(&current->signal->shared_pending);
2456 flush_signal_handlers(current, 1); 2436 flush_signal_handlers(current, 1);
2457 sigemptyset(&current->blocked); 2437 sigemptyset(&current->blocked);
2438 recalc_sigpending();
2458 } 2439 }
2459 spin_unlock_irq(&current->sighand->siglock); 2440 spin_unlock_irq(&current->sighand->siglock);
2460 } 2441 }
@@ -3144,8 +3125,11 @@ static int selinux_inode_getsecurity(const struct inode *inode, const char *name
3144 * and lack of permission just means that we fall back to the 3125 * and lack of permission just means that we fall back to the
3145 * in-core context value, not a denial. 3126 * in-core context value, not a denial.
3146 */ 3127 */
3147 error = selinux_capable(current_cred(), &init_user_ns, CAP_MAC_ADMIN, 3128 error = cap_capable(current_cred(), &init_user_ns, CAP_MAC_ADMIN,
3148 SECURITY_CAP_NOAUDIT); 3129 SECURITY_CAP_NOAUDIT);
3130 if (!error)
3131 error = cred_has_capability(current_cred(), CAP_MAC_ADMIN,
3132 SECURITY_CAP_NOAUDIT);
3149 if (!error) 3133 if (!error)
3150 error = security_sid_to_context_force(isec->sid, &context, 3134 error = security_sid_to_context_force(isec->sid, &context,
3151 &size); 3135 &size);
@@ -3330,12 +3314,7 @@ error:
3330 3314
3331static int selinux_mmap_addr(unsigned long addr) 3315static int selinux_mmap_addr(unsigned long addr)
3332{ 3316{
3333 int rc; 3317 int rc = 0;
3334
3335 /* do DAC check on address space usage */
3336 rc = cap_mmap_addr(addr);
3337 if (rc)
3338 return rc;
3339 3318
3340 if (addr < CONFIG_LSM_MMAP_MIN_ADDR) { 3319 if (addr < CONFIG_LSM_MMAP_MIN_ADDR) {
3341 u32 sid = current_sid(); 3320 u32 sid = current_sid();
@@ -3651,23 +3630,11 @@ static void selinux_task_getsecid(struct task_struct *p, u32 *secid)
3651 3630
3652static int selinux_task_setnice(struct task_struct *p, int nice) 3631static int selinux_task_setnice(struct task_struct *p, int nice)
3653{ 3632{
3654 int rc;
3655
3656 rc = cap_task_setnice(p, nice);
3657 if (rc)
3658 return rc;
3659
3660 return current_has_perm(p, PROCESS__SETSCHED); 3633 return current_has_perm(p, PROCESS__SETSCHED);
3661} 3634}
3662 3635
3663static int selinux_task_setioprio(struct task_struct *p, int ioprio) 3636static int selinux_task_setioprio(struct task_struct *p, int ioprio)
3664{ 3637{
3665 int rc;
3666
3667 rc = cap_task_setioprio(p, ioprio);
3668 if (rc)
3669 return rc;
3670
3671 return current_has_perm(p, PROCESS__SETSCHED); 3638 return current_has_perm(p, PROCESS__SETSCHED);
3672} 3639}
3673 3640
@@ -3693,12 +3660,6 @@ static int selinux_task_setrlimit(struct task_struct *p, unsigned int resource,
3693 3660
3694static int selinux_task_setscheduler(struct task_struct *p) 3661static int selinux_task_setscheduler(struct task_struct *p)
3695{ 3662{
3696 int rc;
3697
3698 rc = cap_task_setscheduler(p);
3699 if (rc)
3700 return rc;
3701
3702 return current_has_perm(p, PROCESS__SETSCHED); 3663 return current_has_perm(p, PROCESS__SETSCHED);
3703} 3664}
3704 3665
@@ -4780,8 +4741,9 @@ static int selinux_nlmsg_perm(struct sock *sk, struct sk_buff *skb)
4780 if (err == -EINVAL) { 4741 if (err == -EINVAL) {
4781 printk(KERN_WARNING 4742 printk(KERN_WARNING
4782 "SELinux: unrecognized netlink message:" 4743 "SELinux: unrecognized netlink message:"
4783 " protocol=%hu nlmsg_type=%hu sclass=%hu\n", 4744 " protocol=%hu nlmsg_type=%hu sclass=%s\n",
4784 sk->sk_protocol, nlh->nlmsg_type, sksec->sclass); 4745 sk->sk_protocol, nlh->nlmsg_type,
4746 secclass_map[sksec->sclass - 1].name);
4785 if (!selinux_enforcing || security_get_allow_unknown()) 4747 if (!selinux_enforcing || security_get_allow_unknown())
4786 err = 0; 4748 err = 0;
4787 } 4749 }
@@ -5109,12 +5071,6 @@ static unsigned int selinux_ipv6_postroute(const struct nf_hook_ops *ops,
5109 5071
5110static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb) 5072static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb)
5111{ 5073{
5112 int err;
5113
5114 err = cap_netlink_send(sk, skb);
5115 if (err)
5116 return err;
5117
5118 return selinux_nlmsg_perm(sk, skb); 5074 return selinux_nlmsg_perm(sk, skb);
5119} 5075}
5120 5076
@@ -5852,218 +5808,220 @@ static int selinux_key_getsecurity(struct key *key, char **_buffer)
5852 5808
5853#endif 5809#endif
5854 5810
5855static struct security_operations selinux_ops = { 5811static struct security_hook_list selinux_hooks[] = {
5856 .name = "selinux", 5812 LSM_HOOK_INIT(binder_set_context_mgr, selinux_binder_set_context_mgr),
5857 5813 LSM_HOOK_INIT(binder_transaction, selinux_binder_transaction),
5858 .binder_set_context_mgr = selinux_binder_set_context_mgr, 5814 LSM_HOOK_INIT(binder_transfer_binder, selinux_binder_transfer_binder),
5859 .binder_transaction = selinux_binder_transaction, 5815 LSM_HOOK_INIT(binder_transfer_file, selinux_binder_transfer_file),
5860 .binder_transfer_binder = selinux_binder_transfer_binder, 5816
5861 .binder_transfer_file = selinux_binder_transfer_file, 5817 LSM_HOOK_INIT(ptrace_access_check, selinux_ptrace_access_check),
5862 5818 LSM_HOOK_INIT(ptrace_traceme, selinux_ptrace_traceme),
5863 .ptrace_access_check = selinux_ptrace_access_check, 5819 LSM_HOOK_INIT(capget, selinux_capget),
5864 .ptrace_traceme = selinux_ptrace_traceme, 5820 LSM_HOOK_INIT(capset, selinux_capset),
5865 .capget = selinux_capget, 5821 LSM_HOOK_INIT(capable, selinux_capable),
5866 .capset = selinux_capset, 5822 LSM_HOOK_INIT(quotactl, selinux_quotactl),
5867 .capable = selinux_capable, 5823 LSM_HOOK_INIT(quota_on, selinux_quota_on),
5868 .quotactl = selinux_quotactl, 5824 LSM_HOOK_INIT(syslog, selinux_syslog),
5869 .quota_on = selinux_quota_on, 5825 LSM_HOOK_INIT(vm_enough_memory, selinux_vm_enough_memory),
5870 .syslog = selinux_syslog, 5826
5871 .vm_enough_memory = selinux_vm_enough_memory, 5827 LSM_HOOK_INIT(netlink_send, selinux_netlink_send),
5872 5828
5873 .netlink_send = selinux_netlink_send, 5829 LSM_HOOK_INIT(bprm_set_creds, selinux_bprm_set_creds),
5874 5830 LSM_HOOK_INIT(bprm_committing_creds, selinux_bprm_committing_creds),
5875 .bprm_set_creds = selinux_bprm_set_creds, 5831 LSM_HOOK_INIT(bprm_committed_creds, selinux_bprm_committed_creds),
5876 .bprm_committing_creds = selinux_bprm_committing_creds, 5832 LSM_HOOK_INIT(bprm_secureexec, selinux_bprm_secureexec),
5877 .bprm_committed_creds = selinux_bprm_committed_creds, 5833
5878 .bprm_secureexec = selinux_bprm_secureexec, 5834 LSM_HOOK_INIT(sb_alloc_security, selinux_sb_alloc_security),
5879 5835 LSM_HOOK_INIT(sb_free_security, selinux_sb_free_security),
5880 .sb_alloc_security = selinux_sb_alloc_security, 5836 LSM_HOOK_INIT(sb_copy_data, selinux_sb_copy_data),
5881 .sb_free_security = selinux_sb_free_security, 5837 LSM_HOOK_INIT(sb_remount, selinux_sb_remount),
5882 .sb_copy_data = selinux_sb_copy_data, 5838 LSM_HOOK_INIT(sb_kern_mount, selinux_sb_kern_mount),
5883 .sb_remount = selinux_sb_remount, 5839 LSM_HOOK_INIT(sb_show_options, selinux_sb_show_options),
5884 .sb_kern_mount = selinux_sb_kern_mount, 5840 LSM_HOOK_INIT(sb_statfs, selinux_sb_statfs),
5885 .sb_show_options = selinux_sb_show_options, 5841 LSM_HOOK_INIT(sb_mount, selinux_mount),
5886 .sb_statfs = selinux_sb_statfs, 5842 LSM_HOOK_INIT(sb_umount, selinux_umount),
5887 .sb_mount = selinux_mount, 5843 LSM_HOOK_INIT(sb_set_mnt_opts, selinux_set_mnt_opts),
5888 .sb_umount = selinux_umount, 5844 LSM_HOOK_INIT(sb_clone_mnt_opts, selinux_sb_clone_mnt_opts),
5889 .sb_set_mnt_opts = selinux_set_mnt_opts, 5845 LSM_HOOK_INIT(sb_parse_opts_str, selinux_parse_opts_str),
5890 .sb_clone_mnt_opts = selinux_sb_clone_mnt_opts, 5846
5891 .sb_parse_opts_str = selinux_parse_opts_str, 5847 LSM_HOOK_INIT(dentry_init_security, selinux_dentry_init_security),
5892 5848
5893 .dentry_init_security = selinux_dentry_init_security, 5849 LSM_HOOK_INIT(inode_alloc_security, selinux_inode_alloc_security),
5894 5850 LSM_HOOK_INIT(inode_free_security, selinux_inode_free_security),
5895 .inode_alloc_security = selinux_inode_alloc_security, 5851 LSM_HOOK_INIT(inode_init_security, selinux_inode_init_security),
5896 .inode_free_security = selinux_inode_free_security, 5852 LSM_HOOK_INIT(inode_create, selinux_inode_create),
5897 .inode_init_security = selinux_inode_init_security, 5853 LSM_HOOK_INIT(inode_link, selinux_inode_link),
5898 .inode_create = selinux_inode_create, 5854 LSM_HOOK_INIT(inode_unlink, selinux_inode_unlink),
5899 .inode_link = selinux_inode_link, 5855 LSM_HOOK_INIT(inode_symlink, selinux_inode_symlink),
5900 .inode_unlink = selinux_inode_unlink, 5856 LSM_HOOK_INIT(inode_mkdir, selinux_inode_mkdir),
5901 .inode_symlink = selinux_inode_symlink, 5857 LSM_HOOK_INIT(inode_rmdir, selinux_inode_rmdir),
5902 .inode_mkdir = selinux_inode_mkdir, 5858 LSM_HOOK_INIT(inode_mknod, selinux_inode_mknod),
5903 .inode_rmdir = selinux_inode_rmdir, 5859 LSM_HOOK_INIT(inode_rename, selinux_inode_rename),
5904 .inode_mknod = selinux_inode_mknod, 5860 LSM_HOOK_INIT(inode_readlink, selinux_inode_readlink),
5905 .inode_rename = selinux_inode_rename, 5861 LSM_HOOK_INIT(inode_follow_link, selinux_inode_follow_link),
5906 .inode_readlink = selinux_inode_readlink, 5862 LSM_HOOK_INIT(inode_permission, selinux_inode_permission),
5907 .inode_follow_link = selinux_inode_follow_link, 5863 LSM_HOOK_INIT(inode_setattr, selinux_inode_setattr),
5908 .inode_permission = selinux_inode_permission, 5864 LSM_HOOK_INIT(inode_getattr, selinux_inode_getattr),
5909 .inode_setattr = selinux_inode_setattr, 5865 LSM_HOOK_INIT(inode_setxattr, selinux_inode_setxattr),
5910 .inode_getattr = selinux_inode_getattr, 5866 LSM_HOOK_INIT(inode_post_setxattr, selinux_inode_post_setxattr),
5911 .inode_setxattr = selinux_inode_setxattr, 5867 LSM_HOOK_INIT(inode_getxattr, selinux_inode_getxattr),
5912 .inode_post_setxattr = selinux_inode_post_setxattr, 5868 LSM_HOOK_INIT(inode_listxattr, selinux_inode_listxattr),
5913 .inode_getxattr = selinux_inode_getxattr, 5869 LSM_HOOK_INIT(inode_removexattr, selinux_inode_removexattr),
5914 .inode_listxattr = selinux_inode_listxattr, 5870 LSM_HOOK_INIT(inode_getsecurity, selinux_inode_getsecurity),
5915 .inode_removexattr = selinux_inode_removexattr, 5871 LSM_HOOK_INIT(inode_setsecurity, selinux_inode_setsecurity),
5916 .inode_getsecurity = selinux_inode_getsecurity, 5872 LSM_HOOK_INIT(inode_listsecurity, selinux_inode_listsecurity),
5917 .inode_setsecurity = selinux_inode_setsecurity, 5873 LSM_HOOK_INIT(inode_getsecid, selinux_inode_getsecid),
5918 .inode_listsecurity = selinux_inode_listsecurity, 5874
5919 .inode_getsecid = selinux_inode_getsecid, 5875 LSM_HOOK_INIT(file_permission, selinux_file_permission),
5920 5876 LSM_HOOK_INIT(file_alloc_security, selinux_file_alloc_security),
5921 .file_permission = selinux_file_permission, 5877 LSM_HOOK_INIT(file_free_security, selinux_file_free_security),
5922 .file_alloc_security = selinux_file_alloc_security, 5878 LSM_HOOK_INIT(file_ioctl, selinux_file_ioctl),
5923 .file_free_security = selinux_file_free_security, 5879 LSM_HOOK_INIT(mmap_file, selinux_mmap_file),
5924 .file_ioctl = selinux_file_ioctl, 5880 LSM_HOOK_INIT(mmap_addr, selinux_mmap_addr),
5925 .mmap_file = selinux_mmap_file, 5881 LSM_HOOK_INIT(file_mprotect, selinux_file_mprotect),
5926 .mmap_addr = selinux_mmap_addr, 5882 LSM_HOOK_INIT(file_lock, selinux_file_lock),
5927 .file_mprotect = selinux_file_mprotect, 5883 LSM_HOOK_INIT(file_fcntl, selinux_file_fcntl),
5928 .file_lock = selinux_file_lock, 5884 LSM_HOOK_INIT(file_set_fowner, selinux_file_set_fowner),
5929 .file_fcntl = selinux_file_fcntl, 5885 LSM_HOOK_INIT(file_send_sigiotask, selinux_file_send_sigiotask),
5930 .file_set_fowner = selinux_file_set_fowner, 5886 LSM_HOOK_INIT(file_receive, selinux_file_receive),
5931 .file_send_sigiotask = selinux_file_send_sigiotask, 5887
5932 .file_receive = selinux_file_receive, 5888 LSM_HOOK_INIT(file_open, selinux_file_open),
5933 5889
5934 .file_open = selinux_file_open, 5890 LSM_HOOK_INIT(task_create, selinux_task_create),
5935 5891 LSM_HOOK_INIT(cred_alloc_blank, selinux_cred_alloc_blank),
5936 .task_create = selinux_task_create, 5892 LSM_HOOK_INIT(cred_free, selinux_cred_free),
5937 .cred_alloc_blank = selinux_cred_alloc_blank, 5893 LSM_HOOK_INIT(cred_prepare, selinux_cred_prepare),
5938 .cred_free = selinux_cred_free, 5894 LSM_HOOK_INIT(cred_transfer, selinux_cred_transfer),
5939 .cred_prepare = selinux_cred_prepare, 5895 LSM_HOOK_INIT(kernel_act_as, selinux_kernel_act_as),
5940 .cred_transfer = selinux_cred_transfer, 5896 LSM_HOOK_INIT(kernel_create_files_as, selinux_kernel_create_files_as),
5941 .kernel_act_as = selinux_kernel_act_as, 5897 LSM_HOOK_INIT(kernel_module_request, selinux_kernel_module_request),
5942 .kernel_create_files_as = selinux_kernel_create_files_as, 5898 LSM_HOOK_INIT(task_setpgid, selinux_task_setpgid),
5943 .kernel_module_request = selinux_kernel_module_request, 5899 LSM_HOOK_INIT(task_getpgid, selinux_task_getpgid),
5944 .task_setpgid = selinux_task_setpgid, 5900 LSM_HOOK_INIT(task_getsid, selinux_task_getsid),
5945 .task_getpgid = selinux_task_getpgid, 5901 LSM_HOOK_INIT(task_getsecid, selinux_task_getsecid),
5946 .task_getsid = selinux_task_getsid, 5902 LSM_HOOK_INIT(task_setnice, selinux_task_setnice),
5947 .task_getsecid = selinux_task_getsecid, 5903 LSM_HOOK_INIT(task_setioprio, selinux_task_setioprio),
5948 .task_setnice = selinux_task_setnice, 5904 LSM_HOOK_INIT(task_getioprio, selinux_task_getioprio),
5949 .task_setioprio = selinux_task_setioprio, 5905 LSM_HOOK_INIT(task_setrlimit, selinux_task_setrlimit),
5950 .task_getioprio = selinux_task_getioprio, 5906 LSM_HOOK_INIT(task_setscheduler, selinux_task_setscheduler),
5951 .task_setrlimit = selinux_task_setrlimit, 5907 LSM_HOOK_INIT(task_getscheduler, selinux_task_getscheduler),
5952 .task_setscheduler = selinux_task_setscheduler, 5908 LSM_HOOK_INIT(task_movememory, selinux_task_movememory),
5953 .task_getscheduler = selinux_task_getscheduler, 5909 LSM_HOOK_INIT(task_kill, selinux_task_kill),
5954 .task_movememory = selinux_task_movememory, 5910 LSM_HOOK_INIT(task_wait, selinux_task_wait),
5955 .task_kill = selinux_task_kill, 5911 LSM_HOOK_INIT(task_to_inode, selinux_task_to_inode),
5956 .task_wait = selinux_task_wait, 5912
5957 .task_to_inode = selinux_task_to_inode, 5913 LSM_HOOK_INIT(ipc_permission, selinux_ipc_permission),
5958 5914 LSM_HOOK_INIT(ipc_getsecid, selinux_ipc_getsecid),
5959 .ipc_permission = selinux_ipc_permission, 5915
5960 .ipc_getsecid = selinux_ipc_getsecid, 5916 LSM_HOOK_INIT(msg_msg_alloc_security, selinux_msg_msg_alloc_security),
5961 5917 LSM_HOOK_INIT(msg_msg_free_security, selinux_msg_msg_free_security),
5962 .msg_msg_alloc_security = selinux_msg_msg_alloc_security, 5918
5963 .msg_msg_free_security = selinux_msg_msg_free_security, 5919 LSM_HOOK_INIT(msg_queue_alloc_security,
5964 5920 selinux_msg_queue_alloc_security),
5965 .msg_queue_alloc_security = selinux_msg_queue_alloc_security, 5921 LSM_HOOK_INIT(msg_queue_free_security, selinux_msg_queue_free_security),
5966 .msg_queue_free_security = selinux_msg_queue_free_security, 5922 LSM_HOOK_INIT(msg_queue_associate, selinux_msg_queue_associate),
5967 .msg_queue_associate = selinux_msg_queue_associate, 5923 LSM_HOOK_INIT(msg_queue_msgctl, selinux_msg_queue_msgctl),
5968 .msg_queue_msgctl = selinux_msg_queue_msgctl, 5924 LSM_HOOK_INIT(msg_queue_msgsnd, selinux_msg_queue_msgsnd),
5969 .msg_queue_msgsnd = selinux_msg_queue_msgsnd, 5925 LSM_HOOK_INIT(msg_queue_msgrcv, selinux_msg_queue_msgrcv),
5970 .msg_queue_msgrcv = selinux_msg_queue_msgrcv, 5926
5971 5927 LSM_HOOK_INIT(shm_alloc_security, selinux_shm_alloc_security),
5972 .shm_alloc_security = selinux_shm_alloc_security, 5928 LSM_HOOK_INIT(shm_free_security, selinux_shm_free_security),
5973 .shm_free_security = selinux_shm_free_security, 5929 LSM_HOOK_INIT(shm_associate, selinux_shm_associate),
5974 .shm_associate = selinux_shm_associate, 5930 LSM_HOOK_INIT(shm_shmctl, selinux_shm_shmctl),
5975 .shm_shmctl = selinux_shm_shmctl, 5931 LSM_HOOK_INIT(shm_shmat, selinux_shm_shmat),
5976 .shm_shmat = selinux_shm_shmat, 5932
5977 5933 LSM_HOOK_INIT(sem_alloc_security, selinux_sem_alloc_security),
5978 .sem_alloc_security = selinux_sem_alloc_security, 5934 LSM_HOOK_INIT(sem_free_security, selinux_sem_free_security),
5979 .sem_free_security = selinux_sem_free_security, 5935 LSM_HOOK_INIT(sem_associate, selinux_sem_associate),
5980 .sem_associate = selinux_sem_associate, 5936 LSM_HOOK_INIT(sem_semctl, selinux_sem_semctl),
5981 .sem_semctl = selinux_sem_semctl, 5937 LSM_HOOK_INIT(sem_semop, selinux_sem_semop),
5982 .sem_semop = selinux_sem_semop, 5938
5983 5939 LSM_HOOK_INIT(d_instantiate, selinux_d_instantiate),
5984 .d_instantiate = selinux_d_instantiate, 5940
5985 5941 LSM_HOOK_INIT(getprocattr, selinux_getprocattr),
5986 .getprocattr = selinux_getprocattr, 5942 LSM_HOOK_INIT(setprocattr, selinux_setprocattr),
5987 .setprocattr = selinux_setprocattr, 5943
5988 5944 LSM_HOOK_INIT(ismaclabel, selinux_ismaclabel),
5989 .ismaclabel = selinux_ismaclabel, 5945 LSM_HOOK_INIT(secid_to_secctx, selinux_secid_to_secctx),
5990 .secid_to_secctx = selinux_secid_to_secctx, 5946 LSM_HOOK_INIT(secctx_to_secid, selinux_secctx_to_secid),
5991 .secctx_to_secid = selinux_secctx_to_secid, 5947 LSM_HOOK_INIT(release_secctx, selinux_release_secctx),
5992 .release_secctx = selinux_release_secctx, 5948 LSM_HOOK_INIT(inode_notifysecctx, selinux_inode_notifysecctx),
5993 .inode_notifysecctx = selinux_inode_notifysecctx, 5949 LSM_HOOK_INIT(inode_setsecctx, selinux_inode_setsecctx),
5994 .inode_setsecctx = selinux_inode_setsecctx, 5950 LSM_HOOK_INIT(inode_getsecctx, selinux_inode_getsecctx),
5995 .inode_getsecctx = selinux_inode_getsecctx, 5951
5996 5952 LSM_HOOK_INIT(unix_stream_connect, selinux_socket_unix_stream_connect),
5997 .unix_stream_connect = selinux_socket_unix_stream_connect, 5953 LSM_HOOK_INIT(unix_may_send, selinux_socket_unix_may_send),
5998 .unix_may_send = selinux_socket_unix_may_send, 5954
5999 5955 LSM_HOOK_INIT(socket_create, selinux_socket_create),
6000 .socket_create = selinux_socket_create, 5956 LSM_HOOK_INIT(socket_post_create, selinux_socket_post_create),
6001 .socket_post_create = selinux_socket_post_create, 5957 LSM_HOOK_INIT(socket_bind, selinux_socket_bind),
6002 .socket_bind = selinux_socket_bind, 5958 LSM_HOOK_INIT(socket_connect, selinux_socket_connect),
6003 .socket_connect = selinux_socket_connect, 5959 LSM_HOOK_INIT(socket_listen, selinux_socket_listen),
6004 .socket_listen = selinux_socket_listen, 5960 LSM_HOOK_INIT(socket_accept, selinux_socket_accept),
6005 .socket_accept = selinux_socket_accept, 5961 LSM_HOOK_INIT(socket_sendmsg, selinux_socket_sendmsg),
6006 .socket_sendmsg = selinux_socket_sendmsg, 5962 LSM_HOOK_INIT(socket_recvmsg, selinux_socket_recvmsg),
6007 .socket_recvmsg = selinux_socket_recvmsg, 5963 LSM_HOOK_INIT(socket_getsockname, selinux_socket_getsockname),
6008 .socket_getsockname = selinux_socket_getsockname, 5964 LSM_HOOK_INIT(socket_getpeername, selinux_socket_getpeername),
6009 .socket_getpeername = selinux_socket_getpeername, 5965 LSM_HOOK_INIT(socket_getsockopt, selinux_socket_getsockopt),
6010 .socket_getsockopt = selinux_socket_getsockopt, 5966 LSM_HOOK_INIT(socket_setsockopt, selinux_socket_setsockopt),
6011 .socket_setsockopt = selinux_socket_setsockopt, 5967 LSM_HOOK_INIT(socket_shutdown, selinux_socket_shutdown),
6012 .socket_shutdown = selinux_socket_shutdown, 5968 LSM_HOOK_INIT(socket_sock_rcv_skb, selinux_socket_sock_rcv_skb),
6013 .socket_sock_rcv_skb = selinux_socket_sock_rcv_skb, 5969 LSM_HOOK_INIT(socket_getpeersec_stream,
6014 .socket_getpeersec_stream = selinux_socket_getpeersec_stream, 5970 selinux_socket_getpeersec_stream),
6015 .socket_getpeersec_dgram = selinux_socket_getpeersec_dgram, 5971 LSM_HOOK_INIT(socket_getpeersec_dgram, selinux_socket_getpeersec_dgram),
6016 .sk_alloc_security = selinux_sk_alloc_security, 5972 LSM_HOOK_INIT(sk_alloc_security, selinux_sk_alloc_security),
6017 .sk_free_security = selinux_sk_free_security, 5973 LSM_HOOK_INIT(sk_free_security, selinux_sk_free_security),
6018 .sk_clone_security = selinux_sk_clone_security, 5974 LSM_HOOK_INIT(sk_clone_security, selinux_sk_clone_security),
6019 .sk_getsecid = selinux_sk_getsecid, 5975 LSM_HOOK_INIT(sk_getsecid, selinux_sk_getsecid),
6020 .sock_graft = selinux_sock_graft, 5976 LSM_HOOK_INIT(sock_graft, selinux_sock_graft),
6021 .inet_conn_request = selinux_inet_conn_request, 5977 LSM_HOOK_INIT(inet_conn_request, selinux_inet_conn_request),
6022 .inet_csk_clone = selinux_inet_csk_clone, 5978 LSM_HOOK_INIT(inet_csk_clone, selinux_inet_csk_clone),
6023 .inet_conn_established = selinux_inet_conn_established, 5979 LSM_HOOK_INIT(inet_conn_established, selinux_inet_conn_established),
6024 .secmark_relabel_packet = selinux_secmark_relabel_packet, 5980 LSM_HOOK_INIT(secmark_relabel_packet, selinux_secmark_relabel_packet),
6025 .secmark_refcount_inc = selinux_secmark_refcount_inc, 5981 LSM_HOOK_INIT(secmark_refcount_inc, selinux_secmark_refcount_inc),
6026 .secmark_refcount_dec = selinux_secmark_refcount_dec, 5982 LSM_HOOK_INIT(secmark_refcount_dec, selinux_secmark_refcount_dec),
6027 .req_classify_flow = selinux_req_classify_flow, 5983 LSM_HOOK_INIT(req_classify_flow, selinux_req_classify_flow),
6028 .tun_dev_alloc_security = selinux_tun_dev_alloc_security, 5984 LSM_HOOK_INIT(tun_dev_alloc_security, selinux_tun_dev_alloc_security),
6029 .tun_dev_free_security = selinux_tun_dev_free_security, 5985 LSM_HOOK_INIT(tun_dev_free_security, selinux_tun_dev_free_security),
6030 .tun_dev_create = selinux_tun_dev_create, 5986 LSM_HOOK_INIT(tun_dev_create, selinux_tun_dev_create),
6031 .tun_dev_attach_queue = selinux_tun_dev_attach_queue, 5987 LSM_HOOK_INIT(tun_dev_attach_queue, selinux_tun_dev_attach_queue),
6032 .tun_dev_attach = selinux_tun_dev_attach, 5988 LSM_HOOK_INIT(tun_dev_attach, selinux_tun_dev_attach),
6033 .tun_dev_open = selinux_tun_dev_open, 5989 LSM_HOOK_INIT(tun_dev_open, selinux_tun_dev_open),
6034 5990
6035#ifdef CONFIG_SECURITY_NETWORK_XFRM 5991#ifdef CONFIG_SECURITY_NETWORK_XFRM
6036 .xfrm_policy_alloc_security = selinux_xfrm_policy_alloc, 5992 LSM_HOOK_INIT(xfrm_policy_alloc_security, selinux_xfrm_policy_alloc),
6037 .xfrm_policy_clone_security = selinux_xfrm_policy_clone, 5993 LSM_HOOK_INIT(xfrm_policy_clone_security, selinux_xfrm_policy_clone),
6038 .xfrm_policy_free_security = selinux_xfrm_policy_free, 5994 LSM_HOOK_INIT(xfrm_policy_free_security, selinux_xfrm_policy_free),
6039 .xfrm_policy_delete_security = selinux_xfrm_policy_delete, 5995 LSM_HOOK_INIT(xfrm_policy_delete_security, selinux_xfrm_policy_delete),
6040 .xfrm_state_alloc = selinux_xfrm_state_alloc, 5996 LSM_HOOK_INIT(xfrm_state_alloc, selinux_xfrm_state_alloc),
6041 .xfrm_state_alloc_acquire = selinux_xfrm_state_alloc_acquire, 5997 LSM_HOOK_INIT(xfrm_state_alloc_acquire,
6042 .xfrm_state_free_security = selinux_xfrm_state_free, 5998 selinux_xfrm_state_alloc_acquire),
6043 .xfrm_state_delete_security = selinux_xfrm_state_delete, 5999 LSM_HOOK_INIT(xfrm_state_free_security, selinux_xfrm_state_free),
6044 .xfrm_policy_lookup = selinux_xfrm_policy_lookup, 6000 LSM_HOOK_INIT(xfrm_state_delete_security, selinux_xfrm_state_delete),
6045 .xfrm_state_pol_flow_match = selinux_xfrm_state_pol_flow_match, 6001 LSM_HOOK_INIT(xfrm_policy_lookup, selinux_xfrm_policy_lookup),
6046 .xfrm_decode_session = selinux_xfrm_decode_session, 6002 LSM_HOOK_INIT(xfrm_state_pol_flow_match,
6003 selinux_xfrm_state_pol_flow_match),
6004 LSM_HOOK_INIT(xfrm_decode_session, selinux_xfrm_decode_session),
6047#endif 6005#endif
6048 6006
6049#ifdef CONFIG_KEYS 6007#ifdef CONFIG_KEYS
6050 .key_alloc = selinux_key_alloc, 6008 LSM_HOOK_INIT(key_alloc, selinux_key_alloc),
6051 .key_free = selinux_key_free, 6009 LSM_HOOK_INIT(key_free, selinux_key_free),
6052 .key_permission = selinux_key_permission, 6010 LSM_HOOK_INIT(key_permission, selinux_key_permission),
6053 .key_getsecurity = selinux_key_getsecurity, 6011 LSM_HOOK_INIT(key_getsecurity, selinux_key_getsecurity),
6054#endif 6012#endif
6055 6013
6056#ifdef CONFIG_AUDIT 6014#ifdef CONFIG_AUDIT
6057 .audit_rule_init = selinux_audit_rule_init, 6015 LSM_HOOK_INIT(audit_rule_init, selinux_audit_rule_init),
6058 .audit_rule_known = selinux_audit_rule_known, 6016 LSM_HOOK_INIT(audit_rule_known, selinux_audit_rule_known),
6059 .audit_rule_match = selinux_audit_rule_match, 6017 LSM_HOOK_INIT(audit_rule_match, selinux_audit_rule_match),
6060 .audit_rule_free = selinux_audit_rule_free, 6018 LSM_HOOK_INIT(audit_rule_free, selinux_audit_rule_free),
6061#endif 6019#endif
6062}; 6020};
6063 6021
6064static __init int selinux_init(void) 6022static __init int selinux_init(void)
6065{ 6023{
6066 if (!security_module_enable(&selinux_ops)) { 6024 if (!security_module_enable("selinux")) {
6067 selinux_enabled = 0; 6025 selinux_enabled = 0;
6068 return 0; 6026 return 0;
6069 } 6027 }
@@ -6085,8 +6043,7 @@ static __init int selinux_init(void)
6085 0, SLAB_PANIC, NULL); 6043 0, SLAB_PANIC, NULL);
6086 avc_init(); 6044 avc_init();
6087 6045
6088 if (register_security(&selinux_ops)) 6046 security_add_hooks(selinux_hooks, ARRAY_SIZE(selinux_hooks));
6089 panic("SELinux: Unable to register with kernel.\n");
6090 6047
6091 if (avc_add_callback(selinux_netcache_avc_callback, AVC_CALLBACK_RESET)) 6048 if (avc_add_callback(selinux_netcache_avc_callback, AVC_CALLBACK_RESET))
6092 panic("SELinux: Unable to register AVC netcache callback\n"); 6049 panic("SELinux: Unable to register AVC netcache callback\n");
@@ -6214,7 +6171,7 @@ int selinux_disable(void)
6214 selinux_disabled = 1; 6171 selinux_disabled = 1;
6215 selinux_enabled = 0; 6172 selinux_enabled = 0;
6216 6173
6217 reset_security_ops(); 6174 security_delete_hooks(selinux_hooks, ARRAY_SIZE(selinux_hooks));
6218 6175
6219 /* Try to destroy the avc node cache */ 6176 /* Try to destroy the avc node cache */
6220 avc_disable(); 6177 avc_disable();