summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--drivers/staging/lustre/lustre/Kconfig1
-rw-r--r--fs/nfs/Kconfig2
-rw-r--r--fs/nfsd/Kconfig1
-rw-r--r--include/linux/capability.h29
-rw-r--r--include/linux/cred.h23
-rw-r--r--include/linux/uidgid.h12
-rw-r--r--init/Kconfig19
-rw-r--r--kernel/Makefile4
-rw-r--r--kernel/capability.c35
-rw-r--r--kernel/cred.c3
-rw-r--r--kernel/groups.c3
-rw-r--r--kernel/sys.c2
-rw-r--r--kernel/sys_ni.c14
-rw-r--r--net/sunrpc/Kconfig2
-rw-r--r--security/Kconfig1
16 files changed, 126 insertions, 26 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index a5ced5c3c1e0..de2726a487b0 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -328,6 +328,7 @@ config COMPAT
328 select COMPAT_BINFMT_ELF if BINFMT_ELF 328 select COMPAT_BINFMT_ELF if BINFMT_ELF
329 select ARCH_WANT_OLD_COMPAT_IPC 329 select ARCH_WANT_OLD_COMPAT_IPC
330 select COMPAT_OLD_SIGACTION 330 select COMPAT_OLD_SIGACTION
331 depends on MULTIUSER
331 help 332 help
332 Select this option if you want to enable your system kernel to 333 Select this option if you want to enable your system kernel to
333 handle system-calls from ELF binaries for 31 bit ESA. This option 334 handle system-calls from ELF binaries for 31 bit ESA. This option
diff --git a/drivers/staging/lustre/lustre/Kconfig b/drivers/staging/lustre/lustre/Kconfig
index 6725467ef4d0..62c7bba75274 100644
--- a/drivers/staging/lustre/lustre/Kconfig
+++ b/drivers/staging/lustre/lustre/Kconfig
@@ -10,6 +10,7 @@ config LUSTRE_FS
10 select CRYPTO_SHA1 10 select CRYPTO_SHA1
11 select CRYPTO_SHA256 11 select CRYPTO_SHA256
12 select CRYPTO_SHA512 12 select CRYPTO_SHA512
13 depends on MULTIUSER
13 help 14 help
14 This option enables Lustre file system client support. Choose Y 15 This option enables Lustre file system client support. Choose Y
15 here if you want to access a Lustre file system cluster. To compile 16 here if you want to access a Lustre file system cluster. To compile
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
index c7abc10279af..f31fd0dd92c6 100644
--- a/fs/nfs/Kconfig
+++ b/fs/nfs/Kconfig
@@ -1,6 +1,6 @@
1config NFS_FS 1config NFS_FS
2 tristate "NFS client support" 2 tristate "NFS client support"
3 depends on INET && FILE_LOCKING 3 depends on INET && FILE_LOCKING && MULTIUSER
4 select LOCKD 4 select LOCKD
5 select SUNRPC 5 select SUNRPC
6 select NFS_ACL_SUPPORT if NFS_V3_ACL 6 select NFS_ACL_SUPPORT if NFS_V3_ACL
diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
index 683bf718aead..fc2d108f5272 100644
--- a/fs/nfsd/Kconfig
+++ b/fs/nfsd/Kconfig
@@ -6,6 +6,7 @@ config NFSD
6 select SUNRPC 6 select SUNRPC
7 select EXPORTFS 7 select EXPORTFS
8 select NFS_ACL_SUPPORT if NFSD_V2_ACL 8 select NFS_ACL_SUPPORT if NFSD_V2_ACL
9 depends on MULTIUSER
9 help 10 help
10 Choose Y here if you want to allow other computers to access 11 Choose Y here if you want to allow other computers to access
11 files residing on this system using Sun's Network File System 12 files residing on this system using Sun's Network File System
diff --git a/include/linux/capability.h b/include/linux/capability.h
index aa93e5ef594c..af9f0b9e80e6 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -205,6 +205,7 @@ static inline kernel_cap_t cap_raise_nfsd_set(const kernel_cap_t a,
205 cap_intersect(permitted, __cap_nfsd_set)); 205 cap_intersect(permitted, __cap_nfsd_set));
206} 206}
207 207
208#ifdef CONFIG_MULTIUSER
208extern bool has_capability(struct task_struct *t, int cap); 209extern bool has_capability(struct task_struct *t, int cap);
209extern bool has_ns_capability(struct task_struct *t, 210extern bool has_ns_capability(struct task_struct *t,
210 struct user_namespace *ns, int cap); 211 struct user_namespace *ns, int cap);
@@ -213,6 +214,34 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
213 struct user_namespace *ns, int cap); 214 struct user_namespace *ns, int cap);
214extern bool capable(int cap); 215extern bool capable(int cap);
215extern bool ns_capable(struct user_namespace *ns, int cap); 216extern bool ns_capable(struct user_namespace *ns, int cap);
217#else
218static inline bool has_capability(struct task_struct *t, int cap)
219{
220 return true;
221}
222static inline bool has_ns_capability(struct task_struct *t,
223 struct user_namespace *ns, int cap)
224{
225 return true;
226}
227static inline bool has_capability_noaudit(struct task_struct *t, int cap)
228{
229 return true;
230}
231static inline bool has_ns_capability_noaudit(struct task_struct *t,
232 struct user_namespace *ns, int cap)
233{
234 return true;
235}
236static inline bool capable(int cap)
237{
238 return true;
239}
240static inline bool ns_capable(struct user_namespace *ns, int cap)
241{
242 return true;
243}
244#endif /* CONFIG_MULTIUSER */
216extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap); 245extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
217extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); 246extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
218 247
diff --git a/include/linux/cred.h b/include/linux/cred.h
index 2fb2ca2127ed..8b6c083e68a7 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -62,9 +62,27 @@ do { \
62 groups_free(group_info); \ 62 groups_free(group_info); \
63} while (0) 63} while (0)
64 64
65extern struct group_info *groups_alloc(int);
66extern struct group_info init_groups; 65extern struct group_info init_groups;
66#ifdef CONFIG_MULTIUSER
67extern struct group_info *groups_alloc(int);
67extern void groups_free(struct group_info *); 68extern void groups_free(struct group_info *);
69
70extern int in_group_p(kgid_t);
71extern int in_egroup_p(kgid_t);
72#else
73static inline void groups_free(struct group_info *group_info)
74{
75}
76
77static inline int in_group_p(kgid_t grp)
78{
79 return 1;
80}
81static inline int in_egroup_p(kgid_t grp)
82{
83 return 1;
84}
85#endif
68extern int set_current_groups(struct group_info *); 86extern int set_current_groups(struct group_info *);
69extern void set_groups(struct cred *, struct group_info *); 87extern void set_groups(struct cred *, struct group_info *);
70extern int groups_search(const struct group_info *, kgid_t); 88extern int groups_search(const struct group_info *, kgid_t);
@@ -74,9 +92,6 @@ extern bool may_setgroups(void);
74#define GROUP_AT(gi, i) \ 92#define GROUP_AT(gi, i) \
75 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK]) 93 ((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])
76 94
77extern int in_group_p(kgid_t);
78extern int in_egroup_p(kgid_t);
79
80/* 95/*
81 * The security context of a task 96 * The security context of a task
82 * 97 *
diff --git a/include/linux/uidgid.h b/include/linux/uidgid.h
index 2d1f9b627f91..0ee05da38899 100644
--- a/include/linux/uidgid.h
+++ b/include/linux/uidgid.h
@@ -29,6 +29,7 @@ typedef struct {
29#define KUIDT_INIT(value) (kuid_t){ value } 29#define KUIDT_INIT(value) (kuid_t){ value }
30#define KGIDT_INIT(value) (kgid_t){ value } 30#define KGIDT_INIT(value) (kgid_t){ value }
31 31
32#ifdef CONFIG_MULTIUSER
32static inline uid_t __kuid_val(kuid_t uid) 33static inline uid_t __kuid_val(kuid_t uid)
33{ 34{
34 return uid.val; 35 return uid.val;
@@ -38,6 +39,17 @@ static inline gid_t __kgid_val(kgid_t gid)
38{ 39{
39 return gid.val; 40 return gid.val;
40} 41}
42#else
43static inline uid_t __kuid_val(kuid_t uid)
44{
45 return 0;
46}
47
48static inline gid_t __kgid_val(kgid_t gid)
49{
50 return 0;
51}
52#endif
41 53
42#define GLOBAL_ROOT_UID KUIDT_INIT(0) 54#define GLOBAL_ROOT_UID KUIDT_INIT(0)
43#define GLOBAL_ROOT_GID KGIDT_INIT(0) 55#define GLOBAL_ROOT_GID KGIDT_INIT(0)
diff --git a/init/Kconfig b/init/Kconfig
index a905b7301e10..3b9df1aa35db 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -394,6 +394,7 @@ endchoice
394 394
395config BSD_PROCESS_ACCT 395config BSD_PROCESS_ACCT
396 bool "BSD Process Accounting" 396 bool "BSD Process Accounting"
397 depends on MULTIUSER
397 help 398 help
398 If you say Y here, a user level program will be able to instruct the 399 If you say Y here, a user level program will be able to instruct the
399 kernel (via a special system call) to write process accounting 400 kernel (via a special system call) to write process accounting
@@ -420,6 +421,7 @@ config BSD_PROCESS_ACCT_V3
420config TASKSTATS 421config TASKSTATS
421 bool "Export task/process statistics through netlink" 422 bool "Export task/process statistics through netlink"
422 depends on NET 423 depends on NET
424 depends on MULTIUSER
423 default n 425 default n
424 help 426 help
425 Export selected statistics for tasks/processes through the 427 Export selected statistics for tasks/processes through the
@@ -1160,6 +1162,7 @@ config CHECKPOINT_RESTORE
1160 1162
1161menuconfig NAMESPACES 1163menuconfig NAMESPACES
1162 bool "Namespaces support" if EXPERT 1164 bool "Namespaces support" if EXPERT
1165 depends on MULTIUSER
1163 default !EXPERT 1166 default !EXPERT
1164 help 1167 help
1165 Provides the way to make tasks work with different objects using 1168 Provides the way to make tasks work with different objects using
@@ -1356,11 +1359,25 @@ menuconfig EXPERT
1356 1359
1357config UID16 1360config UID16
1358 bool "Enable 16-bit UID system calls" if EXPERT 1361 bool "Enable 16-bit UID system calls" if EXPERT
1359 depends on HAVE_UID16 1362 depends on HAVE_UID16 && MULTIUSER
1360 default y 1363 default y
1361 help 1364 help
1362 This enables the legacy 16-bit UID syscall wrappers. 1365 This enables the legacy 16-bit UID syscall wrappers.
1363 1366
1367config MULTIUSER
1368 bool "Multiple users, groups and capabilities support" if EXPERT
1369 default y
1370 help
1371 This option enables support for non-root users, groups and
1372 capabilities.
1373
1374 If you say N here, all processes will run with UID 0, GID 0, and all
1375 possible capabilities. Saying N here also compiles out support for
1376 system calls related to UIDs, GIDs, and capabilities, such as setuid,
1377 setgid, and capset.
1378
1379 If unsure, say Y here.
1380
1364config SGETMASK_SYSCALL 1381config SGETMASK_SYSCALL
1365 bool "sgetmask/ssetmask syscalls support" if EXPERT 1382 bool "sgetmask/ssetmask syscalls support" if EXPERT
1366 def_bool PARISC || MN10300 || BLACKFIN || M68K || PPC || MIPS || X86 || SPARC || CRIS || MICROBLAZE || SUPERH 1383 def_bool PARISC || MN10300 || BLACKFIN || M68K || PPC || MIPS || X86 || SPARC || CRIS || MICROBLAZE || SUPERH
diff --git a/kernel/Makefile b/kernel/Makefile
index 1408b3353a3c..0f8f8b0bc1bf 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -9,7 +9,9 @@ obj-y = fork.o exec_domain.o panic.o \
9 extable.o params.o \ 9 extable.o params.o \
10 kthread.o sys_ni.o nsproxy.o \ 10 kthread.o sys_ni.o nsproxy.o \
11 notifier.o ksysfs.o cred.o reboot.o \ 11 notifier.o ksysfs.o cred.o reboot.o \
12 async.o range.o groups.o smpboot.o 12 async.o range.o smpboot.o
13
14obj-$(CONFIG_MULTIUSER) += groups.o
13 15
14ifdef CONFIG_FUNCTION_TRACER 16ifdef CONFIG_FUNCTION_TRACER
15# Do not trace debug files and internal ftrace files 17# Do not trace debug files and internal ftrace files
diff --git a/kernel/capability.c b/kernel/capability.c
index 989f5bfc57dc..45432b54d5c6 100644
--- a/kernel/capability.c
+++ b/kernel/capability.c
@@ -35,6 +35,7 @@ static int __init file_caps_disable(char *str)
35} 35}
36__setup("no_file_caps", file_caps_disable); 36__setup("no_file_caps", file_caps_disable);
37 37
38#ifdef CONFIG_MULTIUSER
38/* 39/*
39 * More recent versions of libcap are available from: 40 * More recent versions of libcap are available from:
40 * 41 *
@@ -386,6 +387,24 @@ bool ns_capable(struct user_namespace *ns, int cap)
386} 387}
387EXPORT_SYMBOL(ns_capable); 388EXPORT_SYMBOL(ns_capable);
388 389
390
391/**
392 * capable - Determine if the current task has a superior capability in effect
393 * @cap: The capability to be tested for
394 *
395 * Return true if the current task has the given superior capability currently
396 * available for use, false if not.
397 *
398 * This sets PF_SUPERPRIV on the task if the capability is available on the
399 * assumption that it's about to be used.
400 */
401bool capable(int cap)
402{
403 return ns_capable(&init_user_ns, cap);
404}
405EXPORT_SYMBOL(capable);
406#endif /* CONFIG_MULTIUSER */
407
389/** 408/**
390 * file_ns_capable - Determine if the file's opener had a capability in effect 409 * file_ns_capable - Determine if the file's opener had a capability in effect
391 * @file: The file we want to check 410 * @file: The file we want to check
@@ -412,22 +431,6 @@ bool file_ns_capable(const struct file *file, struct user_namespace *ns,
412EXPORT_SYMBOL(file_ns_capable); 431EXPORT_SYMBOL(file_ns_capable);
413 432
414/** 433/**
415 * capable - Determine if the current task has a superior capability in effect
416 * @cap: The capability to be tested for
417 *
418 * Return true if the current task has the given superior capability currently
419 * available for use, false if not.
420 *
421 * This sets PF_SUPERPRIV on the task if the capability is available on the
422 * assumption that it's about to be used.
423 */
424bool capable(int cap)
425{
426 return ns_capable(&init_user_ns, cap);
427}
428EXPORT_SYMBOL(capable);
429
430/**
431 * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped 434 * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped
432 * @inode: The inode in question 435 * @inode: The inode in question
433 * @cap: The capability in question 436 * @cap: The capability in question
diff --git a/kernel/cred.c b/kernel/cred.c
index e0573a43c7df..ec1c07667ec1 100644
--- a/kernel/cred.c
+++ b/kernel/cred.c
@@ -29,6 +29,9 @@
29 29
30static struct kmem_cache *cred_jar; 30static struct kmem_cache *cred_jar;
31 31
32/* init to 2 - one for init_task, one to ensure it is never freed */
33struct group_info init_groups = { .usage = ATOMIC_INIT(2) };
34
32/* 35/*
33 * The initial credentials for the initial task 36 * The initial credentials for the initial task
34 */ 37 */
diff --git a/kernel/groups.c b/kernel/groups.c
index 664411f171b5..74d431d25251 100644
--- a/kernel/groups.c
+++ b/kernel/groups.c
@@ -9,9 +9,6 @@
9#include <linux/user_namespace.h> 9#include <linux/user_namespace.h>
10#include <asm/uaccess.h> 10#include <asm/uaccess.h>
11 11
12/* init to 2 - one for init_task, one to ensure it is never freed */
13struct group_info init_groups = { .usage = ATOMIC_INIT(2) };
14
15struct group_info *groups_alloc(int gidsetsize) 12struct group_info *groups_alloc(int gidsetsize)
16{ 13{
17 struct group_info *group_info; 14 struct group_info *group_info;
diff --git a/kernel/sys.c b/kernel/sys.c
index a03d9cd23ed7..3be344902316 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -325,6 +325,7 @@ out_unlock:
325 * SMP: There are not races, the GIDs are checked only by filesystem 325 * SMP: There are not races, the GIDs are checked only by filesystem
326 * operations (as far as semantic preservation is concerned). 326 * operations (as far as semantic preservation is concerned).
327 */ 327 */
328#ifdef CONFIG_MULTIUSER
328SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid) 329SYSCALL_DEFINE2(setregid, gid_t, rgid, gid_t, egid)
329{ 330{
330 struct user_namespace *ns = current_user_ns(); 331 struct user_namespace *ns = current_user_ns();
@@ -815,6 +816,7 @@ change_okay:
815 commit_creds(new); 816 commit_creds(new);
816 return old_fsgid; 817 return old_fsgid;
817} 818}
819#endif /* CONFIG_MULTIUSER */
818 820
819/** 821/**
820 * sys_getpid - return the thread group id of the current process 822 * sys_getpid - return the thread group id of the current process
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 5adcb0ae3a58..7995ef5868d8 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -159,6 +159,20 @@ cond_syscall(sys_uselib);
159cond_syscall(sys_fadvise64); 159cond_syscall(sys_fadvise64);
160cond_syscall(sys_fadvise64_64); 160cond_syscall(sys_fadvise64_64);
161cond_syscall(sys_madvise); 161cond_syscall(sys_madvise);
162cond_syscall(sys_setuid);
163cond_syscall(sys_setregid);
164cond_syscall(sys_setgid);
165cond_syscall(sys_setreuid);
166cond_syscall(sys_setresuid);
167cond_syscall(sys_getresuid);
168cond_syscall(sys_setresgid);
169cond_syscall(sys_getresgid);
170cond_syscall(sys_setgroups);
171cond_syscall(sys_getgroups);
172cond_syscall(sys_setfsuid);
173cond_syscall(sys_setfsgid);
174cond_syscall(sys_capget);
175cond_syscall(sys_capset);
162 176
163/* arch-specific weak syscall entries */ 177/* arch-specific weak syscall entries */
164cond_syscall(sys_pciconfig_read); 178cond_syscall(sys_pciconfig_read);
diff --git a/net/sunrpc/Kconfig b/net/sunrpc/Kconfig
index fb78117b896c..9068e72aa73c 100644
--- a/net/sunrpc/Kconfig
+++ b/net/sunrpc/Kconfig
@@ -1,9 +1,11 @@
1config SUNRPC 1config SUNRPC
2 tristate 2 tristate
3 depends on MULTIUSER
3 4
4config SUNRPC_GSS 5config SUNRPC_GSS
5 tristate 6 tristate
6 select OID_REGISTRY 7 select OID_REGISTRY
8 depends on MULTIUSER
7 9
8config SUNRPC_BACKCHANNEL 10config SUNRPC_BACKCHANNEL
9 bool 11 bool
diff --git a/security/Kconfig b/security/Kconfig
index beb86b500adf..bf4ec46474b6 100644
--- a/security/Kconfig
+++ b/security/Kconfig
@@ -21,6 +21,7 @@ config SECURITY_DMESG_RESTRICT
21config SECURITY 21config SECURITY
22 bool "Enable different security models" 22 bool "Enable different security models"
23 depends on SYSFS 23 depends on SYSFS
24 depends on MULTIUSER
24 help 25 help
25 This allows you to choose different security modules to be 26 This allows you to choose different security modules to be
26 configured into your kernel. 27 configured into your kernel.