1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
add `bb` and `bbsh` shortcuts as aliases to the main shell so we can install
symlinks in Gentoo at /bin/bb as our recovery shell.
we also add fallbacks to /bin/busybox and /bin/busybox.static in case /proc
is not yet mounted during early boot.
rebase the patch to 1.38.0
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -181,6 +181,8 @@
// APPLET_ODDNAME:name main location suid_type help
//applet:IF_SH_IS_ASH( APPLET_ODDNAME(sh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
//applet:IF_BASH_IS_ASH(APPLET_ODDNAME(bash, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
+//applet:IF_ASH(APPLET_ODDNAME(bb, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
+//applet:IF_ASH(APPLET_ODDNAME(bbsh, ash, BB_DIR_BIN, BB_SUID_DROP, ash))
//kbuild:lib-$(CONFIG_SHELL_ASH) += ash.o ash_ptr_hack.o shell_common.o
//kbuild:lib-$(CONFIG_ASH_RANDOM_SUPPORT) += random.o
@@ -6164,6 +6166,8 @@ tryexec_applet(int applet_no, const char *cmd, char **argv, char **envp)
}
/* re-exec ourselves with the new arguments */
execve(bb_busybox_exec_path, argv, envp);
+ execve("/bin/busybox.static", argv, envp);
+ execve("/bin/busybox", argv, envp);
/* If they called chroot or otherwise made the binary
* no longer executable, return.
*/
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -345,6 +345,8 @@
// APPLET_ODDNAME:name main location suid_type help
//applet:IF_SH_IS_HUSH( APPLET_ODDNAME(sh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
//applet:IF_BASH_IS_HUSH(APPLET_ODDNAME(bash, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
+//applet:IF_HUSH(APPLET_ODDNAME(bb, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
+//applet:IF_HUSH(APPLET_ODDNAME(bbsh, hush, BB_DIR_BIN, BB_SUID_DROP, hush))
//kbuild:lib-$(CONFIG_SHELL_HUSH) += hush.o match.o shell_common.o
//kbuild:lib-$(CONFIG_HUSH_RANDOM_SUPPORT) += random.o
@@ -8104,6 +8106,8 @@ static NORETURN void re_execute_shell(
if (SPECIAL_JOBSTOP_SIGS != 0)
switch_off_special_sigs(G.special_sig_mask & SPECIAL_JOBSTOP_SIGS);
execve(bb_busybox_exec_path, argv, pp);
+ execve("/bin/busybox.static", argv, pp);
+ execve("/bin/busybox", argv, pp);
/* Fallback. Useful for init=/bin/hush usage etc */
if (argv[0][0] == '/')
execve(argv[0], argv, pp);
@@ -9397,6 +9401,8 @@ static NORETURN NOINLINE void pseudo_exec_argv(
if (SPECIAL_JOBSTOP_SIGS != 0)
switch_off_special_sigs(G.special_sig_mask & SPECIAL_JOBSTOP_SIGS);
execv(bb_busybox_exec_path, argv);
+ execv("/bin/busybox.static", argv);
+ execv("/bin/busybox", argv);
/* If they called chroot or otherwise made the binary no longer
* executable, fall through */
}
|