diff options
author | Andy Lutomirski <luto@amacapital.net> | 2014-12-10 18:52:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:12 -0500 |
commit | 6ef4536e2f19c4dba3637413d73ea00b19764bc0 (patch) | |
tree | e286e65b4ba1ce1089a7dc87cf642cfb6fdbbe6b /init/Kconfig | |
parent | 52f5592e549c013feb9bb71cab3e6fd624633577 (diff) |
init: allow CONFIG_INIT_FALLBACK=n to disable defaults if init= fails
If a user puts init=/whatever on the command line and /whatever can't be
run, then the kernel will try a few default options before giving up. If
init=/whatever came from a bootloader prompt, then this is unexpected but
probably harmless. On the other hand, if it comes from a script (e.g. a
tool like virtme or perhaps a future kselftest script), then the fallbacks
are likely to exist, but they'll do the wrong thing. For example, they
might unexpectedly invoke systemd.
This adds a config option CONFIG_INIT_FALLBACK. If unset, then a failure
to run the specified init= process be fatal.
The tentative plan is to remove CONFIG_INIT_FALLBACK for 3.20.
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Rob Landley <rob@landley.net>
Cc: Chuck Ebbert <cebbert.lkml@gmail.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Shuah Khan <shuah.kh@samsung.com>
Cc: Frank Rowand <frowand.list@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
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 | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig index 7e9fbd48e2ab..9afb971497f4 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1280,6 +1280,22 @@ source "usr/Kconfig" | |||
1280 | 1280 | ||
1281 | endif | 1281 | endif |
1282 | 1282 | ||
1283 | config INIT_FALLBACK | ||
1284 | bool "Fall back to defaults if init= parameter is bad" | ||
1285 | default y | ||
1286 | help | ||
1287 | If enabled, the kernel will try the default init binaries if an | ||
1288 | explicit request from the init= parameter fails. | ||
1289 | |||
1290 | This can have unexpected effects. For example, booting | ||
1291 | with init=/sbin/kiosk_app will run /sbin/init or even /bin/sh | ||
1292 | if /sbin/kiosk_app cannot be executed. | ||
1293 | |||
1294 | The default value of Y is consistent with historical behavior. | ||
1295 | Selecting N is likely to be more appropriate for most uses, | ||
1296 | especially on kiosks and on kernels that are intended to be | ||
1297 | run under the control of a script. | ||
1298 | |||
1283 | config CC_OPTIMIZE_FOR_SIZE | 1299 | config CC_OPTIMIZE_FOR_SIZE |
1284 | bool "Optimize for size" | 1300 | bool "Optimize for size" |
1285 | help | 1301 | help |