History

make sure that we always have a return path from kernel_execve()

The only place where kernel_execve() is called without a way to return to the caller of kernel_thread() callback is kernel_post(). Reorganize kernel_init()/kernel_post() - instead of the former calling the latter in the end (and getting freed by it), have the latter *begin* with calling the former (and turn the latter into kernel_thread() callback, of course).

Al Viro committed 14 years ago

Commit d6b21231 parent ecf89e51 file · +5 −8Browse files

Unified · Split

init/main.c+5−8
@@ -794,11 +794,11 @@ static void run_init_process(const char *init_filename) · 793 unmodified lines
794794 kernel_execve(init_filename, argv_init, envp_init);
795795 }
796796
797−/* This is a non __init function. Force it to be noinline otherwise gcc
798− * makes it inline to init() and it becomes part of init.text section
799− */
800−static noinline int init_post(void)
797+static void __init kernel_init_freeable(void);
798+
799+static int __ref kernel_init(void *unused)
801800 {
801+ kernel_init_freeable();
802802 /* need to finish all async __init code before freeing the memory */
803803 async_synchronize_full();
804804 free_initmem();
@@ -835,7 +835,7 @@ static noinline int init_post(void) · 30 unmodified lines
835835 "See Linux Documentation/init.txt for guidance.");
836836 }
837837
838−static int __init kernel_init(void * unused)
838+static void __init kernel_init_freeable(void)
839839 {
840840 /*
841841 * Wait until kthreadd is all set-up.
@@ -890,7 +890,4 @@ static int __init kernel_init(void * unused) · 48 unmodified lines
890890 * we're essentially up and running. Get rid of the
891891 * initmem segments and start the user-mode stuff..
892892 */
893−
894− init_post();
895− return 0;
896893 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t