diff options
Diffstat (limited to 'meta')
16 files changed, 123 insertions, 611 deletions
diff --git a/meta/recipes-core/busybox/busybox-inittab_1.36.1.bb b/meta/recipes-core/busybox/busybox-inittab_1.37.0.bb index 4ffc44c808..4ffc44c808 100644 --- a/meta/recipes-core/busybox/busybox-inittab_1.36.1.bb +++ b/meta/recipes-core/busybox/busybox-inittab_1.37.0.bb | |||
diff --git a/meta/recipes-core/busybox/busybox/0001-awk-fix-precedence-of-relative-to.patch b/meta/recipes-core/busybox/busybox/0001-awk-fix-precedence-of-relative-to.patch deleted file mode 100644 index 5836cf8a00..0000000000 --- a/meta/recipes-core/busybox/busybox/0001-awk-fix-precedence-of-relative-to.patch +++ /dev/null | |||
| @@ -1,197 +0,0 @@ | |||
| 1 | From dedc9380c76834ba64c8b526aef6f461ea4e7f2e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Denys Vlasenko <vda.linux@googlemail.com> | ||
| 3 | Date: Tue, 30 May 2023 16:42:18 +0200 | ||
| 4 | Subject: [PATCH 1/2] awk: fix precedence of = relative to == | ||
| 5 | |||
| 6 | Discovered while adding code to disallow assignments to non-lvalues | ||
| 7 | |||
| 8 | function old new delta | ||
| 9 | parse_expr 936 991 +55 | ||
| 10 | .rodata 105243 105247 +4 | ||
| 11 | ------------------------------------------------------------------------------ | ||
| 12 | (add/remove: 0/0 grow/shrink: 2/0 up/down: 59/0) Total: 59 bytes | ||
| 13 | |||
| 14 | CVE: CVE-2023-42364 CVE-2023-42365 | ||
| 15 | |||
| 16 | Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=0256e00a9d077588bd3a39f5a1ef7e2eaa2911e4] | ||
| 17 | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> | ||
| 18 | (cherry picked from commit 0256e00a9d077588bd3a39f5a1ef7e2eaa2911e4) | ||
| 19 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 20 | --- | ||
| 21 | editors/awk.c | 66 ++++++++++++++++++++++++++++++--------------- | ||
| 22 | testsuite/awk.tests | 5 ++++ | ||
| 23 | 2 files changed, 50 insertions(+), 21 deletions(-) | ||
| 24 | |||
| 25 | diff --git a/editors/awk.c b/editors/awk.c | ||
| 26 | index ec9301e..aff86fe 100644 | ||
| 27 | --- a/editors/awk.c | ||
| 28 | +++ b/editors/awk.c | ||
| 29 | @@ -337,7 +337,9 @@ static void debug_parse_print_tc(uint32_t n) | ||
| 30 | #undef P | ||
| 31 | #undef PRIMASK | ||
| 32 | #undef PRIMASK2 | ||
| 33 | -#define P(x) (x << 24) | ||
| 34 | +/* Smaller 'x' means _higher_ operator precedence */ | ||
| 35 | +#define PRECEDENCE(x) (x << 24) | ||
| 36 | +#define P(x) PRECEDENCE(x) | ||
| 37 | #define PRIMASK 0x7F000000 | ||
| 38 | #define PRIMASK2 0x7E000000 | ||
| 39 | |||
| 40 | @@ -360,7 +362,7 @@ enum { | ||
| 41 | OC_MOVE = 0x1f00, OC_PGETLINE = 0x2000, OC_REGEXP = 0x2100, | ||
| 42 | OC_REPLACE = 0x2200, OC_RETURN = 0x2300, OC_SPRINTF = 0x2400, | ||
| 43 | OC_TERNARY = 0x2500, OC_UNARY = 0x2600, OC_VAR = 0x2700, | ||
| 44 | - OC_DONE = 0x2800, | ||
| 45 | + OC_CONST = 0x2800, OC_DONE = 0x2900, | ||
| 46 | |||
| 47 | ST_IF = 0x3000, ST_DO = 0x3100, ST_FOR = 0x3200, | ||
| 48 | ST_WHILE = 0x3300 | ||
| 49 | @@ -440,9 +442,9 @@ static const uint32_t tokeninfo[] ALIGN4 = { | ||
| 50 | #define TI_PREINC (OC_UNARY|xV|P(9)|'P') | ||
| 51 | #define TI_PREDEC (OC_UNARY|xV|P(9)|'M') | ||
| 52 | TI_PREINC, TI_PREDEC, OC_FIELD|xV|P(5), | ||
| 53 | - OC_COMPARE|VV|P(39)|5, OC_MOVE|VV|P(74), OC_REPLACE|NV|P(74)|'+', OC_REPLACE|NV|P(74)|'-', | ||
| 54 | - OC_REPLACE|NV|P(74)|'*', OC_REPLACE|NV|P(74)|'/', OC_REPLACE|NV|P(74)|'%', OC_REPLACE|NV|P(74)|'&', | ||
| 55 | - OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(74)|'&', OC_BINARY|NV|P(15)|'&', | ||
| 56 | + OC_COMPARE|VV|P(39)|5, OC_MOVE|VV|P(38), OC_REPLACE|NV|P(38)|'+', OC_REPLACE|NV|P(38)|'-', | ||
| 57 | + OC_REPLACE|NV|P(38)|'*', OC_REPLACE|NV|P(38)|'/', OC_REPLACE|NV|P(38)|'%', OC_REPLACE|NV|P(38)|'&', | ||
| 58 | + OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(38)|'&', OC_BINARY|NV|P(15)|'&', | ||
| 59 | OC_BINARY|NV|P(25)|'/', OC_BINARY|NV|P(25)|'%', OC_BINARY|NV|P(15)|'&', OC_BINARY|NV|P(25)|'*', | ||
| 60 | OC_COMPARE|VV|P(39)|4, OC_COMPARE|VV|P(39)|3, OC_COMPARE|VV|P(39)|0, OC_COMPARE|VV|P(39)|1, | ||
| 61 | #define TI_LESS (OC_COMPARE|VV|P(39)|2) | ||
| 62 | @@ -1290,7 +1292,7 @@ static uint32_t next_token(uint32_t expected) | ||
| 63 | save_tclass = tc; | ||
| 64 | save_info = t_info; | ||
| 65 | tc = TC_BINOPX; | ||
| 66 | - t_info = OC_CONCAT | SS | P(35); | ||
| 67 | + t_info = OC_CONCAT | SS | PRECEDENCE(35); | ||
| 68 | } | ||
| 69 | |||
| 70 | t_tclass = tc; | ||
| 71 | @@ -1350,9 +1352,8 @@ static node *parse_expr(uint32_t term_tc) | ||
| 72 | { | ||
| 73 | node sn; | ||
| 74 | node *cn = &sn; | ||
| 75 | - node *vn, *glptr; | ||
| 76 | + node *glptr; | ||
| 77 | uint32_t tc, expected_tc; | ||
| 78 | - var *v; | ||
| 79 | |||
| 80 | debug_printf_parse("%s() term_tc(%x):", __func__, term_tc); | ||
| 81 | debug_parse_print_tc(term_tc); | ||
| 82 | @@ -1363,11 +1364,12 @@ static node *parse_expr(uint32_t term_tc) | ||
| 83 | expected_tc = TS_OPERAND | TS_UOPPRE | TC_REGEXP | term_tc; | ||
| 84 | |||
| 85 | while (!((tc = next_token(expected_tc)) & term_tc)) { | ||
| 86 | + node *vn; | ||
| 87 | |||
| 88 | if (glptr && (t_info == TI_LESS)) { | ||
| 89 | /* input redirection (<) attached to glptr node */ | ||
| 90 | debug_printf_parse("%s: input redir\n", __func__); | ||
| 91 | - cn = glptr->l.n = new_node(OC_CONCAT | SS | P(37)); | ||
| 92 | + cn = glptr->l.n = new_node(OC_CONCAT | SS | PRECEDENCE(37)); | ||
| 93 | cn->a.n = glptr; | ||
| 94 | expected_tc = TS_OPERAND | TS_UOPPRE; | ||
| 95 | glptr = NULL; | ||
| 96 | @@ -1379,24 +1381,42 @@ static node *parse_expr(uint32_t term_tc) | ||
| 97 | * previous operators with higher priority */ | ||
| 98 | vn = cn; | ||
| 99 | while (((t_info & PRIMASK) > (vn->a.n->info & PRIMASK2)) | ||
| 100 | - || ((t_info == vn->info) && t_info == TI_COLON) | ||
| 101 | + || (t_info == vn->info && t_info == TI_COLON) | ||
| 102 | ) { | ||
| 103 | vn = vn->a.n; | ||
| 104 | if (!vn->a.n) syntax_error(EMSG_UNEXP_TOKEN); | ||
| 105 | } | ||
| 106 | if (t_info == TI_TERNARY) | ||
| 107 | //TODO: why? | ||
| 108 | - t_info += P(6); | ||
| 109 | + t_info += PRECEDENCE(6); | ||
| 110 | cn = vn->a.n->r.n = new_node(t_info); | ||
| 111 | cn->a.n = vn->a.n; | ||
| 112 | if (tc & TS_BINOP) { | ||
| 113 | cn->l.n = vn; | ||
| 114 | -//FIXME: this is the place to detect and reject assignments to non-lvalues. | ||
| 115 | -//Currently we allow "assignments" to consts and temporaries, nonsense like this: | ||
| 116 | -// awk 'BEGIN { "qwe" = 1 }' | ||
| 117 | -// awk 'BEGIN { 7 *= 7 }' | ||
| 118 | -// awk 'BEGIN { length("qwe") = 1 }' | ||
| 119 | -// awk 'BEGIN { (1+1) += 3 }' | ||
| 120 | + | ||
| 121 | + /* Prevent: | ||
| 122 | + * awk 'BEGIN { "qwe" = 1 }' | ||
| 123 | + * awk 'BEGIN { 7 *= 7 }' | ||
| 124 | + * awk 'BEGIN { length("qwe") = 1 }' | ||
| 125 | + * awk 'BEGIN { (1+1) += 3 }' | ||
| 126 | + */ | ||
| 127 | + /* Assignment? (including *= and friends) */ | ||
| 128 | + if (((t_info & OPCLSMASK) == OC_MOVE) | ||
| 129 | + || ((t_info & OPCLSMASK) == OC_REPLACE) | ||
| 130 | + ) { | ||
| 131 | + debug_printf_parse("%s: MOVE/REPLACE vn->info:%08x\n", __func__, vn->info); | ||
| 132 | + /* Left side is a (variable or array element) | ||
| 133 | + * or function argument | ||
| 134 | + * or $FIELD ? | ||
| 135 | + */ | ||
| 136 | + if ((vn->info & OPCLSMASK) != OC_VAR | ||
| 137 | + && (vn->info & OPCLSMASK) != OC_FNARG | ||
| 138 | + && (vn->info & OPCLSMASK) != OC_FIELD | ||
| 139 | + ) { | ||
| 140 | + syntax_error(EMSG_UNEXP_TOKEN); /* no. bad */ | ||
| 141 | + } | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | expected_tc = TS_OPERAND | TS_UOPPRE | TC_REGEXP; | ||
| 145 | if (t_info == TI_PGETLINE) { | ||
| 146 | /* it's a pipe */ | ||
| 147 | @@ -1432,6 +1452,8 @@ static node *parse_expr(uint32_t term_tc) | ||
| 148 | /* one should be very careful with switch on tclass - | ||
| 149 | * only simple tclasses should be used (TC_xyz, not TS_xyz) */ | ||
| 150 | switch (tc) { | ||
| 151 | + var *v; | ||
| 152 | + | ||
| 153 | case TC_VARIABLE: | ||
| 154 | case TC_ARRAY: | ||
| 155 | debug_printf_parse("%s: TC_VARIABLE | TC_ARRAY\n", __func__); | ||
| 156 | @@ -1452,14 +1474,14 @@ static node *parse_expr(uint32_t term_tc) | ||
| 157 | case TC_NUMBER: | ||
| 158 | case TC_STRING: | ||
| 159 | debug_printf_parse("%s: TC_NUMBER | TC_STRING\n", __func__); | ||
| 160 | - cn->info = OC_VAR; | ||
| 161 | + cn->info = OC_CONST; | ||
| 162 | v = cn->l.v = xzalloc(sizeof(var)); | ||
| 163 | - if (tc & TC_NUMBER) | ||
| 164 | + if (tc & TC_NUMBER) { | ||
| 165 | setvar_i(v, t_double); | ||
| 166 | - else { | ||
| 167 | + } else { | ||
| 168 | setvar_s(v, t_string); | ||
| 169 | - expected_tc &= ~TC_UOPPOST; /* "str"++ is not allowed */ | ||
| 170 | } | ||
| 171 | + expected_tc &= ~TC_UOPPOST; /* NUM++, "str"++ not allowed */ | ||
| 172 | break; | ||
| 173 | |||
| 174 | case TC_REGEXP: | ||
| 175 | @@ -3107,6 +3129,8 @@ static var *evaluate(node *op, var *res) | ||
| 176 | |||
| 177 | /* -- recursive node type -- */ | ||
| 178 | |||
| 179 | + case XC( OC_CONST ): | ||
| 180 | + debug_printf_eval("CONST "); | ||
| 181 | case XC( OC_VAR ): | ||
| 182 | debug_printf_eval("VAR\n"); | ||
| 183 | L.v = op->l.v; | ||
| 184 | diff --git a/testsuite/awk.tests b/testsuite/awk.tests | ||
| 185 | index ddc5104..a78fdcd 100755 | ||
| 186 | --- a/testsuite/awk.tests | ||
| 187 | +++ b/testsuite/awk.tests | ||
| 188 | @@ -540,4 +540,9 @@ testing 'awk assign while assign' \ | ||
| 189 | │ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%] | ||
| 190 | └────────────────────────────────────────────────────┘^C" | ||
| 191 | |||
| 192 | +testing "awk = has higher precedence than == (despite what gawk manpage claims)" \ | ||
| 193 | + "awk 'BEGIN { v=1; print 2==v; print 2==v=2; print v; print v=3==3; print v}'" \ | ||
| 194 | + '0\n1\n2\n1\n3\n' \ | ||
| 195 | + '' '' | ||
| 196 | + | ||
| 197 | exit $FAILCOUNT | ||
diff --git a/meta/recipes-core/busybox/busybox/0001-awk-fix-segfault-when-compiled-by-clang.patch b/meta/recipes-core/busybox/busybox/0001-awk-fix-segfault-when-compiled-by-clang.patch deleted file mode 100644 index 3f6145b250..0000000000 --- a/meta/recipes-core/busybox/busybox/0001-awk-fix-segfault-when-compiled-by-clang.patch +++ /dev/null | |||
| @@ -1,41 +0,0 @@ | |||
| 1 | From e1a68741067167dc4837e0a26d3d5c318a631fc7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Ron Yorston <rmy@pobox.com> | ||
| 3 | Date: Fri, 19 Jan 2024 15:41:17 +0000 | ||
| 4 | Subject: [PATCH] awk: fix segfault when compiled by clang | ||
| 5 | |||
| 6 | A 32-bit build of BusyBox using clang segfaulted in the test | ||
| 7 | "awk assign while assign". Specifically, on line 7 of the test | ||
| 8 | input where the adjustment of the L.v pointer when the Fields | ||
| 9 | array was reallocated | ||
| 10 | |||
| 11 | L.v += Fields - old_Fields_ptr; | ||
| 12 | |||
| 13 | was out by 4 bytes. | ||
| 14 | |||
| 15 | Rearrange to code so both gcc and clang generate code that works. | ||
| 16 | |||
| 17 | Signed-off-by: Ron Yorston <rmy@pobox.com> | ||
| 18 | Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | ||
| 19 | |||
| 20 | Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=5dcc443dba039b305a510c01883e9f34e42656ae] | ||
| 21 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 22 | --- | ||
| 23 | editors/awk.c | 2 +- | ||
| 24 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 25 | |||
| 26 | diff --git a/editors/awk.c b/editors/awk.c | ||
| 27 | index aa485c782..0981c6735 100644 | ||
| 28 | --- a/editors/awk.c | ||
| 29 | +++ b/editors/awk.c | ||
| 30 | @@ -2935,7 +2935,7 @@ static var *evaluate(node *op, var *res) | ||
| 31 | if (old_Fields_ptr) { | ||
| 32 | //if (old_Fields_ptr != Fields) | ||
| 33 | // debug_printf_eval("L.v moved\n"); | ||
| 34 | - L.v += Fields - old_Fields_ptr; | ||
| 35 | + L.v = Fields + (L.v - old_Fields_ptr); | ||
| 36 | } | ||
| 37 | if (opinfo & OF_STR2) { | ||
| 38 | R.s = getvar_s(R.v); | ||
| 39 | -- | ||
| 40 | 2.30.2 | ||
| 41 | |||
diff --git a/meta/recipes-core/busybox/busybox/0001-awk.c-fix-CVE-2023-42366-bug-15874.patch b/meta/recipes-core/busybox/busybox/0001-awk.c-fix-CVE-2023-42366-bug-15874.patch deleted file mode 100644 index 282c2fde5a..0000000000 --- a/meta/recipes-core/busybox/busybox/0001-awk.c-fix-CVE-2023-42366-bug-15874.patch +++ /dev/null | |||
| @@ -1,37 +0,0 @@ | |||
| 1 | From 8542236894a8d5f7393327117bc7f64787444efc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Valery Ushakov <uwe@stderr.spb.ru> | ||
| 3 | Date: Wed, 24 Jan 2024 22:24:41 +0300 | ||
| 4 | Subject: [PATCH] awk.c: fix CVE-2023-42366 (bug #15874) | ||
| 5 | |||
| 6 | Make sure we don't read past the end of the string in next_token() | ||
| 7 | when backslash is the last character in an (invalid) regexp. | ||
| 8 | a fix and issue reported in bugzilla | ||
| 9 | |||
| 10 | https://bugs.busybox.net/show_bug.cgi?id=15874 | ||
| 11 | |||
| 12 | Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html] | ||
| 13 | |||
| 14 | CVE: CVE-2023-42366 | ||
| 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 16 | --- | ||
| 17 | editors/awk.c | 6 ++++-- | ||
| 18 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/editors/awk.c b/editors/awk.c | ||
| 21 | index f320d8c..a53b193 100644 | ||
| 22 | --- a/editors/awk.c | ||
| 23 | +++ b/editors/awk.c | ||
| 24 | @@ -1168,9 +1168,11 @@ static uint32_t next_token(uint32_t expected) | ||
| 25 | s[-1] = bb_process_escape_sequence((const char **)&pp); | ||
| 26 | if (*p == '\\') | ||
| 27 | *s++ = '\\'; | ||
| 28 | - if (pp == p) | ||
| 29 | + if (pp == p) { | ||
| 30 | + if (*p == '\0') | ||
| 31 | + syntax_error(EMSG_UNEXP_EOS); | ||
| 32 | *s++ = *p++; | ||
| 33 | - else | ||
| 34 | + } else | ||
| 35 | p = pp; | ||
| 36 | } | ||
| 37 | } | ||
diff --git a/meta/recipes-core/busybox/busybox/0001-syslogd-fix-wrong-OPT_locallog-flag-detection.patch b/meta/recipes-core/busybox/busybox/0001-syslogd-fix-wrong-OPT_locallog-flag-detection.patch new file mode 100644 index 0000000000..c71172a4f9 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/0001-syslogd-fix-wrong-OPT_locallog-flag-detection.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 43ec36c0e3fbfd4191b18465a0554f4c1acf58d6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrej Valek <andrej.v@skyrain.eu> | ||
| 3 | Date: Wed, 16 Oct 2024 09:09:55 +0200 | ||
| 4 | Subject: [PATCH] syslogd: fix wrong OPT_locallog flag detection | ||
| 5 | |||
| 6 | The OPT_locallog was set on "option_mask32" but checked on local | ||
| 7 | "opts" variable. While this flag it's used on multiple places can't be | ||
| 8 | has to be used with "option_mask32". Without this change syslogd | ||
| 9 | is more-less unusable while no messages are logged locally. | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://lists.busybox.net/pipermail/busybox/2024-October/090969.html] | ||
| 12 | |||
| 13 | Signed-off-by: Andrej Valek <andrej.v@skyrain.eu> | ||
| 14 | --- | ||
| 15 | sysklogd/syslogd.c | 2 +- | ||
| 16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 17 | |||
| 18 | diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c | ||
| 19 | index 7558051f0..fa03aa280 100644 | ||
| 20 | --- a/sysklogd/syslogd.c | ||
| 21 | +++ b/sysklogd/syslogd.c | ||
| 22 | @@ -1179,7 +1179,7 @@ int syslogd_main(int argc UNUSED_PARAM, char **argv) | ||
| 23 | } | ||
| 24 | } | ||
| 25 | #endif | ||
| 26 | - if (!ENABLE_FEATURE_REMOTE_LOG || (opts & OPT_locallog)) { | ||
| 27 | + if (!ENABLE_FEATURE_REMOTE_LOG || (option_mask32 & OPT_locallog)) { | ||
| 28 | recvbuf[sz] = '\0'; /* ensure it *is* NUL terminated */ | ||
| 29 | split_escape_and_log(recvbuf, sz); | ||
| 30 | } | ||
| 31 | -- | ||
| 32 | 2.34.1 | ||
| 33 | |||
diff --git a/meta/recipes-core/busybox/busybox/0002-awk-fix-ternary-operator-and-precedence-of.patch b/meta/recipes-core/busybox/busybox/0002-awk-fix-ternary-operator-and-precedence-of.patch deleted file mode 100644 index ea3c84897b..0000000000 --- a/meta/recipes-core/busybox/busybox/0002-awk-fix-ternary-operator-and-precedence-of.patch +++ /dev/null | |||
| @@ -1,96 +0,0 @@ | |||
| 1 | From c3bfdac8e0e9a21d524ad72036953f68d2193e52 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Natanael Copa <ncopa@alpinelinux.org> | ||
| 3 | Date: Tue, 21 May 2024 14:46:08 +0200 | ||
| 4 | Subject: [PATCH 2/2] awk: fix ternary operator and precedence of = | ||
| 5 | |||
| 6 | Adjust the = precedence test to match behavior of gawk, mawk and | ||
| 7 | FreeBSD. awk 'BEGIN {print v=3==3; print v}' should print two '1'. | ||
| 8 | |||
| 9 | To fix this, and to unbreak the ternary conditional operator, we restore | ||
| 10 | the precedence of = in the token list, but override this with a lower | ||
| 11 | priority when the assignment is on the right side of a compare. | ||
| 12 | |||
| 13 | This fixes commit 0256e00a9d07 (awk: fix precedence of = relative to ==) [1] | ||
| 14 | |||
| 15 | CVE: CVE-2023-42364 CVE-2023-42365 | ||
| 16 | |||
| 17 | Upstream-Status: Submitted [http://lists.busybox.net/pipermail/busybox/2024-May/090766.html] | ||
| 18 | |||
| 19 | [1] https://bugs.busybox.net/show_bug.cgi?id=15871#c6 | ||
| 20 | |||
| 21 | Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> | ||
| 22 | (cherry picked from commit 1714301c405ef03b39605c85c23f22a190cddd95) | ||
| 23 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 24 | --- | ||
| 25 | editors/awk.c | 18 ++++++++++++++---- | ||
| 26 | testsuite/awk.tests | 9 +++++++-- | ||
| 27 | 2 files changed, 21 insertions(+), 6 deletions(-) | ||
| 28 | |||
| 29 | diff --git a/editors/awk.c b/editors/awk.c | ||
| 30 | index aff86fe..f320d8c 100644 | ||
| 31 | --- a/editors/awk.c | ||
| 32 | +++ b/editors/awk.c | ||
| 33 | @@ -442,9 +442,10 @@ static const uint32_t tokeninfo[] ALIGN4 = { | ||
| 34 | #define TI_PREINC (OC_UNARY|xV|P(9)|'P') | ||
| 35 | #define TI_PREDEC (OC_UNARY|xV|P(9)|'M') | ||
| 36 | TI_PREINC, TI_PREDEC, OC_FIELD|xV|P(5), | ||
| 37 | - OC_COMPARE|VV|P(39)|5, OC_MOVE|VV|P(38), OC_REPLACE|NV|P(38)|'+', OC_REPLACE|NV|P(38)|'-', | ||
| 38 | - OC_REPLACE|NV|P(38)|'*', OC_REPLACE|NV|P(38)|'/', OC_REPLACE|NV|P(38)|'%', OC_REPLACE|NV|P(38)|'&', | ||
| 39 | - OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(38)|'&', OC_BINARY|NV|P(15)|'&', | ||
| 40 | +#define TI_ASSIGN (OC_MOVE|VV|P(74)) | ||
| 41 | + OC_COMPARE|VV|P(39)|5, TI_ASSIGN, OC_REPLACE|NV|P(74)|'+', OC_REPLACE|NV|P(74)|'-', | ||
| 42 | + OC_REPLACE|NV|P(74)|'*', OC_REPLACE|NV|P(74)|'/', OC_REPLACE|NV|P(74)|'%', OC_REPLACE|NV|P(74)|'&', | ||
| 43 | + OC_BINARY|NV|P(29)|'+', OC_BINARY|NV|P(29)|'-', OC_REPLACE|NV|P(74)|'&', OC_BINARY|NV|P(15)|'&', | ||
| 44 | OC_BINARY|NV|P(25)|'/', OC_BINARY|NV|P(25)|'%', OC_BINARY|NV|P(15)|'&', OC_BINARY|NV|P(25)|'*', | ||
| 45 | OC_COMPARE|VV|P(39)|4, OC_COMPARE|VV|P(39)|3, OC_COMPARE|VV|P(39)|0, OC_COMPARE|VV|P(39)|1, | ||
| 46 | #define TI_LESS (OC_COMPARE|VV|P(39)|2) | ||
| 47 | @@ -1376,11 +1377,19 @@ static node *parse_expr(uint32_t term_tc) | ||
| 48 | continue; | ||
| 49 | } | ||
| 50 | if (tc & (TS_BINOP | TC_UOPPOST)) { | ||
| 51 | + int prio; | ||
| 52 | debug_printf_parse("%s: TS_BINOP | TC_UOPPOST tc:%x\n", __func__, tc); | ||
| 53 | /* for binary and postfix-unary operators, jump back over | ||
| 54 | * previous operators with higher priority */ | ||
| 55 | vn = cn; | ||
| 56 | - while (((t_info & PRIMASK) > (vn->a.n->info & PRIMASK2)) | ||
| 57 | + /* Let assignment get higher priority when used on right | ||
| 58 | + * side in compare. i.e: 2==v=3 */ | ||
| 59 | + if (t_info == TI_ASSIGN && (vn->a.n->info & OPCLSMASK) == OC_COMPARE) { | ||
| 60 | + prio = PRECEDENCE(38); | ||
| 61 | + } else { | ||
| 62 | + prio = (t_info & PRIMASK); | ||
| 63 | + } | ||
| 64 | + while ((prio > (vn->a.n->info & PRIMASK2)) | ||
| 65 | || (t_info == vn->info && t_info == TI_COLON) | ||
| 66 | ) { | ||
| 67 | vn = vn->a.n; | ||
| 68 | @@ -1412,6 +1421,7 @@ static node *parse_expr(uint32_t term_tc) | ||
| 69 | if ((vn->info & OPCLSMASK) != OC_VAR | ||
| 70 | && (vn->info & OPCLSMASK) != OC_FNARG | ||
| 71 | && (vn->info & OPCLSMASK) != OC_FIELD | ||
| 72 | + && (vn->info & OPCLSMASK) != OC_COMPARE | ||
| 73 | ) { | ||
| 74 | syntax_error(EMSG_UNEXP_TOKEN); /* no. bad */ | ||
| 75 | } | ||
| 76 | diff --git a/testsuite/awk.tests b/testsuite/awk.tests | ||
| 77 | index a78fdcd..d2706de 100755 | ||
| 78 | --- a/testsuite/awk.tests | ||
| 79 | +++ b/testsuite/awk.tests | ||
| 80 | @@ -540,9 +540,14 @@ testing 'awk assign while assign' \ | ||
| 81 | │ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%] | ||
| 82 | └────────────────────────────────────────────────────┘^C" | ||
| 83 | |||
| 84 | -testing "awk = has higher precedence than == (despite what gawk manpage claims)" \ | ||
| 85 | +testing "awk = has higher precedence than == on right side" \ | ||
| 86 | "awk 'BEGIN { v=1; print 2==v; print 2==v=2; print v; print v=3==3; print v}'" \ | ||
| 87 | - '0\n1\n2\n1\n3\n' \ | ||
| 88 | + '0\n1\n2\n1\n1\n' \ | ||
| 89 | + '' '' | ||
| 90 | + | ||
| 91 | +testing 'awk ternary precedence' \ | ||
| 92 | + "awk 'BEGIN { a = 0 ? \"yes\": \"no\"; print a }'" \ | ||
| 93 | + 'no\n' \ | ||
| 94 | '' '' | ||
| 95 | |||
| 96 | exit $FAILCOUNT | ||
diff --git a/meta/recipes-core/busybox/busybox/0002-start-stop-daemon-fix-tests.patch b/meta/recipes-core/busybox/busybox/0002-start-stop-daemon-fix-tests.patch new file mode 100644 index 0000000000..a5abec4e53 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/0002-start-stop-daemon-fix-tests.patch | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | From 85fb09e278aff8f4b3e11d7ace0d1347f750487f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Andrej Valek <andrej.v@skyrain.eu> | ||
| 3 | Date: Wed, 16 Oct 2024 10:11:01 +0200 | ||
| 4 | Subject: [PATCH] start-stop-daemon: fix tests | ||
| 5 | |||
| 6 | - "/tmp" directory could be link to somewhere else, so deference it | ||
| 7 | before comparing the expected path | ||
| 8 | - run "start-stop-daemon with both -x and -a" test only if "/bin/false" | ||
| 9 | is not a symlink. | ||
| 10 | |||
| 11 | Upstream-Status: Submitted [https://lists.busybox.net/pipermail/busybox/2024-October/090968.html] | ||
| 12 | |||
| 13 | Signed-off-by: Andrej Valek <andrej.v@skyrain.eu> | ||
| 14 | --- | ||
| 15 | testsuite/start-stop-daemon.tests | 14 +++++++++----- | ||
| 16 | 1 file changed, 9 insertions(+), 5 deletions(-) | ||
| 17 | |||
| 18 | diff --git a/testsuite/start-stop-daemon.tests b/testsuite/start-stop-daemon.tests | ||
| 19 | index e1e49ab5f..fd59859ef 100755 | ||
| 20 | --- a/testsuite/start-stop-daemon.tests | ||
| 21 | +++ b/testsuite/start-stop-daemon.tests | ||
| 22 | @@ -6,24 +6,27 @@ | ||
| 23 | |||
| 24 | # testing "test name" "cmd" "expected result" "file input" "stdin" | ||
| 25 | |||
| 26 | +# deference link to /tmp | ||
| 27 | +TMP_DIR="$(readlink -f /tmp)" | ||
| 28 | + | ||
| 29 | testing "start-stop-daemon -x without -a" \ | ||
| 30 | 'start-stop-daemon -S -x true 2>&1; echo $?' \ | ||
| 31 | "0\n" \ | ||
| 32 | "" "" | ||
| 33 | |||
| 34 | testing "start-stop-daemon -x with -d on existing directory" \ | ||
| 35 | - 'start-stop-daemon -S -d /tmp -x true 2>&1; echo $?' \ | ||
| 36 | + 'start-stop-daemon -S -d $TMP_DIR -x true 2>&1; echo $?' \ | ||
| 37 | "0\n" \ | ||
| 38 | "" "" | ||
| 39 | |||
| 40 | testing "start-stop-daemon -x with -d on existing and check dir" \ | ||
| 41 | - 'output=$(start-stop-daemon -S -d /tmp -x pwd); echo $output' \ | ||
| 42 | - "/tmp\n" \ | ||
| 43 | + 'output=$(start-stop-daemon -S -d $TMP_DIR -x pwd); echo $output' \ | ||
| 44 | + "$TMP_DIR\n" \ | ||
| 45 | "" "" | ||
| 46 | |||
| 47 | testing "start-stop-daemon -x with --chdir on existing and check dir" \ | ||
| 48 | - 'output=$(start-stop-daemon -S --chdir /tmp -x pwd); echo $output' \ | ||
| 49 | - "/tmp\n" \ | ||
| 50 | + 'output=$(start-stop-daemon -S --chdir $TMP_DIR -x pwd); echo $output' \ | ||
| 51 | + "$TMP_DIR\n" \ | ||
| 52 | "" "" | ||
| 53 | |||
| 54 | testing "start-stop-daemon -a without -x" \ | ||
| 55 | @@ -48,6 +51,7 @@ testing "start-stop-daemon -x with -d on non-existing directory" \ | ||
| 56 | # | ||
| 57 | # NB: this fails if /bin/false is a busybox symlink: | ||
| 58 | # busybox looks at argv[0] and says "qwerty: applet not found" | ||
| 59 | +test ! -L /bin/false && \ | ||
| 60 | testing "start-stop-daemon with both -x and -a" \ | ||
| 61 | 'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \ | ||
| 62 | "1\n" \ | ||
| 63 | -- | ||
| 64 | 2.34.1 | ||
| 65 | |||
diff --git a/meta/recipes-core/busybox/busybox/start-stop-false.patch b/meta/recipes-core/busybox/busybox/0003-start-stop-false.patch index 3aef68329c..dd5f5b8e03 100644 --- a/meta/recipes-core/busybox/busybox/start-stop-false.patch +++ b/meta/recipes-core/busybox/busybox/0003-start-stop-false.patch | |||
| @@ -9,11 +9,12 @@ diff --git a/testsuite/start-stop-daemon.tests b/testsuite/start-stop-daemon.tes | |||
| 9 | index 0757b1288..aa6e9cc41 100755 | 9 | index 0757b1288..aa6e9cc41 100755 |
| 10 | --- a/testsuite/start-stop-daemon.tests | 10 | --- a/testsuite/start-stop-daemon.tests |
| 11 | +++ b/testsuite/start-stop-daemon.tests | 11 | +++ b/testsuite/start-stop-daemon.tests |
| 12 | @@ -27,10 +27,18 @@ testing "start-stop-daemon without -x and -a" \ | 12 | @@ -50,11 +50,18 @@ testing "start-stop-daemon without -x and -a" \ |
| 13 | # but at least it checks that pathname to exec() is correct | 13 | # but at least it checks that pathname to exec() is correct |
| 14 | # | 14 | # |
| 15 | # NB: this fails if /bin/false is a busybox symlink: | 15 | # NB: this fails if /bin/false is a busybox symlink: |
| 16 | -# busybox looks at argv[0] and says "qwerty: applet not found" | 16 | -# busybox looks at argv[0] and says "qwerty: applet not found" |
| 17 | -test ! -L /bin/false && \ | ||
| 17 | -testing "start-stop-daemon with both -x and -a" \ | 18 | -testing "start-stop-daemon with both -x and -a" \ |
| 18 | - 'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \ | 19 | - 'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \ |
| 19 | - "1\n" \ | 20 | - "1\n" \ |
| @@ -21,15 +22,15 @@ index 0757b1288..aa6e9cc41 100755 | |||
| 21 | +# busybox looks at argv[0] and says "qwerty: applet not found", so | 22 | +# busybox looks at argv[0] and says "qwerty: applet not found", so |
| 22 | +# skip the test if false is busybox. | 23 | +# skip the test if false is busybox. |
| 23 | +case $(readlink /bin/false) in | 24 | +case $(readlink /bin/false) in |
| 24 | + *busybox*) | 25 | + *busybox*) |
| 25 | + echo "SKIPPED: start-stop-daemon with both -x and -a (need non-busybox false)" | 26 | + echo "SKIPPED: start-stop-daemon with both -x and -a (need non-busybox false)" |
| 26 | + ;; | 27 | + ;; |
| 27 | + *) | 28 | + *) |
| 28 | + testing "start-stop-daemon with both -x and -a" \ | 29 | + testing "start-stop-daemon with both -x and -a" \ |
| 29 | + 'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \ | 30 | + 'start-stop-daemon -S -x /bin/false -a qwerty false 2>&1; echo $?' \ |
| 30 | + "1\n" \ | 31 | + "1\n" \ |
| 31 | + "" "" | 32 | + "" "" |
| 32 | + ;; | 33 | + ;; |
| 33 | +esac | 34 | +esac |
| 34 | 35 | ||
| 35 | exit $FAILCOUNT | 36 | exit $FAILCOUNT |
diff --git a/meta/recipes-core/busybox/busybox/CVE-2021-42380.patch b/meta/recipes-core/busybox/busybox/CVE-2021-42380.patch deleted file mode 100644 index 3baef86415..0000000000 --- a/meta/recipes-core/busybox/busybox/CVE-2021-42380.patch +++ /dev/null | |||
| @@ -1,151 +0,0 @@ | |||
| 1 | From 5dcc443dba039b305a510c01883e9f34e42656ae Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Denys Vlasenko <vda.linux@googlemail.com> | ||
| 3 | Date: Fri, 26 May 2023 19:36:58 +0200 | ||
| 4 | Subject: [PATCH] awk: fix use-after-realloc (CVE-2021-42380), closes 15601 | ||
| 5 | |||
| 6 | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> | ||
| 7 | |||
| 8 | CVE: CVE-2021-42380 | ||
| 9 | Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=5dcc443dba039b305a510c01883e9f34e42656ae] | ||
| 10 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 11 | --- | ||
| 12 | editors/awk.c | 26 ++++++++++++++++----- | ||
| 13 | testsuite/awk.tests | 55 +++++++++++++++++++++++++++++++++++++++++++++ | ||
| 14 | 2 files changed, 75 insertions(+), 6 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/editors/awk.c b/editors/awk.c | ||
| 17 | index 728ee8685..2af823808 100644 | ||
| 18 | --- a/editors/awk.c | ||
| 19 | +++ b/editors/awk.c | ||
| 20 | @@ -555,7 +555,7 @@ struct globals { | ||
| 21 | const char *g_progname; | ||
| 22 | int g_lineno; | ||
| 23 | int nfields; | ||
| 24 | - int maxfields; /* used in fsrealloc() only */ | ||
| 25 | + unsigned maxfields; | ||
| 26 | var *Fields; | ||
| 27 | char *g_pos; | ||
| 28 | char g_saved_ch; | ||
| 29 | @@ -1931,9 +1931,9 @@ static void fsrealloc(int size) | ||
| 30 | { | ||
| 31 | int i, newsize; | ||
| 32 | |||
| 33 | - if (size >= maxfields) { | ||
| 34 | - /* Sanity cap, easier than catering for overflows */ | ||
| 35 | - if (size > 0xffffff) | ||
| 36 | + if ((unsigned)size >= maxfields) { | ||
| 37 | + /* Sanity cap, easier than catering for over/underflows */ | ||
| 38 | + if ((unsigned)size > 0xffffff) | ||
| 39 | bb_die_memory_exhausted(); | ||
| 40 | |||
| 41 | i = maxfields; | ||
| 42 | @@ -2891,6 +2891,7 @@ static var *evaluate(node *op, var *res) | ||
| 43 | uint32_t opinfo; | ||
| 44 | int opn; | ||
| 45 | node *op1; | ||
| 46 | + var *old_Fields_ptr; | ||
| 47 | |||
| 48 | opinfo = op->info; | ||
| 49 | opn = (opinfo & OPNMASK); | ||
| 50 | @@ -2899,10 +2900,16 @@ static var *evaluate(node *op, var *res) | ||
| 51 | debug_printf_eval("opinfo:%08x opn:%08x\n", opinfo, opn); | ||
| 52 | |||
| 53 | /* execute inevitable things */ | ||
| 54 | + old_Fields_ptr = NULL; | ||
| 55 | if (opinfo & OF_RES1) { | ||
| 56 | if ((opinfo & OF_REQUIRED) && !op1) | ||
| 57 | syntax_error(EMSG_TOO_FEW_ARGS); | ||
| 58 | L.v = evaluate(op1, TMPVAR0); | ||
| 59 | + /* Does L.v point to $n variable? */ | ||
| 60 | + if ((size_t)(L.v - Fields) < maxfields) { | ||
| 61 | + /* yes, remember where Fields[] is */ | ||
| 62 | + old_Fields_ptr = Fields; | ||
| 63 | + } | ||
| 64 | if (opinfo & OF_STR1) { | ||
| 65 | L.s = getvar_s(L.v); | ||
| 66 | debug_printf_eval("L.s:'%s'\n", L.s); | ||
| 67 | @@ -2921,8 +2928,15 @@ static var *evaluate(node *op, var *res) | ||
| 68 | */ | ||
| 69 | if (opinfo & OF_RES2) { | ||
| 70 | R.v = evaluate(op->r.n, TMPVAR1); | ||
| 71 | - //TODO: L.v may be invalid now, set L.v to NULL to catch bugs? | ||
| 72 | - //L.v = NULL; | ||
| 73 | + /* Seen in $5=$$5=$0: | ||
| 74 | + * Evaluation of R.v ($$5=$0 expression) | ||
| 75 | + * made L.v ($5) invalid. It's detected here. | ||
| 76 | + */ | ||
| 77 | + if (old_Fields_ptr) { | ||
| 78 | + //if (old_Fields_ptr != Fields) | ||
| 79 | + // debug_printf_eval("L.v moved\n"); | ||
| 80 | + L.v += Fields - old_Fields_ptr; | ||
| 81 | + } | ||
| 82 | if (opinfo & OF_STR2) { | ||
| 83 | R.s = getvar_s(R.v); | ||
| 84 | debug_printf_eval("R.s:'%s'\n", R.s); | ||
| 85 | diff --git a/testsuite/awk.tests b/testsuite/awk.tests | ||
| 86 | index bbf0fbff1..ddc51047b 100755 | ||
| 87 | --- a/testsuite/awk.tests | ||
| 88 | +++ b/testsuite/awk.tests | ||
| 89 | @@ -485,4 +485,59 @@ testing 'awk assign while test' \ | ||
| 90 | "" \ | ||
| 91 | "foo" | ||
| 92 | |||
| 93 | +# User-supplied bug (SEGV) example, was causing use-after-realloc | ||
| 94 | +testing 'awk assign while assign' \ | ||
| 95 | + "awk '\$5=\$\$5=\$0'; echo \$?" \ | ||
| 96 | + "\ | ||
| 97 | +─ process timing ────────────────────────────────────┬─ ─ process timing ────────────────────────────────────┬─ overall results ────┐ results ────┐ | ||
| 98 | +│ run time : │ run time : 0 days, 0 hrs, 0 min, 56 sec │ cycles done : 0 │ days, 0 hrs, 0 min, 56 sec │ cycles done : 0 │ | ||
| 99 | +│ last new find │ last new find : 0 days, 0 hrs, 0 min, 1 sec │ corpus count : 208 │ 0 days, 0 hrs, 0 min, 1 sec │ corpus count : 208 │ | ||
| 100 | +│last saved crash : │last saved crash : none seen yet │saved crashes : 0 │ seen yet │saved crashes : 0 │ | ||
| 101 | +│ last saved hang │ last saved hang : none seen yet │ saved hangs : 0 │ none seen yet │ saved hangs : 0 │ | ||
| 102 | +├─ cycle progress ─────────────────────┬─ ├─ cycle progress ─────────────────────┬─ map coverage┴──────────────────────┤ coverage┴──────────────────────┤ | ||
| 103 | +│ now processing : │ now processing : 184.1 (88.5%) │ map density : 0.30% / 0.52% │ (88.5%) │ map density : 0.30% / 0.52% │ │ now processing : 184.1 (88.5%) │ map density : 0.30% / 0.52% │ | ||
| 104 | +│ runs timed out │ runs timed out : 0 (0.00%) │ count coverage : 2.18 bits/tuple │ 0 (0.00%) │ count coverage : 2.18 bits/tuple │ | ||
| 105 | +├─ stage progress ─────────────────────┼─ ├─ stage progress ─────────────────────┼─ findings in depth ─────────────────┤ in depth ─────────────────┤ | ||
| 106 | +│ now trying : │ now trying : havoc │ favored items : 43 (20.67%) │ │ favored items : 43 (20.67%) │ | ||
| 107 | +│ stage execs : │ stage execs : 11.2k/131k (8.51%) │ new edges on : 52 (25.00%) │ (8.51%) │ new edges on │ stage execs : 11.2k/131k (8.51%) │ new edges on : 52 (25.00%) │ 52 (25.00%) │ | ||
| 108 | +│ total execs : │ total execs : 179k │ total crashes : 0 (0 saved) │ │ total crashes : 0 (0 saved) │ │ total execs : 179k │ total crashes : 0 (0 saved) │ | ||
| 109 | +│ exec speed : │ exec speed : 3143/sec │ total tmouts : 0 (0 saved) │ │ total tmouts : 0 (0 saved) │ │ exec speed : 3143/sec │ total tmouts : 0 (0 saved) │ | ||
| 110 | +├─ fuzzing strategy yields ├─ fuzzing strategy yields ────────────┴─────────────┬─ item geometry ───────┤ item geometry ───────┤ | ||
| 111 | +│ bit flips : │ bit flips : 11/648, 4/638, 5/618 │ levels : 4 │ 4/638, 5/618 │ levels : │ bit flips : 11/648, 4/638, 5/618 │ levels : 4 │ │ | ||
| 112 | +│ byte flips : │ byte flips : 0/81, 0/71, 0/52 │ pending : 199 │ 0/71, 0/52 │ pending : 199 │ | ||
| 113 | +│ arithmetics : 11/4494, │ arithmetics : 11/4494, 0/1153, 0/0 │ pend fav : 35 │ 0/0 │ pend fav : 35 │ | ||
| 114 | +│ known ints : 1/448, 0/1986, 0/2288 │ own finds : 207 │ known ints : │ known ints : 1/448, 0/1986, 0/2288 │ own finds : 207 │ 0/1986, 0/2288 │ own finds : 207 │ | ||
| 115 | +│ dictionary : 0/0, │ dictionary : 0/0, 0/0, 0/0, 0/0 │ imported : 0 │ 0/0, 0/0 │ imported : 0 │ | ||
| 116 | +│havoc/splice : 142/146k, 23/7616 │havoc/splice : 142/146k, 23/7616 │ stability : 100.00% │ stability : 100.00% │ | ||
| 117 | +│py/custom/rq : unused, unused, │py/custom/rq : unused, unused, unused, unused ├───────────────────────┘ unused ├───────────────────────┘ | ||
| 118 | +│ trim/eff : 57.02%/26, │ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%] │ [cpu000:100%] | ||
| 119 | +└────────────────────────────────────────────────────┘^C └────────────────────────────────────────────────────┘^C | ||
| 120 | +0 | ||
| 121 | +" \ | ||
| 122 | + "" \ | ||
| 123 | + "\ | ||
| 124 | +─ process timing ────────────────────────────────────┬─ overall results ────┐ | ||
| 125 | +│ run time : 0 days, 0 hrs, 0 min, 56 sec │ cycles done : 0 │ | ||
| 126 | +│ last new find : 0 days, 0 hrs, 0 min, 1 sec │ corpus count : 208 │ | ||
| 127 | +│last saved crash : none seen yet │saved crashes : 0 │ | ||
| 128 | +│ last saved hang : none seen yet │ saved hangs : 0 │ | ||
| 129 | +├─ cycle progress ─────────────────────┬─ map coverage┴──────────────────────┤ | ||
| 130 | +│ now processing : 184.1 (88.5%) │ map density : 0.30% / 0.52% │ | ||
| 131 | +│ runs timed out : 0 (0.00%) │ count coverage : 2.18 bits/tuple │ | ||
| 132 | +├─ stage progress ─────────────────────┼─ findings in depth ─────────────────┤ | ||
| 133 | +│ now trying : havoc │ favored items : 43 (20.67%) │ | ||
| 134 | +│ stage execs : 11.2k/131k (8.51%) │ new edges on : 52 (25.00%) │ | ||
| 135 | +│ total execs : 179k │ total crashes : 0 (0 saved) │ | ||
| 136 | +│ exec speed : 3143/sec │ total tmouts : 0 (0 saved) │ | ||
| 137 | +├─ fuzzing strategy yields ────────────┴─────────────┬─ item geometry ───────┤ | ||
| 138 | +│ bit flips : 11/648, 4/638, 5/618 │ levels : 4 │ | ||
| 139 | +│ byte flips : 0/81, 0/71, 0/52 │ pending : 199 │ | ||
| 140 | +│ arithmetics : 11/4494, 0/1153, 0/0 │ pend fav : 35 │ | ||
| 141 | +│ known ints : 1/448, 0/1986, 0/2288 │ own finds : 207 │ | ||
| 142 | +│ dictionary : 0/0, 0/0, 0/0, 0/0 │ imported : 0 │ | ||
| 143 | +│havoc/splice : 142/146k, 23/7616 │ stability : 100.00% │ | ||
| 144 | +│py/custom/rq : unused, unused, unused, unused ├───────────────────────┘ | ||
| 145 | +│ trim/eff : 57.02%/26, 0.00% │ [cpu000:100%] | ||
| 146 | +└────────────────────────────────────────────────────┘^C" | ||
| 147 | + | ||
| 148 | exit $FAILCOUNT | ||
| 149 | -- | ||
| 150 | 2.30.2 | ||
| 151 | |||
diff --git a/meta/recipes-core/busybox/busybox/CVE-2023-42363.patch b/meta/recipes-core/busybox/busybox/CVE-2023-42363.patch deleted file mode 100644 index 379f6f83b1..0000000000 --- a/meta/recipes-core/busybox/busybox/CVE-2023-42363.patch +++ /dev/null | |||
| @@ -1,67 +0,0 @@ | |||
| 1 | From fb08d43d44d1fea1f741fafb9aa7e1958a5f69aa Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Natanael Copa <ncopa@alpinelinux.org> | ||
| 3 | Date: Mon, 20 May 2024 17:55:28 +0200 | ||
| 4 | Subject: [PATCH] awk: fix use after free (CVE-2023-42363) | ||
| 5 | |||
| 6 | function old new delta | ||
| 7 | evaluate 3377 3385 +8 | ||
| 8 | |||
| 9 | Fixes https://bugs.busybox.net/show_bug.cgi?id=15865 | ||
| 10 | |||
| 11 | Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> | ||
| 12 | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> | ||
| 13 | |||
| 14 | CVE: CVE-2023-42363 | ||
| 15 | Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?id=fb08d43d44d1fea1f741fafb9aa7e1958a5f69aa] | ||
| 16 | Signed-off-by: Peter Marko <peter.marko@siemens.com> | ||
| 17 | --- | ||
| 18 | editors/awk.c | 21 +++++++++++++-------- | ||
| 19 | 1 file changed, 13 insertions(+), 8 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/editors/awk.c b/editors/awk.c | ||
| 22 | index 0981c6735..ff6d6350b 100644 | ||
| 23 | --- a/editors/awk.c | ||
| 24 | +++ b/editors/awk.c | ||
| 25 | @@ -2910,19 +2910,14 @@ static var *evaluate(node *op, var *res) | ||
| 26 | /* yes, remember where Fields[] is */ | ||
| 27 | old_Fields_ptr = Fields; | ||
| 28 | } | ||
| 29 | - if (opinfo & OF_STR1) { | ||
| 30 | - L.s = getvar_s(L.v); | ||
| 31 | - debug_printf_eval("L.s:'%s'\n", L.s); | ||
| 32 | - } | ||
| 33 | if (opinfo & OF_NUM1) { | ||
| 34 | L_d = getvar_i(L.v); | ||
| 35 | debug_printf_eval("L_d:%f\n", L_d); | ||
| 36 | } | ||
| 37 | } | ||
| 38 | - /* NB: Must get string/numeric values of L (done above) | ||
| 39 | - * _before_ evaluate()'ing R.v: if both L and R are $NNNs, | ||
| 40 | - * and right one is large, then L.v points to Fields[NNN1], | ||
| 41 | - * second evaluate() reallocates and moves (!) Fields[], | ||
| 42 | + /* NB: if both L and R are $NNNs, and right one is large, | ||
| 43 | + * then at this pint L.v points to Fields[NNN1], second | ||
| 44 | + * evaluate() below reallocates and moves (!) Fields[], | ||
| 45 | * R.v points to Fields[NNN2] but L.v now points to freed mem! | ||
| 46 | * (Seen trying to evaluate "$444 $44444") | ||
| 47 | */ | ||
| 48 | @@ -2942,6 +2937,16 @@ static var *evaluate(node *op, var *res) | ||
| 49 | debug_printf_eval("R.s:'%s'\n", R.s); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | + /* Get L.s _after_ R.v is evaluated: it may have realloc'd L.v | ||
| 53 | + * so we must get the string after "old_Fields_ptr" correction | ||
| 54 | + * above. Testcase: x = (v = "abc", gsub("b", "X", v)); | ||
| 55 | + */ | ||
| 56 | + if (opinfo & OF_RES1) { | ||
| 57 | + if (opinfo & OF_STR1) { | ||
| 58 | + L.s = getvar_s(L.v); | ||
| 59 | + debug_printf_eval("L.s:'%s'\n", L.s); | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | |||
| 63 | debug_printf_eval("switch(0x%x)\n", XC(opinfo & OPCLSMASK)); | ||
| 64 | switch (XC(opinfo & OPCLSMASK)) { | ||
| 65 | -- | ||
| 66 | 2.30.2 | ||
| 67 | |||
diff --git a/meta/recipes-core/busybox/busybox/defconfig b/meta/recipes-core/busybox/busybox/defconfig index 8e3b6e480c..d172ec46e9 100644 --- a/meta/recipes-core/busybox/busybox/defconfig +++ b/meta/recipes-core/busybox/busybox/defconfig | |||
| @@ -1,7 +1,6 @@ | |||
| 1 | # | 1 | # |
| 2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
| 3 | # Busybox version: 1.36.0 | 3 | # Busybox version: 1.37.0 |
| 4 | # Tue Jan 3 14:17:01 2023 | ||
| 5 | # | 4 | # |
| 6 | CONFIG_HAVE_DOT_CONFIG=y | 5 | CONFIG_HAVE_DOT_CONFIG=y |
| 7 | 6 | ||
| @@ -17,6 +16,7 @@ CONFIG_SHOW_USAGE=y | |||
| 17 | # CONFIG_FEATURE_VERBOSE_USAGE is not set | 16 | # CONFIG_FEATURE_VERBOSE_USAGE is not set |
| 18 | CONFIG_FEATURE_COMPRESS_USAGE=y | 17 | CONFIG_FEATURE_COMPRESS_USAGE=y |
| 19 | CONFIG_LFS=y | 18 | CONFIG_LFS=y |
| 19 | CONFIG_TIME64=y | ||
| 20 | # CONFIG_PAM is not set | 20 | # CONFIG_PAM is not set |
| 21 | CONFIG_FEATURE_DEVPTS=y | 21 | CONFIG_FEATURE_DEVPTS=y |
| 22 | CONFIG_FEATURE_UTMP=y | 22 | CONFIG_FEATURE_UTMP=y |
| @@ -466,6 +466,7 @@ CONFIG_FEATURE_FIND_NEWER=y | |||
| 466 | CONFIG_FEATURE_FIND_SAMEFILE=y | 466 | CONFIG_FEATURE_FIND_SAMEFILE=y |
| 467 | CONFIG_FEATURE_FIND_EXEC=y | 467 | CONFIG_FEATURE_FIND_EXEC=y |
| 468 | CONFIG_FEATURE_FIND_EXEC_PLUS=y | 468 | CONFIG_FEATURE_FIND_EXEC_PLUS=y |
| 469 | CONFIG_FEATURE_FIND_EXEC_OK=y | ||
| 469 | CONFIG_FEATURE_FIND_USER=y | 470 | CONFIG_FEATURE_FIND_USER=y |
| 470 | CONFIG_FEATURE_FIND_GROUP=y | 471 | CONFIG_FEATURE_FIND_GROUP=y |
| 471 | CONFIG_FEATURE_FIND_NOT=y | 472 | CONFIG_FEATURE_FIND_NOT=y |
| @@ -792,6 +793,7 @@ CONFIG_FEATURE_CROND_DIR="" | |||
| 792 | # CONFIG_FLASH_LOCK is not set | 793 | # CONFIG_FLASH_LOCK is not set |
| 793 | # CONFIG_FLASH_UNLOCK is not set | 794 | # CONFIG_FLASH_UNLOCK is not set |
| 794 | # CONFIG_FLASHCP is not set | 795 | # CONFIG_FLASHCP is not set |
| 796 | CONFIG_GETFATTR=y | ||
| 795 | # CONFIG_HDPARM is not set | 797 | # CONFIG_HDPARM is not set |
| 796 | # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set | 798 | # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set |
| 797 | # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set | 799 | # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set |
| @@ -929,6 +931,7 @@ CONFIG_IP=y | |||
| 929 | # CONFIG_IPNEIGH is not set | 931 | # CONFIG_IPNEIGH is not set |
| 930 | CONFIG_FEATURE_IP_ADDRESS=y | 932 | CONFIG_FEATURE_IP_ADDRESS=y |
| 931 | CONFIG_FEATURE_IP_LINK=y | 933 | CONFIG_FEATURE_IP_LINK=y |
| 934 | # CONFIG_FEATURE_IP_LINK_CAN is not set | ||
| 932 | CONFIG_FEATURE_IP_ROUTE=y | 935 | CONFIG_FEATURE_IP_ROUTE=y |
| 933 | CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2" | 936 | CONFIG_FEATURE_IP_ROUTE_DIR="/etc/iproute2" |
| 934 | CONFIG_FEATURE_IP_TUNNEL=y | 937 | CONFIG_FEATURE_IP_TUNNEL=y |
| @@ -1002,6 +1005,7 @@ CONFIG_FEATURE_WGET_OPENSSL=y | |||
| 1002 | # CONFIG_WHOIS is not set | 1005 | # CONFIG_WHOIS is not set |
| 1003 | # CONFIG_ZCIP is not set | 1006 | # CONFIG_ZCIP is not set |
| 1004 | CONFIG_UDHCPD=y | 1007 | CONFIG_UDHCPD=y |
| 1008 | CONFIG_FEATURE_UDHCPD_BOOTP=y | ||
| 1005 | # CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set | 1009 | # CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set |
| 1006 | # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set | 1010 | # CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set |
| 1007 | CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases" | 1011 | CONFIG_DHCPD_LEASES_FILE="/var/lib/misc/udhcpd.leases" |
diff --git a/meta/recipes-core/busybox/busybox/sha1sum.cfg b/meta/recipes-core/busybox/busybox/sha1sum.cfg index afd4da4ea1..151c447658 100644 --- a/meta/recipes-core/busybox/busybox/sha1sum.cfg +++ b/meta/recipes-core/busybox/busybox/sha1sum.cfg | |||
| @@ -1,2 +1,3 @@ | |||
| 1 | CONFIG_SHA1SUM=y | 1 | CONFIG_SHA1SUM=y |
| 2 | CONFIG_SHA1_SMALL=3 | 2 | CONFIG_SHA1_SMALL=3 |
| 3 | # CONFIG_SHA1_HWACCEL is not set | ||
diff --git a/meta/recipes-core/busybox/busybox/sha256sum.cfg b/meta/recipes-core/busybox/busybox/sha256sum.cfg index ce652ae4c6..aa0b0b0b98 100644 --- a/meta/recipes-core/busybox/busybox/sha256sum.cfg +++ b/meta/recipes-core/busybox/busybox/sha256sum.cfg | |||
| @@ -1 +1,2 @@ | |||
| 1 | CONFIG_SHA256SUM=y | 1 | CONFIG_SHA256SUM=y |
| 2 | # CONFIG_SHA256_HWACCEL is not set | ||
diff --git a/meta/recipes-core/busybox/busybox/sha_accel.cfg b/meta/recipes-core/busybox/busybox/sha_accel.cfg index 8900305a11..70038a8509 100644 --- a/meta/recipes-core/busybox/busybox/sha_accel.cfg +++ b/meta/recipes-core/busybox/busybox/sha_accel.cfg | |||
| @@ -1,2 +1,2 @@ | |||
| 1 | # CONFIG_SHA256_HWACCEL is not set | 1 | CONFIG_SHA1_HWACCEL=y |
| 2 | # CONFIG_SHA1_HWACCEL is not set | 2 | CONFIG_SHA256_HWACCEL=y |
diff --git a/meta/recipes-core/busybox/busybox_1.36.1.bb b/meta/recipes-core/busybox/busybox_1.37.0.bb index f7c3eff29e..c3131eb453 100644 --- a/meta/recipes-core/busybox/busybox_1.36.1.bb +++ b/meta/recipes-core/busybox/busybox_1.37.0.bb | |||
| @@ -48,17 +48,12 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ | |||
| 48 | file://0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch \ | 48 | file://0001-sysctl-ignore-EIO-of-stable_secret-below-proc-sys-ne.patch \ |
| 49 | file://0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch \ | 49 | file://0001-libbb-sockaddr2str-ensure-only-printable-characters-.patch \ |
| 50 | file://0002-nslookup-sanitize-all-printed-strings-with-printable.patch \ | 50 | file://0002-nslookup-sanitize-all-printed-strings-with-printable.patch \ |
| 51 | file://start-stop-false.patch \ | ||
| 52 | file://CVE-2021-42380.patch \ | ||
| 53 | file://0001-awk-fix-segfault-when-compiled-by-clang.patch \ | ||
| 54 | file://CVE-2023-42363.patch \ | ||
| 55 | file://busybox-1.36.1-no-cbq.patch \ | 51 | file://busybox-1.36.1-no-cbq.patch \ |
| 56 | file://0001-awk-fix-precedence-of-relative-to.patch \ | ||
| 57 | file://0002-awk-fix-ternary-operator-and-precedence-of.patch \ | ||
| 58 | file://0001-awk.c-fix-CVE-2023-42366-bug-15874.patch \ | ||
| 59 | file://0001-cut-Fix-s-flag-to-omit-blank-lines.patch \ | 52 | file://0001-cut-Fix-s-flag-to-omit-blank-lines.patch \ |
| 53 | file://0001-syslogd-fix-wrong-OPT_locallog-flag-detection.patch \ | ||
| 54 | file://0002-start-stop-daemon-fix-tests.patch \ | ||
| 55 | file://0003-start-stop-false.patch \ | ||
| 60 | " | 56 | " |
| 61 | SRC_URI:append:libc-musl = " file://musl.cfg " | 57 | SRC_URI:append:libc-musl = " file://musl.cfg" |
| 62 | # TODO http://lists.busybox.net/pipermail/busybox/2023-January/090078.html | 58 | SRC_URI:append:x86-64 = " file://sha_accel.cfg" |
| 63 | SRC_URI:append:x86 = " file://sha_accel.cfg" | 59 | SRC_URI[tarball.sha256sum] = "3311dff32e746499f4df0d5df04d7eb396382d7e108bb9250e7b519b837043a4" |
| 64 | SRC_URI[tarball.sha256sum] = "b8cc24c9574d809e7279c3be349795c5d5ceb6fdf19ca709f80cde50e47de314" | ||
diff --git a/meta/recipes-support/attr/attr.inc b/meta/recipes-support/attr/attr.inc index 75d616893a..6033934401 100644 --- a/meta/recipes-support/attr/attr.inc +++ b/meta/recipes-support/attr/attr.inc | |||
| @@ -26,8 +26,9 @@ PACKAGES =+ "lib${BPN}" | |||
| 26 | FILES:lib${BPN} = "${libdir}/lib*${SOLIBS} ${sysconfdir}" | 26 | FILES:lib${BPN} = "${libdir}/lib*${SOLIBS} ${sysconfdir}" |
| 27 | 27 | ||
| 28 | ALTERNATIVE_PRIORITY = "100" | 28 | ALTERNATIVE_PRIORITY = "100" |
| 29 | ALTERNATIVE:${PN} = "setfattr" | 29 | ALTERNATIVE:${PN} = "setfattr getfattr" |
| 30 | ALTERNATIVE_TARGET[setfattr] = "${bindir}/setfattr" | 30 | ALTERNATIVE_TARGET[setfattr] = "${bindir}/setfattr" |
| 31 | ALTERNATIVE_TARGET[getfattr] = "${bindir}/getfattr" | ||
| 31 | 32 | ||
| 32 | PTEST_BUILD_HOST_FILES = "builddefs" | 33 | PTEST_BUILD_HOST_FILES = "builddefs" |
| 33 | PTEST_BUILD_HOST_PATTERN = "^RPM" | 34 | PTEST_BUILD_HOST_PATTERN = "^RPM" |
