summaryrefslogtreecommitdiffstats
path: root/init/initramfs.c
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2017-05-09 00:56:57 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-09 02:15:12 +0200
commitcff75e0b6fe835800f8e08a32d731119cd9e3b79 (patch)
tree54f112a3576c1bb91c2e7e7205e9d02ec458e137 /init/initramfs.c
parentlib/zlib_inflate/inftrees.c: fix potential buffer overflow (diff)
downloadlinux-cff75e0b6fe835800f8e08a32d731119cd9e3b79.tar.xz
linux-cff75e0b6fe835800f8e08a32d731119cd9e3b79.zip
initramfs: provide a way to ignore image provided by bootloader
Many "embedded" architectures provide CMDLINE_FORCE to allow the kernel to override the command line provided by an inflexible bootloader. However there is currrently no way for the kernel to override the initramfs image provided by the bootloader meaning there are still ways for bootloaders to make things difficult for us. Fix this by introducing INITRAMFS_FORCE which can prevent the kernel from loading the bootloader supplied image. We use CMDLINE_FORCE (and its friend CMDLINE_EXTEND) to imply that the system has an inflexible bootloader. This allow us to avoid presenting this config option to users of systems where inflexible bootloaders aren't usually a problem. Link: http://lkml.kernel.org/r/20170217121940.30126-1-daniel.thompson@linaro.org Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/initramfs.c')
-rw-r--r--init/initramfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/init/initramfs.c b/init/initramfs.c
index 8daf7ac6c7e2..9d180273ee8c 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -613,7 +613,7 @@ static int __init populate_rootfs(void)
if (err)
panic("%s", err); /* Failed to decompress INTERNAL initramfs */
/* If available load the bootloader supplied initrd */
- if (initrd_start) {
+ if (initrd_start && !IS_ENABLED(CONFIG_INITRAMFS_FORCE)) {
#ifdef CONFIG_BLK_DEV_RAM
int fd;
printk(KERN_INFO "Trying to unpack rootfs image as initramfs...\n");