diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-02 12:04:50 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-02 12:04:50 +0200 |
commit | cf4e503875814ce6e4ff8666fb4a0350ca72c6e4 (patch) | |
tree | 0ceea8f27a73df6ea0b137c92ba467c21ddbae06 | |
parent | 7d5ddf14a3ce2b9c3e8251e40d67333b13287a15 (diff) | |
download | busybox-w32-cf4e503875814ce6e4ff8666fb4a0350ca72c6e4.tar.gz busybox-w32-cf4e503875814ce6e4ff8666fb4a0350ca72c6e4.tar.bz2 busybox-w32-cf4e503875814ce6e4ff8666fb4a0350ca72c6e4.zip |
Added kernel patch for /proc/self/exe to examples
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | examples/linux-2.6.30_proc_self_exe.patch | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/linux-2.6.30_proc_self_exe.patch b/examples/linux-2.6.30_proc_self_exe.patch new file mode 100644 index 000000000..a36581bf9 --- /dev/null +++ b/examples/linux-2.6.30_proc_self_exe.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | This patch makes /proc/self/exe executable even if proc | ||
2 | is not mounted. It is especially useful on NOMMU arches. | ||
3 | |||
4 | diff -urp ../linux-2.6.30.org/fs/exec.c linux-2.6.30/fs/exec.c | ||
5 | --- ../linux-2.6.30.org/fs/exec.c 2009-06-10 05:05:27.000000000 +0200 | ||
6 | +++ linux-2.6.30/fs/exec.c 2009-06-25 00:20:13.000000000 +0200 | ||
7 | @@ -652,9 +652,25 @@ struct file *open_exec(const char *name) | ||
8 | file = do_filp_open(AT_FDCWD, name, | ||
9 | O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0, | ||
10 | MAY_EXEC | MAY_OPEN); | ||
11 | - if (IS_ERR(file)) | ||
12 | - goto out; | ||
13 | + if (IS_ERR(file)) { | ||
14 | + if ((PTR_ERR(file) == -ENOENT || PTR_ERR(file) == -EACCES) | ||
15 | + && strcmp(name, "/proc/self/exe") == 0 | ||
16 | + ) { | ||
17 | + struct file *sv = file; | ||
18 | + struct mm_struct *mm; | ||
19 | |||
20 | + mm = get_task_mm(current); | ||
21 | + if (!mm) | ||
22 | + goto out; | ||
23 | + file = get_mm_exe_file(mm); | ||
24 | + mmput(mm); | ||
25 | + if (file) | ||
26 | + goto ok; | ||
27 | + file = sv; | ||
28 | + } | ||
29 | + goto out; | ||
30 | + } | ||
31 | +ok: | ||
32 | err = -EACCES; | ||
33 | if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) | ||
34 | goto exit; | ||