aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux/hooks.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2017-05-02 05:02:41 -0400
committerJiri Kosina <jkosina@suse.cz>2017-05-02 05:02:41 -0400
commit4d6ca227c768b50b05cf183974b40abe444e9d0c (patch)
treebf953d8e895281053548b9967a2c4b58d641df00 /security/selinux/hooks.c
parent800f3eef8ebc1264e9c135bfa892c8ae41fa4792 (diff)
parentaf22a610bc38508d5ea760507d31be6b6983dfa8 (diff)
Merge branch 'for-4.12/asus' into for-linus
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r--security/selinux/hooks.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 9bc12bcddc2c..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)
@@ -1401,7 +1403,9 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
1401 return SECCLASS_KCM_SOCKET; 1403 return SECCLASS_KCM_SOCKET;
1402 case PF_QIPCRTR: 1404 case PF_QIPCRTR:
1403 return SECCLASS_QIPCRTR_SOCKET; 1405 return SECCLASS_QIPCRTR_SOCKET;
1404#if PF_MAX > 43 1406 case PF_SMC:
1407 return SECCLASS_SMC_SOCKET;
1408#if PF_MAX > 44
1405#error New address family defined, please update this function. 1409#error New address family defined, please update this function.
1406#endif 1410#endif
1407 } 1411 }
@@ -2397,8 +2401,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm)
2397 2401
2398 /* Make sure that anyone attempting to ptrace over a task that 2402 /* Make sure that anyone attempting to ptrace over a task that
2399 * changes its SID has the appropriate permit */ 2403 * changes its SID has the appropriate permit */
2400 if (bprm->unsafe & 2404 if (bprm->unsafe & LSM_UNSAFE_PTRACE) {
2401 (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
2402 u32 ptsid = ptrace_parent_sid(); 2405 u32 ptsid = ptrace_parent_sid();
2403 if (ptsid != 0) { 2406 if (ptsid != 0) {
2404 rc = avc_has_perm(ptsid, new_tsec->sid, 2407 rc = avc_has_perm(ptsid, new_tsec->sid,
@@ -4363,7 +4366,8 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in
4363 4366
4364 inet_get_local_port_range(sock_net(sk), &low, &high); 4367 inet_get_local_port_range(sock_net(sk), &low, &high);
4365 4368
4366 if (snum < max(PROT_SOCK, low) || snum > high) { 4369 if (snum < max(inet_prot_sock(sock_net(sk)), low) ||
4370 snum > high) {
4367 err = sel_netport_sid(sk->sk_protocol, 4371 err = sel_netport_sid(sk->sk_protocol,
4368 snum, &sid); 4372 snum, &sid);
4369 if (err) 4373 if (err)