Bug 36692 - Kernel fails to execute init on multi-arch initramfs
Summary: Kernel fails to execute init on multi-arch initramfs
Status: RESOLVED CODE_FIX
Alias: None
Product: Memory Management
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Andrew Morton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-05 09:27 UTC by Mathias Krause
Modified: 2011-06-10 15:31 UTC (History)
0 users

See Also:
Kernel Version: 2.6.12 onwards
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Mathias Krause 2011-06-05 09:27:05 UTC
I've a x86 multi-arch initramfs containing a 64 bit init as /sbin/init and a 32 bit version as /bin/init. Also I've an empty text file /init (non-executable) to pass the check in init/main.c:kernel_init() to not call prepare_namespace() (otherwise booting would be impossible because the kernel complains not to find its rootfs).

This setup should be bootable with either a 64 bit kernel with no compat support and also with a plain 32 bit kernel because the hardcoded list in init/main.c:init_post() should make /sbin/init succeed on the 64 bit kernel and make it fail, but skip over to /bin/init on a 32 bit kernel. The latter doesn't happen because the failed execution attempt of /sbin/init changed the address limit from KERNEL_DS to USER_DS in fs/exec.c:search_binary_handler() so all references to the filenames ("/etc/init", "/bin/init" and "/bin/sh") won't be allowed because they life in kernelland not userland.

Patch for this bug is available at [1] but nobody seemed to care so far :(

[1] http://marc.info/?l=linux-kernel&m=130677271530393&w=2

Note You need to log in before you can comment on or make changes to this bug.