aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e6b1b7410321..0c2ac318aa7f 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -28,7 +28,8 @@
28#include <linux/kernel.h> 28#include <linux/kernel.h>
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/signal.h>
32#include <linux/sched/task.h>
32#include <linux/lsm_hooks.h> 33#include <linux/lsm_hooks.h>
33#include <linux/xattr.h> 34#include <linux/xattr.h>
34#include <linux/capability.h> 35#include <linux/capability.h>
@@ -480,12 +481,13 @@ static int selinux_is_sblabel_mnt(struct super_block *sb)
480 sbsec->behavior == SECURITY_FS_USE_NATIVE || 481 sbsec->behavior == SECURITY_FS_USE_NATIVE ||
481 /* Special handling. Genfs but also in-core setxattr handler */ 482 /* Special handling. Genfs but also in-core setxattr handler */
482 !strcmp(sb->s_type->name, "sysfs") || 483 !strcmp(sb->s_type->name, "sysfs") ||
483 !strcmp(sb->s_type->name, "cgroup") ||
484 !strcmp(sb->s_type->name, "cgroup2") ||
485 !strcmp(sb->s_type->name, "pstore") || 484 !strcmp(sb->s_type->name, "pstore") ||
486 !strcmp(sb->s_type->name, "debugfs") || 485 !strcmp(sb->s_type->name, "debugfs") ||
487 !strcmp(sb->s_type->name, "tracefs") || 486 !strcmp(sb->s_type->name, "tracefs") ||
488 !strcmp(sb->s_type->name, "rootfs"); 487 !strcmp(sb->s_type->name, "rootfs") ||
488 (selinux_policycap_cgroupseclabel &&
489 (!strcmp(sb->s_type->name, "cgroup") ||
490 !strcmp(sb->s_type->name, "cgroup2")));
489} 491}
490 492
491static int sb_finish_set_opts(struct super_block *sb) 493static int sb_finish_set_opts(struct super_block *sb)
@@ -2399,8 +2401,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
2399 2401
2400 /* Make sure that anyone attempting to ptrace over a task that 2402 /* Make sure that anyone attempting to ptrace over a task that
2401 * changes its SID has the appropriate permit */ 2403 * changes its SID has the appropriate permit */
2402 if (bprm->unsafe & 2404 if (bprm->unsafe & LSM_UNSAFE_PTRACE) {
2403 (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
2404 u32 ptsid = ptrace_parent_sid(); 2405 u32 ptsid = ptrace_parent_sid();
2405 if (ptsid != 0) { 2406 if (ptsid != 0) {
2406 rc = avc_has_perm(ptsid, new_tsec->sid, 2407 rc = avc_has_perm(ptsid, new_tsec->sid,