diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-30 02:38:44 (GMT) |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-10-30 02:38:44 (GMT) |
| commit | 34077574a34a99cebf9336820330065e9b8d4ff3 (patch) | |
| tree | e888ee3f627730ae2b0f61c206ece107bda2daa7 | |
| parent | 359c8c9a6f168eb8851bfab18181e6b65eab92a2 (diff) | |
| download | busybox-website-34077574a34a99cebf9336820330065e9b8d4ff3.tar.gz busybox-website-34077574a34a99cebf9336820330065e9b8d4ff3.tar.bz2 | |
FAQ: add example kernel patch for "magic /proc/self/exe"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | FAQ.html | 38 |
1 files changed, 36 insertions, 2 deletions
@@ -144,14 +144,48 @@ have additions to this FAQ document, we would love to add them, your rootfs, you must mount /proc beforehand.) </p> <p> - A typical indication that you set CONFIG_BUSYBOX_EXEC_PATH to proc but - forgot to mount proc is: + A typical indication that you set CONFIG_BUSYBOX_EXEC_PATH to + /proc/self/exe but /proc is not mounted: +</p> <pre> $ /bin/echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11 $ echo $PATH /bin/sh: echo: not found </pre> +<p> + If this is a serious limitation for you, you may patch the kernel + so that it always understands exec("/proc/self/exe"), even if /proc + is not mounted. For example, in linux-2.6.30, you need to patch + open_exec() function in fs/exec.c file: +</p> +<pre> + file = do_filp_open(AT_FDCWD, name, + O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0, + MAY_EXEC | MAY_OPEN); +- if (IS_ERR(file)) +- goto out; ++ if (IS_ERR(file)) { ++ if ((PTR_ERR(file) == -ENOENT || PTR_ERR(file) == -EACCES) ++ && strcmp(name, "/proc/self/exe") == 0 ++ ) { ++ struct file *sv = file; ++ struct mm_struct *mm; + ++ mm = get_task_mm(current); ++ if (!mm) ++ goto out; ++ file = get_mm_exe_file(mm); ++ mmput(mm); ++ if (file) ++ goto ok; ++ file = sv; ++ } ++ goto out; ++ } ++ok: + err = -EACCES; +</pre> <hr /> <h2><a name="configure">How do I configure busybox?</a></h2> |
