Merge tag 'selinux-pr-20170831' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux updates from Paul Moore: "A relatively quiet period for SELinux, 11 patches with only two/three having any substantive changes. These noteworthy changes include another tweak to the NNP/nosuid handling, per-file labeling for cgroups, and an object class fix for AF_UNIX/SOCK_RAW sockets; the rest of the changes are minor tweaks or administrative updates (Stephen's email update explains the file explosion in the diffstat). Everything passes the selinux-testsuite" [ Also a couple of small patches from the security tree from Tetsuo Handa for Tomoyo and LSM cleanup. The separation of security policy updates wasn't all that clean - Linus ] * tag 'selinux-pr-20170831' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: constify nf_hook_ops selinux: allow per-file labeling for cgroupfs lsm_audit: update my email address selinux: update my email address MAINTAINERS: update the NetLabel and Labeled Networking information selinux: use GFP_NOWAIT in the AVC kmem_caches selinux: Generalize support for NNP/nosuid SELinux domain transitions selinux: genheaders should fail if too many permissions are defined selinux: update the selinux info in MAINTAINERS credits: update Paul Moore's info selinux: Assign proper class to PF_UNIX/SOCK_RAW sockets tomoyo: Update URLs in Documentation/admin-guide/LSM/tomoyo.rst LSM: Remove security_task_create() hook.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the kernel access vector cache (AVC).
|
||||
*
|
||||
* Authors: Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Authors: Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
* James Morris <jmorris@redhat.com>
|
||||
*
|
||||
* Update: KaiGai, Kohei <kaigai@ak.jp.nec.com>
|
||||
@@ -346,27 +346,26 @@ static struct avc_xperms_decision_node
|
||||
struct avc_xperms_decision_node *xpd_node;
|
||||
struct extended_perms_decision *xpd;
|
||||
|
||||
xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep,
|
||||
GFP_ATOMIC | __GFP_NOMEMALLOC);
|
||||
xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep, GFP_NOWAIT);
|
||||
if (!xpd_node)
|
||||
return NULL;
|
||||
|
||||
xpd = &xpd_node->xpd;
|
||||
if (which & XPERMS_ALLOWED) {
|
||||
xpd->allowed = kmem_cache_zalloc(avc_xperms_data_cachep,
|
||||
GFP_ATOMIC | __GFP_NOMEMALLOC);
|
||||
GFP_NOWAIT);
|
||||
if (!xpd->allowed)
|
||||
goto error;
|
||||
}
|
||||
if (which & XPERMS_AUDITALLOW) {
|
||||
xpd->auditallow = kmem_cache_zalloc(avc_xperms_data_cachep,
|
||||
GFP_ATOMIC | __GFP_NOMEMALLOC);
|
||||
GFP_NOWAIT);
|
||||
if (!xpd->auditallow)
|
||||
goto error;
|
||||
}
|
||||
if (which & XPERMS_DONTAUDIT) {
|
||||
xpd->dontaudit = kmem_cache_zalloc(avc_xperms_data_cachep,
|
||||
GFP_ATOMIC | __GFP_NOMEMALLOC);
|
||||
GFP_NOWAIT);
|
||||
if (!xpd->dontaudit)
|
||||
goto error;
|
||||
}
|
||||
@@ -394,8 +393,7 @@ static struct avc_xperms_node *avc_xperms_alloc(void)
|
||||
{
|
||||
struct avc_xperms_node *xp_node;
|
||||
|
||||
xp_node = kmem_cache_zalloc(avc_xperms_cachep,
|
||||
GFP_ATOMIC|__GFP_NOMEMALLOC);
|
||||
xp_node = kmem_cache_zalloc(avc_xperms_cachep, GFP_NOWAIT);
|
||||
if (!xp_node)
|
||||
return xp_node;
|
||||
INIT_LIST_HEAD(&xp_node->xpd_head);
|
||||
@@ -548,7 +546,7 @@ static struct avc_node *avc_alloc_node(void)
|
||||
{
|
||||
struct avc_node *node;
|
||||
|
||||
node = kmem_cache_zalloc(avc_node_cachep, GFP_ATOMIC|__GFP_NOMEMALLOC);
|
||||
node = kmem_cache_zalloc(avc_node_cachep, GFP_NOWAIT);
|
||||
if (!node)
|
||||
goto out;
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This file contains the SELinux hook function implementations.
|
||||
*
|
||||
* Authors: Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Authors: Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
* Chris Vance, <cvance@nai.com>
|
||||
* Wayne Salamon, <wsalamon@nai.com>
|
||||
* James Morris <jmorris@redhat.com>
|
||||
@@ -815,7 +815,9 @@ static int selinux_set_mnt_opts(struct super_block *sb,
|
||||
if (!strcmp(sb->s_type->name, "debugfs") ||
|
||||
!strcmp(sb->s_type->name, "tracefs") ||
|
||||
!strcmp(sb->s_type->name, "sysfs") ||
|
||||
!strcmp(sb->s_type->name, "pstore"))
|
||||
!strcmp(sb->s_type->name, "pstore") ||
|
||||
!strcmp(sb->s_type->name, "cgroup") ||
|
||||
!strcmp(sb->s_type->name, "cgroup2"))
|
||||
sbsec->flags |= SE_SBGENFS;
|
||||
|
||||
if (!sbsec->behavior) {
|
||||
@@ -1303,6 +1305,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
|
||||
case SOCK_SEQPACKET:
|
||||
return SECCLASS_UNIX_STREAM_SOCKET;
|
||||
case SOCK_DGRAM:
|
||||
case SOCK_RAW:
|
||||
return SECCLASS_UNIX_DGRAM_SOCKET;
|
||||
}
|
||||
break;
|
||||
@@ -2317,6 +2320,7 @@ static int check_nnp_nosuid(const struct linux_binprm *bprm,
|
||||
int nnp = (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS);
|
||||
int nosuid = !mnt_may_suid(bprm->file->f_path.mnt);
|
||||
int rc;
|
||||
u32 av;
|
||||
|
||||
if (!nnp && !nosuid)
|
||||
return 0; /* neither NNP nor nosuid */
|
||||
@@ -2325,24 +2329,40 @@ static int check_nnp_nosuid(const struct linux_binprm *bprm,
|
||||
return 0; /* No change in credentials */
|
||||
|
||||
/*
|
||||
* The only transitions we permit under NNP or nosuid
|
||||
* are transitions to bounded SIDs, i.e. SIDs that are
|
||||
* guaranteed to only be allowed a subset of the permissions
|
||||
* of the current SID.
|
||||
* If the policy enables the nnp_nosuid_transition policy capability,
|
||||
* then we permit transitions under NNP or nosuid if the
|
||||
* policy allows the corresponding permission between
|
||||
* the old and new contexts.
|
||||
*/
|
||||
if (selinux_policycap_nnp_nosuid_transition) {
|
||||
av = 0;
|
||||
if (nnp)
|
||||
av |= PROCESS2__NNP_TRANSITION;
|
||||
if (nosuid)
|
||||
av |= PROCESS2__NOSUID_TRANSITION;
|
||||
rc = avc_has_perm(old_tsec->sid, new_tsec->sid,
|
||||
SECCLASS_PROCESS2, av, NULL);
|
||||
if (!rc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We also permit NNP or nosuid transitions to bounded SIDs,
|
||||
* i.e. SIDs that are guaranteed to only be allowed a subset
|
||||
* of the permissions of the current SID.
|
||||
*/
|
||||
rc = security_bounded_transition(old_tsec->sid, new_tsec->sid);
|
||||
if (rc) {
|
||||
/*
|
||||
* On failure, preserve the errno values for NNP vs nosuid.
|
||||
* NNP: Operation not permitted for caller.
|
||||
* nosuid: Permission denied to file.
|
||||
*/
|
||||
if (nnp)
|
||||
return -EPERM;
|
||||
else
|
||||
return -EACCES;
|
||||
}
|
||||
return 0;
|
||||
if (!rc)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* On failure, preserve the errno values for NNP vs nosuid.
|
||||
* NNP: Operation not permitted for caller.
|
||||
* nosuid: Permission denied to file.
|
||||
*/
|
||||
if (nnp)
|
||||
return -EPERM;
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
static int selinux_bprm_set_creds(struct linux_binprm *bprm)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Access vector cache interface for object managers.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SELINUX_AVC_H_
|
||||
#define _SELINUX_AVC_H_
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Access vector cache interface for the security server.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SELINUX_AVC_SS_H_
|
||||
#define _SELINUX_AVC_SS_H_
|
||||
|
@@ -48,6 +48,8 @@ struct security_class_mapping secclass_map[] = {
|
||||
"setrlimit", "rlimitinh", "dyntransition", "setcurrent",
|
||||
"execmem", "execstack", "execheap", "setkeycreate",
|
||||
"setsockcreate", "getrlimit", NULL } },
|
||||
{ "process2",
|
||||
{ "nnp_transition", "nosuid_transition", NULL } },
|
||||
{ "system",
|
||||
{ "ipc_info", "syslog_read", "syslog_mod",
|
||||
"syslog_console", "module_request", "module_load", NULL } },
|
||||
|
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This file contains the SELinux security data structures for kernel objects.
|
||||
*
|
||||
* Author(s): Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author(s): Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
* Chris Vance, <cvance@nai.com>
|
||||
* Wayne Salamon, <wsalamon@nai.com>
|
||||
* James Morris <jmorris@redhat.com>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Security server interface.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -73,6 +73,7 @@ enum {
|
||||
POLICYDB_CAPABILITY_EXTSOCKCLASS,
|
||||
POLICYDB_CAPABILITY_ALWAYSNETWORK,
|
||||
POLICYDB_CAPABILITY_CGROUPSECLABEL,
|
||||
POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION,
|
||||
__POLICYDB_CAPABILITY_MAX
|
||||
};
|
||||
#define POLICYDB_CAPABILITY_MAX (__POLICYDB_CAPABILITY_MAX - 1)
|
||||
@@ -84,6 +85,7 @@ extern int selinux_policycap_openperm;
|
||||
extern int selinux_policycap_extsockclass;
|
||||
extern int selinux_policycap_alwaysnetwork;
|
||||
extern int selinux_policycap_cgroupseclabel;
|
||||
extern int selinux_policycap_nnp_nosuid_transition;
|
||||
|
||||
/*
|
||||
* type_datum properties
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the access vector table type.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
|
||||
/* Updated: Frank Mayer <mayerf@tresys.com> and Karl MacMillan <kmacmillan@tresys.com>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* table is used to represent the type enforcement
|
||||
* tables.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
|
||||
/* Updated: Frank Mayer <mayerf@tresys.com> and Karl MacMillan <kmacmillan@tresys.com>
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* process from labeling an object with a different user
|
||||
* identity.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SS_CONSTRAINT_H_
|
||||
#define _SS_CONSTRAINT_H_
|
||||
|
@@ -10,7 +10,7 @@
|
||||
* security server and can be changed without affecting
|
||||
* clients of the security server.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SS_CONTEXT_H_
|
||||
#define _SS_CONTEXT_H_
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the extensible bitmap type.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
/*
|
||||
* Updated: Hewlett-Packard <paul@paul-moore.com>
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* an explicitly specified starting bit position within
|
||||
* the total bitmap.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SS_EBITMAP_H_
|
||||
#define _SS_EBITMAP_H_
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the hash table type.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* functions for hash computation and key comparison are
|
||||
* provided by the creator of the table.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SS_HASHTAB_H_
|
||||
#define _SS_HASHTAB_H_
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the multi-level security (MLS) policy.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
/*
|
||||
* Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Multi-level security (MLS) policy operations.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
/*
|
||||
* Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Type definitions for the multi-level security (MLS) policy.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
/*
|
||||
* Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the policy database.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* A policy database (policydb) specifies the
|
||||
* configuration data for the security policy.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the security services.
|
||||
*
|
||||
* Authors : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Authors : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
* James Morris <jmorris@redhat.com>
|
||||
*
|
||||
* Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
|
||||
@@ -76,7 +76,8 @@ char *selinux_policycap_names[__POLICYDB_CAPABILITY_MAX] = {
|
||||
"open_perms",
|
||||
"extended_socket_class",
|
||||
"always_check_network",
|
||||
"cgroup_seclabel"
|
||||
"cgroup_seclabel",
|
||||
"nnp_nosuid_transition"
|
||||
};
|
||||
|
||||
int selinux_policycap_netpeer;
|
||||
@@ -84,6 +85,7 @@ int selinux_policycap_openperm;
|
||||
int selinux_policycap_extsockclass;
|
||||
int selinux_policycap_alwaysnetwork;
|
||||
int selinux_policycap_cgroupseclabel;
|
||||
int selinux_policycap_nnp_nosuid_transition;
|
||||
|
||||
static DEFINE_RWLOCK(policy_rwlock);
|
||||
|
||||
@@ -2009,6 +2011,9 @@ static void security_load_policycaps(void)
|
||||
selinux_policycap_cgroupseclabel =
|
||||
ebitmap_get_bit(&policydb.policycaps,
|
||||
POLICYDB_CAPABILITY_CGROUPSECLABEL);
|
||||
selinux_policycap_nnp_nosuid_transition =
|
||||
ebitmap_get_bit(&policydb.policycaps,
|
||||
POLICYDB_CAPABILITY_NNP_NOSUID_TRANSITION);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(selinux_policycap_names); i++)
|
||||
pr_info("SELinux: policy capability %s=%d\n",
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the security services.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SS_SERVICES_H_
|
||||
#define _SS_SERVICES_H_
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the SID table type.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/slab.h>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* A security identifier table (sidtab) is a hash table
|
||||
* of security context structures indexed by SID value.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SS_SIDTAB_H_
|
||||
#define _SS_SIDTAB_H_
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Implementation of the symbol table type.
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* is arbitrary. The symbol table type is implemented
|
||||
* using the hash table type (hashtab).
|
||||
*
|
||||
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
|
||||
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
|
||||
*/
|
||||
#ifndef _SS_SYMTAB_H_
|
||||
#define _SS_SYMTAB_H_
|
||||
|
Reference in New Issue
Block a user