diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-07-28 10:26:31 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-07-28 10:26:31 -0400 |
| commit | b7d0b6784565b846f3562608dfb3cf8516718724 (patch) | |
| tree | 50a4931ce7e62e78b664bb8f43da2f4508c319f9 /security/selinux/hooks.c | |
| parent | cdcf772ed163651cacac8098b4974aba7f9e1c73 (diff) | |
| parent | c9272c4f9fbe2087beb3392f526dc5b19efaa56b (diff) | |
Merge branch 'linus' into x86/cpu
Conflicts:
arch/x86/kernel/cpu/intel_cacheinfo.c
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'security/selinux/hooks.c')
| -rw-r--r-- | security/selinux/hooks.c | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 63f131fc42e4..40d06c533f89 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
| 27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
| 28 | #include <linux/ptrace.h> | 28 | #include <linux/tracehook.h> |
| 29 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
| 30 | #include <linux/sched.h> | 30 | #include <linux/sched.h> |
| 31 | #include <linux/security.h> | 31 | #include <linux/security.h> |
| @@ -1971,22 +1971,6 @@ static int selinux_vm_enough_memory(struct mm_struct *mm, long pages) | |||
| 1971 | return __vm_enough_memory(mm, pages, cap_sys_admin); | 1971 | return __vm_enough_memory(mm, pages, cap_sys_admin); |
| 1972 | } | 1972 | } |
| 1973 | 1973 | ||
| 1974 | /** | ||
| 1975 | * task_tracer_task - return the task that is tracing the given task | ||
| 1976 | * @task: task to consider | ||
| 1977 | * | ||
| 1978 | * Returns NULL if noone is tracing @task, or the &struct task_struct | ||
| 1979 | * pointer to its tracer. | ||
| 1980 | * | ||
| 1981 | * Must be called under rcu_read_lock(). | ||
| 1982 | */ | ||
| 1983 | static struct task_struct *task_tracer_task(struct task_struct *task) | ||
| 1984 | { | ||
| 1985 | if (task->ptrace & PT_PTRACED) | ||
| 1986 | return rcu_dereference(task->parent); | ||
| 1987 | return NULL; | ||
| 1988 | } | ||
| 1989 | |||
| 1990 | /* binprm security operations */ | 1974 | /* binprm security operations */ |
| 1991 | 1975 | ||
| 1992 | static int selinux_bprm_alloc_security(struct linux_binprm *bprm) | 1976 | static int selinux_bprm_alloc_security(struct linux_binprm *bprm) |
| @@ -2238,7 +2222,7 @@ static void selinux_bprm_apply_creds(struct linux_binprm *bprm, int unsafe) | |||
| 2238 | u32 ptsid = 0; | 2222 | u32 ptsid = 0; |
| 2239 | 2223 | ||
| 2240 | rcu_read_lock(); | 2224 | rcu_read_lock(); |
| 2241 | tracer = task_tracer_task(current); | 2225 | tracer = tracehook_tracer_task(current); |
| 2242 | if (likely(tracer != NULL)) { | 2226 | if (likely(tracer != NULL)) { |
| 2243 | sec = tracer->security; | 2227 | sec = tracer->security; |
| 2244 | ptsid = sec->sid; | 2228 | ptsid = sec->sid; |
| @@ -2640,12 +2624,11 @@ static int selinux_inode_follow_link(struct dentry *dentry, struct nameidata *na | |||
| 2640 | return dentry_has_perm(current, NULL, dentry, FILE__READ); | 2624 | return dentry_has_perm(current, NULL, dentry, FILE__READ); |
| 2641 | } | 2625 | } |
| 2642 | 2626 | ||
| 2643 | static int selinux_inode_permission(struct inode *inode, int mask, | 2627 | static int selinux_inode_permission(struct inode *inode, int mask) |
| 2644 | struct nameidata *nd) | ||
| 2645 | { | 2628 | { |
| 2646 | int rc; | 2629 | int rc; |
| 2647 | 2630 | ||
| 2648 | rc = secondary_ops->inode_permission(inode, mask, nd); | 2631 | rc = secondary_ops->inode_permission(inode, mask); |
| 2649 | if (rc) | 2632 | if (rc) |
| 2650 | return rc; | 2633 | return rc; |
| 2651 | 2634 | ||
| @@ -5247,7 +5230,7 @@ static int selinux_setprocattr(struct task_struct *p, | |||
| 5247 | Otherwise, leave SID unchanged and fail. */ | 5230 | Otherwise, leave SID unchanged and fail. */ |
| 5248 | task_lock(p); | 5231 | task_lock(p); |
| 5249 | rcu_read_lock(); | 5232 | rcu_read_lock(); |
| 5250 | tracer = task_tracer_task(p); | 5233 | tracer = tracehook_tracer_task(p); |
| 5251 | if (tracer != NULL) { | 5234 | if (tracer != NULL) { |
| 5252 | struct task_security_struct *ptsec = tracer->security; | 5235 | struct task_security_struct *ptsec = tracer->security; |
| 5253 | u32 ptsid = ptsec->sid; | 5236 | u32 ptsid = ptsec->sid; |
| @@ -5670,27 +5653,20 @@ static struct nf_hook_ops selinux_ipv6_ops[] = { | |||
| 5670 | static int __init selinux_nf_ip_init(void) | 5653 | static int __init selinux_nf_ip_init(void) |
| 5671 | { | 5654 | { |
| 5672 | int err = 0; | 5655 | int err = 0; |
| 5673 | u32 iter; | ||
| 5674 | 5656 | ||
| 5675 | if (!selinux_enabled) | 5657 | if (!selinux_enabled) |
| 5676 | goto out; | 5658 | goto out; |
| 5677 | 5659 | ||
| 5678 | printk(KERN_DEBUG "SELinux: Registering netfilter hooks\n"); | 5660 | printk(KERN_DEBUG "SELinux: Registering netfilter hooks\n"); |
| 5679 | 5661 | ||
| 5680 | for (iter = 0; iter < ARRAY_SIZE(selinux_ipv4_ops); iter++) { | 5662 | err = nf_register_hooks(selinux_ipv4_ops, ARRAY_SIZE(selinux_ipv4_ops)); |
| 5681 | err = nf_register_hook(&selinux_ipv4_ops[iter]); | 5663 | if (err) |
| 5682 | if (err) | 5664 | panic("SELinux: nf_register_hooks for IPv4: error %d\n", err); |
| 5683 | panic("SELinux: nf_register_hook for IPv4: error %d\n", | ||
| 5684 | err); | ||
| 5685 | } | ||
| 5686 | 5665 | ||
| 5687 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 5666 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 5688 | for (iter = 0; iter < ARRAY_SIZE(selinux_ipv6_ops); iter++) { | 5667 | err = nf_register_hooks(selinux_ipv6_ops, ARRAY_SIZE(selinux_ipv6_ops)); |
| 5689 | err = nf_register_hook(&selinux_ipv6_ops[iter]); | 5668 | if (err) |
| 5690 | if (err) | 5669 | panic("SELinux: nf_register_hooks for IPv6: error %d\n", err); |
| 5691 | panic("SELinux: nf_register_hook for IPv6: error %d\n", | ||
| 5692 | err); | ||
| 5693 | } | ||
| 5694 | #endif /* IPV6 */ | 5670 | #endif /* IPV6 */ |
| 5695 | 5671 | ||
| 5696 | out: | 5672 | out: |
| @@ -5702,15 +5678,11 @@ __initcall(selinux_nf_ip_init); | |||
| 5702 | #ifdef CONFIG_SECURITY_SELINUX_DISABLE | 5678 | #ifdef CONFIG_SECURITY_SELINUX_DISABLE |
| 5703 | static void selinux_nf_ip_exit(void) | 5679 | static void selinux_nf_ip_exit(void) |
| 5704 | { | 5680 | { |
| 5705 | u32 iter; | ||
| 5706 | |||
| 5707 | printk(KERN_DEBUG "SELinux: Unregistering netfilter hooks\n"); | 5681 | printk(KERN_DEBUG "SELinux: Unregistering netfilter hooks\n"); |
| 5708 | 5682 | ||
| 5709 | for (iter = 0; iter < ARRAY_SIZE(selinux_ipv4_ops); iter++) | 5683 | nf_unregister_hooks(selinux_ipv4_ops, ARRAY_SIZE(selinux_ipv4_ops)); |
| 5710 | nf_unregister_hook(&selinux_ipv4_ops[iter]); | ||
| 5711 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 5684 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
| 5712 | for (iter = 0; iter < ARRAY_SIZE(selinux_ipv6_ops); iter++) | 5685 | nf_unregister_hooks(selinux_ipv6_ops, ARRAY_SIZE(selinux_ipv6_ops)); |
| 5713 | nf_unregister_hook(&selinux_ipv6_ops[iter]); | ||
| 5714 | #endif /* IPV6 */ | 5686 | #endif /* IPV6 */ |
| 5715 | } | 5687 | } |
| 5716 | #endif | 5688 | #endif |
