]>
Commit | Line | Data |
---|---|---|
375eac46 AM |
1 | Index: main.c |
2 | =================================================================== | |
3 | --- linux.org/init/main.c (revision 3297) | |
4 | +++ linux/init/main.c (revision 3935) | |
5 | @@ -26,6 +26,7 @@ | |
6 | #include <linux/hdreg.h> | |
7 | #include <linux/iobuf.h> | |
8 | #include <linux/bootmem.h> | |
9 | +#include <linux/file.h> | |
10 | #include <linux/tty.h> | |
11 | ||
12 | #include <asm/io.h> | |
13 | @@ -548,6 +549,7 @@ | |
14 | ||
15 | static int init(void * unused) | |
16 | { | |
17 | + struct files_struct *files; | |
18 | lock_kernel(); | |
19 | do_basic_setup(); | |
20 | ||
21 | @@ -560,7 +562,17 @@ | |
22 | */ | |
23 | free_initmem(); | |
24 | unlock_kernel(); | |
25 | - | |
26 | + | |
27 | + /* | |
28 | + * Right now we are a thread sharing with a ton of kernel | |
29 | + * stuff. We don't want to end up in user space in that state | |
30 | + */ | |
31 | + | |
32 | + files = current->files; | |
33 | + if(unshare_files()) | |
34 | + panic("unshare"); | |
35 | + put_files_struct(files); | |
36 | + | |
37 | if (open("/dev/console", O_RDWR, 0) < 0) | |
38 | printk("Warning: unable to open an initial console.\n"); | |
39 |