Skip to content

Commit 7f85565

Browse files
committed
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.
2 parents 680352b + 0c3014f commit 7f85565

36 files changed

+117
-104
lines changed

Diff for: CREDITS

+3-5
Original file line numberDiff line numberDiff line change
@@ -2606,11 +2606,9 @@ E: [email protected]
26062606
D: bug fixes, documentation, minor hackery
26072607

26082608
N: Paul Moore
2609-
2610-
D: NetLabel author
2611-
S: Hewlett-Packard
2612-
S: 110 Spit Brook Road
2613-
S: Nashua, NH 03062
2609+
2610+
W: http://www.paul-moore.com
2611+
D: NetLabel, SELinux, audit
26142612

26152613
N: James Morris
26162614

Diff for: Documentation/admin-guide/LSM/tomoyo.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ TOMOYO is a name-based MAC extension (LSM module) for the Linux kernel.
99

1010
LiveCD-based tutorials are available at
1111

12-
http://tomoyo.sourceforge.jp/1.7/1st-step/ubuntu10.04-live/
13-
http://tomoyo.sourceforge.jp/1.7/1st-step/centos5-live/
12+
http://tomoyo.sourceforge.jp/1.8/ubuntu12.04-live.html
13+
http://tomoyo.sourceforge.jp/1.8/centos6-live.html
1414

1515
Though these tutorials use non-LSM version of TOMOYO, they are useful for you
1616
to know what TOMOYO is.
@@ -21,35 +21,35 @@ How to enable TOMOYO?
2121
Build the kernel with ``CONFIG_SECURITY_TOMOYO=y`` and pass ``security=tomoyo`` on
2222
kernel's command line.
2323

24-
Please see http://tomoyo.sourceforge.jp/2.3/ for details.
24+
Please see http://tomoyo.osdn.jp/2.5/ for details.
2525

2626
Where is documentation?
2727
=======================
2828

2929
User <-> Kernel interface documentation is available at
30-
http://tomoyo.sourceforge.jp/2.3/policy-reference.html .
30+
http://tomoyo.osdn.jp/2.5/policy-specification/index.html .
3131

3232
Materials we prepared for seminars and symposiums are available at
33-
http://sourceforge.jp/projects/tomoyo/docs/?category_id=532&language_id=1 .
33+
http://osdn.jp/projects/tomoyo/docs/?category_id=532&language_id=1 .
3434
Below lists are chosen from three aspects.
3535

3636
What is TOMOYO?
3737
TOMOYO Linux Overview
38-
http://sourceforge.jp/projects/tomoyo/docs/lca2009-takeda.pdf
38+
http://osdn.jp/projects/tomoyo/docs/lca2009-takeda.pdf
3939
TOMOYO Linux: pragmatic and manageable security for Linux
40-
http://sourceforge.jp/projects/tomoyo/docs/freedomhectaipei-tomoyo.pdf
40+
http://osdn.jp/projects/tomoyo/docs/freedomhectaipei-tomoyo.pdf
4141
TOMOYO Linux: A Practical Method to Understand and Protect Your Own Linux Box
42-
http://sourceforge.jp/projects/tomoyo/docs/PacSec2007-en-no-demo.pdf
42+
http://osdn.jp/projects/tomoyo/docs/PacSec2007-en-no-demo.pdf
4343

4444
What can TOMOYO do?
4545
Deep inside TOMOYO Linux
46-
http://sourceforge.jp/projects/tomoyo/docs/lca2009-kumaneko.pdf
46+
http://osdn.jp/projects/tomoyo/docs/lca2009-kumaneko.pdf
4747
The role of "pathname based access control" in security.
48-
http://sourceforge.jp/projects/tomoyo/docs/lfj2008-bof.pdf
48+
http://osdn.jp/projects/tomoyo/docs/lfj2008-bof.pdf
4949

5050
History of TOMOYO?
5151
Realities of Mainlining
52-
http://sourceforge.jp/projects/tomoyo/docs/lfj2008.pdf
52+
http://osdn.jp/projects/tomoyo/docs/lfj2008.pdf
5353

5454
What is future plan?
5555
====================
@@ -60,6 +60,6 @@ multiple LSM modules at the same time. We feel sorry that you have to give up
6060
SELinux/SMACK/AppArmor etc. when you want to use TOMOYO.
6161

6262
We hope that LSM becomes stackable in future. Meanwhile, you can use non-LSM
63-
version of TOMOYO, available at http://tomoyo.sourceforge.jp/1.7/ .
63+
version of TOMOYO, available at http://tomoyo.osdn.jp/1.8/ .
6464
LSM version of TOMOYO is a subset of non-LSM version of TOMOYO. We are planning
6565
to port non-LSM version's functionalities to LSM versions.

Diff for: MAINTAINERS

+17-12
Original file line numberDiff line numberDiff line change
@@ -9298,15 +9298,6 @@ F: net/*/netfilter/
92989298
F: net/netfilter/
92999299
F: net/bridge/br_netfilter*.c
93009300

9301-
NETLABEL
9302-
M: Paul Moore <[email protected]>
9303-
W: http://netlabel.sf.net
9304-
9305-
S: Maintained
9306-
F: Documentation/netlabel/
9307-
F: include/net/netlabel.h
9308-
F: net/netlabel/
9309-
93109301
NETROM NETWORK LAYER
93119302
M: Ralf Baechle <[email protected]>
93129303
@@ -9434,10 +9425,23 @@ F: net/ipv6/
94349425
F: include/net/ip*
94359426
F: arch/x86/net/*
94369427

9437-
NETWORKING [LABELED] (NetLabel, CIPSO, Labeled IPsec, SECMARK)
9428+
NETWORKING [LABELED] (NetLabel, Labeled IPsec, SECMARK)
94389429
M: Paul Moore <[email protected]>
9430+
W: https://github.com/netlabel
94399431
9432+
94409433
S: Maintained
9434+
F: Documentation/netlabel/
9435+
F: include/net/calipso.h
9436+
F: include/net/cipso_ipv4.h
9437+
F: include/net/netlabel.h
9438+
F: include/uapi/linux/netfilter/xt_SECMARK.h
9439+
F: include/uapi/linux/netfilter/xt_CONNSECMARK.h
9440+
F: net/netlabel/
9441+
F: net/ipv4/cipso_ipv4.c
9442+
F: net/ipv6/calipso.c
9443+
F: net/netfilter/xt_CONNSECMARK.c
9444+
F: net/netfilter/xt_SECMARK.c
94419445

94429446
NETWORKING [TLS]
94439447
M: Ilya Lesokhin <[email protected]>
@@ -12023,8 +12027,9 @@ M: Paul Moore <[email protected]>
1202312027
M: Stephen Smalley <[email protected]>
1202412028
M: Eric Paris <[email protected]>
1202512029
L: [email protected] (moderated for non-subscribers)
12026-
W: http://selinuxproject.org
12027-
T: git git://git.infradead.org/users/pcmoore/selinux
12030+
W: https://selinuxproject.org
12031+
W: https://github.com/SELinuxProject
12032+
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux.git
1202812033
S: Supported
1202912034
F: include/linux/selinux*
1203012035
F: security/selinux/

Diff for: include/linux/lsm_audit.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Author : Etienne BASSET <[email protected]>
66
*
7-
* All credits to : Stephen Smalley, <sds@epoch.ncsc.mil>
7+
* All credits to : Stephen Smalley, <sds@tycho.nsa.gov>
88
* All BUGS to : Etienne BASSET <[email protected]>
99
*/
1010
#ifndef _LSM_COMMON_LOGGING_

Diff for: include/linux/lsm_hooks.h

-7
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,6 @@
528528
*
529529
* Security hooks for task operations.
530530
*
531-
* @task_create:
532-
* Check permission before creating a child process. See the clone(2)
533-
* manual page for definitions of the @clone_flags.
534-
* @clone_flags contains the flags indicating what should be shared.
535-
* Return 0 if permission is granted.
536531
* @task_alloc:
537532
* @task task being allocated.
538533
* @clone_flags contains the flags indicating what should be shared.
@@ -1505,7 +1500,6 @@ union security_list_options {
15051500
int (*file_receive)(struct file *file);
15061501
int (*file_open)(struct file *file, const struct cred *cred);
15071502

1508-
int (*task_create)(unsigned long clone_flags);
15091503
int (*task_alloc)(struct task_struct *task, unsigned long clone_flags);
15101504
void (*task_free)(struct task_struct *task);
15111505
int (*cred_alloc_blank)(struct cred *cred, gfp_t gfp);
@@ -1779,7 +1773,6 @@ struct security_hook_heads {
17791773
struct list_head file_send_sigiotask;
17801774
struct list_head file_receive;
17811775
struct list_head file_open;
1782-
struct list_head task_create;
17831776
struct list_head task_alloc;
17841777
struct list_head task_free;
17851778
struct list_head cred_alloc_blank;

Diff for: include/linux/security.h

-6
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ int security_file_send_sigiotask(struct task_struct *tsk,
318318
struct fown_struct *fown, int sig);
319319
int security_file_receive(struct file *file);
320320
int security_file_open(struct file *file, const struct cred *cred);
321-
int security_task_create(unsigned long clone_flags);
322321
int security_task_alloc(struct task_struct *task, unsigned long clone_flags);
323322
void security_task_free(struct task_struct *task);
324323
int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
@@ -880,11 +879,6 @@ static inline int security_file_open(struct file *file,
880879
return 0;
881880
}
882881

883-
static inline int security_task_create(unsigned long clone_flags)
884-
{
885-
return 0;
886-
}
887-
888882
static inline int security_task_alloc(struct task_struct *task,
889883
unsigned long clone_flags)
890884
{

Diff for: kernel/fork.c

-4
Original file line numberDiff line numberDiff line change
@@ -1569,10 +1569,6 @@ static __latent_entropy struct task_struct *copy_process(
15691569
return ERR_PTR(-EINVAL);
15701570
}
15711571

1572-
retval = security_task_create(clone_flags);
1573-
if (retval)
1574-
goto fork_out;
1575-
15761572
retval = -ENOMEM;
15771573
p = dup_task_struct(current, node);
15781574
if (!p)

Diff for: scripts/selinux/genheaders/genheaders.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,16 @@ int main(int argc, char *argv[])
129129
for (i = 0; secclass_map[i].name; i++) {
130130
struct security_class_mapping *map = &secclass_map[i];
131131
for (j = 0; map->perms[j]; j++) {
132+
if (j >= 32) {
133+
fprintf(stderr, "Too many permissions to fit into an access vector at (%s, %s).\n",
134+
map->name, map->perms[j]);
135+
exit(5);
136+
}
132137
fprintf(fout, "#define %s__%s", map->name,
133138
map->perms[j]);
134139
for (k = 0; k < max(1, 40 - strlen(map->name) - strlen(map->perms[j])); k++)
135140
fprintf(fout, " ");
136-
fprintf(fout, "0x%08xUL\n", (1<<j));
141+
fprintf(fout, "0x%08xU\n", (1<<j));
137142
}
138143
}
139144

Diff for: security/lsm_audit.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* common LSM auditing functions
33
*
44
* Based on code written for SELinux by :
5-
* Stephen Smalley, <sds@epoch.ncsc.mil>
5+
* Stephen Smalley, <sds@tycho.nsa.gov>
66
* James Morris <[email protected]>
77
* Author : Etienne Basset, <[email protected]>
88
*

Diff for: security/security.c

-5
Original file line numberDiff line numberDiff line change
@@ -974,11 +974,6 @@ int security_file_open(struct file *file, const struct cred *cred)
974974
return fsnotify_perm(file, MAY_OPEN);
975975
}
976976

977-
int security_task_create(unsigned long clone_flags)
978-
{
979-
return call_int_hook(task_create, 0, clone_flags);
980-
}
981-
982977
int security_task_alloc(struct task_struct *task, unsigned long clone_flags)
983978
{
984979
return call_int_hook(task_alloc, 0, task, clone_flags);

Diff for: security/selinux/avc.c

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Implementation of the kernel access vector cache (AVC).
33
*
4-
* Authors: Stephen Smalley, <sds@epoch.ncsc.mil>
4+
* Authors: Stephen Smalley, <sds@tycho.nsa.gov>
55
* James Morris <[email protected]>
66
*
77
* Update: KaiGai, Kohei <[email protected]>
@@ -346,27 +346,26 @@ static struct avc_xperms_decision_node
346346
struct avc_xperms_decision_node *xpd_node;
347347
struct extended_perms_decision *xpd;
348348

349-
xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep,
350-
GFP_ATOMIC | __GFP_NOMEMALLOC);
349+
xpd_node = kmem_cache_zalloc(avc_xperms_decision_cachep, GFP_NOWAIT);
351350
if (!xpd_node)
352351
return NULL;
353352

354353
xpd = &xpd_node->xpd;
355354
if (which & XPERMS_ALLOWED) {
356355
xpd->allowed = kmem_cache_zalloc(avc_xperms_data_cachep,
357-
GFP_ATOMIC | __GFP_NOMEMALLOC);
356+
GFP_NOWAIT);
358357
if (!xpd->allowed)
359358
goto error;
360359
}
361360
if (which & XPERMS_AUDITALLOW) {
362361
xpd->auditallow = kmem_cache_zalloc(avc_xperms_data_cachep,
363-
GFP_ATOMIC | __GFP_NOMEMALLOC);
362+
GFP_NOWAIT);
364363
if (!xpd->auditallow)
365364
goto error;
366365
}
367366
if (which & XPERMS_DONTAUDIT) {
368367
xpd->dontaudit = kmem_cache_zalloc(avc_xperms_data_cachep,
369-
GFP_ATOMIC | __GFP_NOMEMALLOC);
368+
GFP_NOWAIT);
370369
if (!xpd->dontaudit)
371370
goto error;
372371
}
@@ -394,8 +393,7 @@ static struct avc_xperms_node *avc_xperms_alloc(void)
394393
{
395394
struct avc_xperms_node *xp_node;
396395

397-
xp_node = kmem_cache_zalloc(avc_xperms_cachep,
398-
GFP_ATOMIC|__GFP_NOMEMALLOC);
396+
xp_node = kmem_cache_zalloc(avc_xperms_cachep, GFP_NOWAIT);
399397
if (!xp_node)
400398
return xp_node;
401399
INIT_LIST_HEAD(&xp_node->xpd_head);
@@ -548,7 +546,7 @@ static struct avc_node *avc_alloc_node(void)
548546
{
549547
struct avc_node *node;
550548

551-
node = kmem_cache_zalloc(avc_node_cachep, GFP_ATOMIC|__GFP_NOMEMALLOC);
549+
node = kmem_cache_zalloc(avc_node_cachep, GFP_NOWAIT);
552550
if (!node)
553551
goto out;
554552

Diff for: security/selinux/hooks.c

+37-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* This file contains the SELinux hook function implementations.
55
*
6-
* Authors: Stephen Smalley, <sds@epoch.ncsc.mil>
6+
* Authors: Stephen Smalley, <sds@tycho.nsa.gov>
77
* Chris Vance, <[email protected]>
88
* Wayne Salamon, <[email protected]>
99
* James Morris <[email protected]>
@@ -815,7 +815,9 @@ static int selinux_set_mnt_opts(struct super_block *sb,
815815
if (!strcmp(sb->s_type->name, "debugfs") ||
816816
!strcmp(sb->s_type->name, "tracefs") ||
817817
!strcmp(sb->s_type->name, "sysfs") ||
818-
!strcmp(sb->s_type->name, "pstore"))
818+
!strcmp(sb->s_type->name, "pstore") ||
819+
!strcmp(sb->s_type->name, "cgroup") ||
820+
!strcmp(sb->s_type->name, "cgroup2"))
819821
sbsec->flags |= SE_SBGENFS;
820822

821823
if (!sbsec->behavior) {
@@ -1303,6 +1305,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
13031305
case SOCK_SEQPACKET:
13041306
return SECCLASS_UNIX_STREAM_SOCKET;
13051307
case SOCK_DGRAM:
1308+
case SOCK_RAW:
13061309
return SECCLASS_UNIX_DGRAM_SOCKET;
13071310
}
13081311
break;
@@ -2317,6 +2320,7 @@ static int check_nnp_nosuid(const struct linux_binprm *bprm,
23172320
int nnp = (bprm->unsafe & LSM_UNSAFE_NO_NEW_PRIVS);
23182321
int nosuid = !mnt_may_suid(bprm->file->f_path.mnt);
23192322
int rc;
2323+
u32 av;
23202324

23212325
if (!nnp && !nosuid)
23222326
return 0; /* neither NNP nor nosuid */
@@ -2325,24 +2329,40 @@ static int check_nnp_nosuid(const struct linux_binprm *bprm,
23252329
return 0; /* No change in credentials */
23262330

23272331
/*
2328-
* The only transitions we permit under NNP or nosuid
2329-
* are transitions to bounded SIDs, i.e. SIDs that are
2330-
* guaranteed to only be allowed a subset of the permissions
2331-
* of the current SID.
2332+
* If the policy enables the nnp_nosuid_transition policy capability,
2333+
* then we permit transitions under NNP or nosuid if the
2334+
* policy allows the corresponding permission between
2335+
* the old and new contexts.
23322336
*/
2333-
rc = security_bounded_transition(old_tsec->sid, new_tsec->sid);
2334-
if (rc) {
2335-
/*
2336-
* On failure, preserve the errno values for NNP vs nosuid.
2337-
* NNP: Operation not permitted for caller.
2338-
* nosuid: Permission denied to file.
2339-
*/
2337+
if (selinux_policycap_nnp_nosuid_transition) {
2338+
av = 0;
23402339
if (nnp)
2341-
return -EPERM;
2342-
else
2343-
return -EACCES;
2340+
av |= PROCESS2__NNP_TRANSITION;
2341+
if (nosuid)
2342+
av |= PROCESS2__NOSUID_TRANSITION;
2343+
rc = avc_has_perm(old_tsec->sid, new_tsec->sid,
2344+
SECCLASS_PROCESS2, av, NULL);
2345+
if (!rc)
2346+
return 0;
23442347
}
2345-
return 0;
2348+
2349+
/*
2350+
* We also permit NNP or nosuid transitions to bounded SIDs,
2351+
* i.e. SIDs that are guaranteed to only be allowed a subset
2352+
* of the permissions of the current SID.
2353+
*/
2354+
rc = security_bounded_transition(old_tsec->sid, new_tsec->sid);
2355+
if (!rc)
2356+
return 0;
2357+
2358+
/*
2359+
* On failure, preserve the errno values for NNP vs nosuid.
2360+
* NNP: Operation not permitted for caller.
2361+
* nosuid: Permission denied to file.
2362+
*/
2363+
if (nnp)
2364+
return -EPERM;
2365+
return -EACCES;
23462366
}
23472367

23482368
static int selinux_bprm_set_creds(struct linux_binprm *bprm)

Diff for: security/selinux/include/avc.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* Access vector cache interface for object managers.
33
*
4-
* Author : Stephen Smalley, <sds@epoch.ncsc.mil>
4+
* Author : Stephen Smalley, <sds@tycho.nsa.gov>
55
*/
66
#ifndef _SELINUX_AVC_H_
77
#define _SELINUX_AVC_H_

0 commit comments

Comments
 (0)