diff options
author | Iulia Manda <iulia.manda21@gmail.com> | 2015-04-15 19:16:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-15 19:35:22 -0400 |
commit | 2813893f8b197a14f1e1ddb04d99bce46817c84a (patch) | |
tree | 650651e638f867a6bda23e08c70bdd9857d121ca /init/Kconfig | |
parent | c79574abe2baddf569532e7e430e4977771dd25c (diff) |
kernel: conditionally support non-root users, groups and capabilities
There are a lot of embedded systems that run most or all of their
functionality in init, running as root:root. For these systems,
supporting multiple users is not necessary.
This patch adds a new symbol, CONFIG_MULTIUSER, that makes support for
non-root users, non-root groups, and capabilities optional. It is enabled
under CONFIG_EXPERT menu.
When this symbol is not defined, UID and GID are zero in any possible case
and processes always have all capabilities.
The following syscalls are compiled out: setuid, setregid, setgid,
setreuid, setresuid, getresuid, setresgid, getresgid, setgroups,
getgroups, setfsuid, setfsgid, capget, capset.
Also, groups.c is compiled out completely.
In kernel/capability.c, capable function was moved in order to avoid
adding two ifdef blocks.
This change saves about 25 KB on a defconfig build. The most minimal
kernels have total text sizes in the high hundreds of kB rather than
low MB. (The 25k goes down a bit with allnoconfig, but not that much.
The kernel was booted in Qemu. All the common functionalities work.
Adding users/groups is not possible, failing with -ENOSYS.
Bloat-o-meter output:
add/remove: 7/87 grow/shrink: 19/397 up/down: 1675/-26325 (-24650)
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Iulia Manda <iulia.manda21@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/Kconfig')
-rw-r--r-- | init/Kconfig | 19 |
1 files changed, 18 insertions, 1 deletions
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 | ||
395 | config BSD_PROCESS_ACCT | 395 | config 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 | |||
420 | config TASKSTATS | 421 | config 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 | ||
1161 | menuconfig NAMESPACES | 1163 | menuconfig 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 | ||
1357 | config UID16 | 1360 | config 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 | ||
1367 | config 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 | |||
1364 | config SGETMASK_SYSCALL | 1381 | config 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 |