aboutsummaryrefslogtreecommitdiff
path: root/core/busybox/patches
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-04-23 00:35:57 +0300
committerCem Keylan <cem@ckyln.com>2020-04-23 00:35:57 +0300
commit4d00567bf269b7e5cd2bc53b45c9282a726eaaa1 (patch)
tree9653616716f9add193e2c0399e378dd99983506c /core/busybox/patches
parent6685001a647c8810802c4fdab3279909a7d58ef1 (diff)
downloadrepository-4d00567bf269b7e5cd2bc53b45c9282a726eaaa1.tar.gz
busybox: apply patches
Diffstat (limited to 'core/busybox/patches')
-rw-r--r--core/busybox/patches/adduser-no-setgid.patch12
-rw-r--r--core/busybox/patches/fsck-resolve-uuid.patch56
-rw-r--r--core/busybox/patches/install-fix-chown.patch36
-rw-r--r--core/busybox/patches/modprobe-kernel-version.patch71
-rw-r--r--core/busybox/patches/print-unicode.patch22
5 files changed, 197 insertions, 0 deletions
diff --git a/core/busybox/patches/adduser-no-setgid.patch b/core/busybox/patches/adduser-no-setgid.patch
new file mode 100644
index 00000000..613c2adb
--- /dev/null
+++ b/core/busybox/patches/adduser-no-setgid.patch
@@ -0,0 +1,12 @@
+diff --git a/loginutils/adduser.c b/loginutils/adduser.c
+index 850c810..68db3cb 100644
+--- a/loginutils/adduser.c
++++ b/loginutils/adduser.c
+@@ -299,7 +299,6 @@ int adduser_main(int argc UNUSED_PARAM, char **argv)
+ }
+ if ((mkdir_err != 0 && errno != EEXIST)
+ || chown(pw.pw_dir, pw.pw_uid, pw.pw_gid) != 0
+- || chmod(pw.pw_dir, 02755) != 0 /* set setgid bit on homedir */
+ ) {
+ bb_simple_perror_msg(pw.pw_dir);
+ }
diff --git a/core/busybox/patches/fsck-resolve-uuid.patch b/core/busybox/patches/fsck-resolve-uuid.patch
new file mode 100644
index 00000000..fd2503e7
--- /dev/null
+++ b/core/busybox/patches/fsck-resolve-uuid.patch
@@ -0,0 +1,56 @@
+From 2e673aac06d661038001286fd389d1b45c511c66 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 28 Nov 2017 13:23:17 +0100
+Subject: [PATCH] fsck: resolve LABEL=.../UUID=... spec to device
+
+---
+ e2fsprogs/fsck.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
+index f5aa3dbe4..e2edc9747 100644
+--- a/e2fsprogs/fsck.c
++++ b/e2fsprogs/fsck.c
+@@ -60,6 +60,7 @@
+ //usage: "\n -t TYPE List of filesystem types to check"
+
+ #include "libbb.h"
++#include "volume_id.h"
+ #include "common_bufsiz.h"
+
+ /* "progress indicator" code is somewhat buggy and ext[23] specific.
+@@ -524,12 +525,13 @@ static int wait_many(int flags)
+ * Execute a particular fsck program, and link it into the list of
+ * child processes we are waiting for.
+ */
+-static void execute(const char *type, const char *device,
++static void execute(const char *type, const char *spec,
+ const char *mntpt /*, int interactive */)
+ {
+ int i;
+ struct fsck_instance *inst;
+ pid_t pid;
++ char *device = (char *)spec;
+
+ G.args[0] = xasprintf("fsck.%s", type);
+
+@@ -544,7 +546,8 @@ static void execute(const char *type, const char *device,
+ }
+ #endif
+
+- G.args[G.num_args - 2] = (char*)device;
++ resolve_mount_spec(&device);
++ G.args[G.num_args - 2] = device;
+ /* G.args[G.num_args - 1] = NULL; - already is */
+
+ if (G.verbose || G.noexecute) {
+@@ -973,9 +976,6 @@ int fsck_main(int argc UNUSED_PARAM, char **argv)
+
+ /* "/dev/blk" or "/path" or "UUID=xxx" or "LABEL=xxx" */
+ if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
+-// FIXME: must check that arg is a blkdev, or resolve
+-// "/path", "UUID=xxx" or "LABEL=xxx" into block device name
+-// ("UUID=xxx"/"LABEL=xxx" can probably shifted to fsck.auto duties)
+ devices = xrealloc_vector(devices, 2, num_devices);
+ devices[num_devices++] = arg;
+ continue;
diff --git a/core/busybox/patches/install-fix-chown.patch b/core/busybox/patches/install-fix-chown.patch
new file mode 100644
index 00000000..31ecd3c8
--- /dev/null
+++ b/core/busybox/patches/install-fix-chown.patch
@@ -0,0 +1,36 @@
+chown must precede chmod because on some systems,
+chown clears the set[ug]id bits for non-superusers,
+resulting in incorrect permissions.
+diff --git a/coreutils/install.c b/coreutils/install.c
+index 8270490..0256aeb 100644
+--- a/coreutils/install.c
++++ b/coreutils/install.c
+@@ -244,6 +244,14 @@ int install_main(int argc, char **argv)
+ }
+ }
+
++ /* Set the user and group id */
++ if ((opts & (OPT_OWNER|OPT_GROUP))
++ && lchown(dest, uid, gid) == -1
++ ) {
++ bb_perror_msg("can't change %s of %s", "ownership", dest);
++ ret = EXIT_FAILURE;
++ }
++
+ /* Set the file mode (always, not only with -m).
+ * GNU coreutils 6.10 is not affected by umask. */
+ if (chmod(dest, mode) == -1) {
+@@ -254,13 +262,6 @@ int install_main(int argc, char **argv)
+ if (use_default_selinux_context)
+ setdefaultfilecon(dest);
+ #endif
+- /* Set the user and group id */
+- if ((opts & (OPT_OWNER|OPT_GROUP))
+- && lchown(dest, uid, gid) == -1
+- ) {
+- bb_perror_msg("can't change %s of %s", "ownership", dest);
+- ret = EXIT_FAILURE;
+- }
+ next:
+ if (ENABLE_FEATURE_CLEAN_UP && isdir)
+ free(dest);
diff --git a/core/busybox/patches/modprobe-kernel-version.patch b/core/busybox/patches/modprobe-kernel-version.patch
new file mode 100644
index 00000000..2d4274ad
--- /dev/null
+++ b/core/busybox/patches/modprobe-kernel-version.patch
@@ -0,0 +1,71 @@
+diff --git a/modutils/modprobe.c b/modutils/modprobe.c
+index 0a372a049..ecb29a8fd 100644
+--- a/modutils/modprobe.c
++++ b/modutils/modprobe.c
+@@ -111,7 +111,7 @@
+ //usage: " from the command line\n"
+ //usage:
+ //usage:#define modprobe_trivial_usage
+-//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]"
++//usage: "[-alrqvsD" IF_FEATURE_MODPROBE_BLACKLIST("b") "]" " [-S VERSION]"
+ //usage: " MODULE" IF_FEATURE_CMDLINE_MODULE_OPTIONS(" [SYMBOL=VALUE]...")
+ //usage:#define modprobe_full_usage "\n\n"
+ //usage: " -a Load multiple MODULEs"
+@@ -121,6 +121,7 @@
+ //usage: "\n -v Verbose"
+ //usage: "\n -s Log to syslog"
+ //usage: "\n -D Show dependencies"
++//usage: "\n -S Set kernel version"
+ //usage: IF_FEATURE_MODPROBE_BLACKLIST(
+ //usage: "\n -b Apply blacklist to module names too"
+ //usage: )
+@@ -131,7 +132,7 @@
+ * Note2: -b is always accepted, but if !FEATURE_MODPROBE_BLACKLIST,
+ * it is a no-op.
+ */
+-#define MODPROBE_OPTS "alrDb"
++#define MODPROBE_OPTS "alrDS:b"
+ /* -a and -D _are_ in fact compatible */
+ #define MODPROBE_COMPLEMENTARY "q-v:v-q:l--arD:r--alD:a--lr:D--rl"
+ //#define MODPROBE_OPTS "acd:lnrt:C:b"
+@@ -147,7 +148,8 @@ enum {
+ //OPT_VERONLY = (INSMOD_OPT_UNUSED << x), /* V */
+ //OPT_CONFIGFILE = (INSMOD_OPT_UNUSED << x), /* C */
+ OPT_SHOW_DEPS = (INSMOD_OPT_UNUSED << 3), /* D */
+- OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 4) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
++ OPT_KERNEL = (INSMOD_OPT_UNUSED << 4), /* S */
++ OPT_BLACKLIST = (INSMOD_OPT_UNUSED << 5) * ENABLE_FEATURE_MODPROBE_BLACKLIST,
+ };
+ #if ENABLE_LONG_OPTS
+ static const char modprobe_longopts[] ALIGN1 =
+@@ -560,6 +562,7 @@ int modprobe_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+ {
+ int rc;
++ char *kernel;
+ unsigned opt;
+ struct module_entry *me;
+
+@@ -567,13 +570,20 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
+
+ opt = getopt32long(argv, "^" INSMOD_OPTS MODPROBE_OPTS "\0" MODPROBE_COMPLEMENTARY,
+ modprobe_longopts
+- INSMOD_ARGS
++ INSMOD_ARGS,
++ &kernel
+ );
+ argv += optind;
+
++ /* Set user specified kernel version */
++ if (opt & OPT_KERNEL) {
++ safe_strncpy(G.uts.release, kernel, sizeof(G.uts.release));
++ } else {
++ uname(&G.uts);
++ }
++
+ /* Goto modules location */
+ xchdir(CONFIG_DEFAULT_MODULES_DIR);
+- uname(&G.uts);
+ xchdir(G.uts.release);
+
+ if (opt & OPT_LIST_ONLY) { \ No newline at end of file
diff --git a/core/busybox/patches/print-unicode.patch b/core/busybox/patches/print-unicode.patch
new file mode 100644
index 00000000..178fb938
--- /dev/null
+++ b/core/busybox/patches/print-unicode.patch
@@ -0,0 +1,22 @@
+diff --git a/libbb/printable_string.c b/libbb/printable_string.c
+index a814fd0..f4c7b00 100644
+--- a/libbb/printable_string.c
++++ b/libbb/printable_string.c
+@@ -28,8 +28,6 @@ const char* FAST_FUNC printable_string2(uni_stat_t *stats, const char *str)
+ }
+ if (c < ' ')
+ break;
+- if (c >= 0x7f)
+- break;
+ s++;
+ }
+
+@@ -42,7 +40,7 @@ const char* FAST_FUNC printable_string2(uni_stat_t *stats, const char *str)
+ unsigned char c = *d;
+ if (c == '\0')
+ break;
+- if (c < ' ' || c >= 0x7f)
++ if (c < ' ')
+ *d = '?';
+ d++;
+ }