summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/nasm
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/nasm')
-rw-r--r--meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch42
-rw-r--r--meta/recipes-devtools/nasm/nasm/CVE-2022-44370.patch104
-rw-r--r--meta/recipes-devtools/nasm/nasm_2.15.05.bb (renamed from meta/recipes-devtools/nasm/nasm_2.15.03.bb)7
3 files changed, 129 insertions, 24 deletions
diff --git a/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch b/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch
index f788e0fd43..9f4c8dc0bd 100644
--- a/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch
+++ b/meta/recipes-devtools/nasm/nasm/0002-Add-debug-prefix-map-option.patch
@@ -1,4 +1,4 @@
1From bb4e42ad3a0cdd23a1d1797e6299c76b474867c0 Mon Sep 17 00:00:00 2001 1From 81d6519499dcfebe7d21e65e002a8885a4e8d852 Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com> 2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Tue, 19 Nov 2019 13:12:17 -0600 3Date: Tue, 19 Nov 2019 13:12:17 -0600
4Subject: [PATCH] Add --debug-prefix-map option 4Subject: [PATCH] Add --debug-prefix-map option
@@ -11,7 +11,7 @@ Upstream-Status: Submitted [https://bugzilla.nasm.us/show_bug.cgi?id=3392635]
11Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> 11Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
12 12
13--- 13---
14 asm/nasm.c | 26 +++++++++++++++++++++++++- 14 asm/nasm.c | 24 ++++++++++++++++++++++++
15 include/nasmlib.h | 9 +++++++++ 15 include/nasmlib.h | 9 +++++++++
16 nasm.txt | 4 ++++ 16 nasm.txt | 4 ++++
17 nasmlib/filename.c | 20 ++++++++++++++++++++ 17 nasmlib/filename.c | 20 ++++++++++++++++++++
@@ -23,34 +23,32 @@ Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
23 stdlib/strlcat.c | 2 +- 23 stdlib/strlcat.c | 2 +-
24 test/elfdebugprefix.asm | 6 ++++++ 24 test/elfdebugprefix.asm | 6 ++++++
25 test/performtest.pl | 12 ++++++++++-- 25 test/performtest.pl | 12 ++++++++++--
26 12 files changed, 83 insertions(+), 10 deletions(-) 26 12 files changed, 82 insertions(+), 9 deletions(-)
27 create mode 100644 test/elfdebugprefix.asm 27 create mode 100644 test/elfdebugprefix.asm
28 28
29diff --git a/asm/nasm.c b/asm/nasm.c 29diff --git a/asm/nasm.c b/asm/nasm.c
30index a0e1719..fc6c62e 100644 30index e5ae89a..7a7f8b4 100644
31--- a/asm/nasm.c 31--- a/asm/nasm.c
32+++ b/asm/nasm.c 32+++ b/asm/nasm.c
33@@ -938,7 +938,8 @@ enum text_options { 33@@ -939,6 +939,7 @@ enum text_options {
34 OPT_LIMIT,
35 OPT_KEEP_ALL, 34 OPT_KEEP_ALL,
36 OPT_NO_LINE, 35 OPT_NO_LINE,
37- OPT_DEBUG 36 OPT_DEBUG,
38+ OPT_DEBUG, 37+ OPT_DEBUG_PREFIX_MAP,
39+ OPT_DEBUG_PREFIX_MAP 38 OPT_REPRODUCIBLE
40 }; 39 };
41 enum need_arg { 40 enum need_arg {
42 ARG_NO, 41@@ -971,6 +972,7 @@ static const struct textargs textopts[] = {
43@@ -970,6 +971,7 @@ static const struct textargs textopts[] = {
44 {"keep-all", OPT_KEEP_ALL, ARG_NO, 0}, 42 {"keep-all", OPT_KEEP_ALL, ARG_NO, 0},
45 {"no-line", OPT_NO_LINE, ARG_NO, 0}, 43 {"no-line", OPT_NO_LINE, ARG_NO, 0},
46 {"debug", OPT_DEBUG, ARG_MAYBE, 0}, 44 {"debug", OPT_DEBUG, ARG_MAYBE, 0},
47+ {"debug-prefix-map", OPT_DEBUG_PREFIX_MAP, true, 0}, 45+ {"debug-prefix-map", OPT_DEBUG_PREFIX_MAP, true, 0},
46 {"reproducible", OPT_REPRODUCIBLE, ARG_NO, 0},
48 {NULL, OPT_BOGUS, ARG_NO, 0} 47 {NULL, OPT_BOGUS, ARG_NO, 0}
49 }; 48 };
50 49@@ -1337,6 +1339,26 @@ static bool process_arg(char *p, char *q, int pass)
51@@ -1332,6 +1334,26 @@ static bool process_arg(char *p, char *q, int pass) 50 case OPT_REPRODUCIBLE:
52 case OPT_DEBUG: 51 reproducible = true;
53 debug_nasm = param ? strtoul(param, NULL, 10) : debug_nasm+1;
54 break; 52 break;
55+ case OPT_DEBUG_PREFIX_MAP: { 53+ case OPT_DEBUG_PREFIX_MAP: {
56+ struct debug_prefix_list *d; 54+ struct debug_prefix_list *d;
@@ -75,7 +73,7 @@ index a0e1719..fc6c62e 100644
75 case OPT_HELP: 73 case OPT_HELP:
76 help(stdout); 74 help(stdout);
77 exit(0); 75 exit(0);
78@@ -2297,6 +2319,8 @@ static void help(FILE *out) 76@@ -2304,6 +2326,8 @@ static void help(FILE *out)
79 " -w-x disable warning x (also -Wno-x)\n" 77 " -w-x disable warning x (also -Wno-x)\n"
80 " -w[+-]error promote all warnings to errors (also -Werror)\n" 78 " -w[+-]error promote all warnings to errors (also -Werror)\n"
81 " -w[+-]error=x promote warning x to errors (also -Werror=x)\n" 79 " -w[+-]error=x promote warning x to errors (also -Werror=x)\n"
@@ -85,7 +83,7 @@ index a0e1719..fc6c62e 100644
85 83
86 fprintf(out, " %-20s %s\n", 84 fprintf(out, " %-20s %s\n",
87diff --git a/include/nasmlib.h b/include/nasmlib.h 85diff --git a/include/nasmlib.h b/include/nasmlib.h
88index e9bfbcc..98fc653 100644 86index 438178d..4c3e90d 100644
89--- a/include/nasmlib.h 87--- a/include/nasmlib.h
90+++ b/include/nasmlib.h 88+++ b/include/nasmlib.h
91@@ -250,10 +250,19 @@ int64_t readstrnum(char *str, int length, bool *warn); 89@@ -250,10 +250,19 @@ int64_t readstrnum(char *str, int length, bool *warn);
@@ -181,10 +179,10 @@ index 54b22f8..c4a412c 100644
181 179
182 static void as86_cleanup(void) 180 static void as86_cleanup(void)
183diff --git a/output/outcoff.c b/output/outcoff.c 181diff --git a/output/outcoff.c b/output/outcoff.c
184index bcd9ff3..15bfcf3 100644 182index 58fa024..14baf7b 100644
185--- a/output/outcoff.c 183--- a/output/outcoff.c
186+++ b/output/outcoff.c 184+++ b/output/outcoff.c
187@@ -1095,14 +1095,14 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value, 185@@ -1072,14 +1072,14 @@ static void coff_symbol(char *name, int32_t strpos, int32_t value,
188 186
189 static void coff_write_symbols(void) 187 static void coff_write_symbols(void)
190 { 188 {
@@ -215,7 +213,7 @@ index 61af020..1292958 100644
215 nsects = sectlen = 0; 213 nsects = sectlen = 0;
216 syms = saa_init((int32_t)sizeof(struct elf_symbol)); 214 syms = saa_init((int32_t)sizeof(struct elf_symbol));
217diff --git a/output/outieee.c b/output/outieee.c 215diff --git a/output/outieee.c b/output/outieee.c
218index 4cc0f0f..2468724 100644 216index 6d6d4b2..cdb8333 100644
219--- a/output/outieee.c 217--- a/output/outieee.c
220+++ b/output/outieee.c 218+++ b/output/outieee.c
221@@ -207,7 +207,7 @@ static void ieee_unqualified_name(char *, char *); 219@@ -207,7 +207,7 @@ static void ieee_unqualified_name(char *, char *);
@@ -228,10 +226,10 @@ index 4cc0f0f..2468724 100644
228 fpubhead = NULL; 226 fpubhead = NULL;
229 fpubtail = &fpubhead; 227 fpubtail = &fpubhead;
230diff --git a/output/outobj.c b/output/outobj.c 228diff --git a/output/outobj.c b/output/outobj.c
231index 0d4d311..d8dd6a0 100644 229index 56b43f9..fefea94 100644
232--- a/output/outobj.c 230--- a/output/outobj.c
233+++ b/output/outobj.c 231+++ b/output/outobj.c
234@@ -638,7 +638,7 @@ static enum directive_result obj_directive(enum directive, char *); 232@@ -644,7 +644,7 @@ static enum directive_result obj_directive(enum directive, char *);
235 233
236 static void obj_init(void) 234 static void obj_init(void)
237 { 235 {
diff --git a/meta/recipes-devtools/nasm/nasm/CVE-2022-44370.patch b/meta/recipes-devtools/nasm/nasm/CVE-2022-44370.patch
new file mode 100644
index 0000000000..1bd49c9fd9
--- /dev/null
+++ b/meta/recipes-devtools/nasm/nasm/CVE-2022-44370.patch
@@ -0,0 +1,104 @@
1From b37677f7e40276bd8f504584bcba2c092f1146a8 Mon Sep 17 00:00:00 2001
2From: "H. Peter Anvin" <hpa@zytor.com>
3Date: Mon, 7 Nov 2022 10:26:03 -0800
4Subject: [PATCH] quote_for_pmake: fix counter underrun resulting in segfault
5
6while (nbs--) { ... } ends with nbs == -1. Rather than a minimal fix,
7introduce mempset() to make these kinds of errors less likely in the
8future.
9
10Fixes: https://bugzilla.nasm.us/show_bug.cgi?id=3392815
11Reported-by: <13579and24680@gmail.com>
12Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13
14Upstream-Status: Backport
15CVE: CVE-2022-4437
16
17Reference to upstream patch:
18[https://github.com/netwide-assembler/nasm/commit/2d4e6952417ec6f08b6f135d2b5d0e19b7dae30d]
19
20Signed-off-by: Archana Polampalli <archana.polampalli@windriver.com>
21---
22 asm/nasm.c | 12 +++++-------
23 configure.ac | 1 +
24 include/compiler.h | 7 +++++++
25 3 files changed, 13 insertions(+), 7 deletions(-)
26
27diff --git a/asm/nasm.c b/asm/nasm.c
28index 7a7f8b4..675cff4 100644
29--- a/asm/nasm.c
30+++ b/asm/nasm.c
31@@ -1,6 +1,6 @@
32 /* ----------------------------------------------------------------------- *
33 *
34- * Copyright 1996-2020 The NASM Authors - All Rights Reserved
35+ * Copyright 1996-2022 The NASM Authors - All Rights Reserved
36 * See the file AUTHORS included with the NASM distribution for
37 * the specific copyright holders.
38 *
39@@ -814,8 +814,7 @@ static char *quote_for_pmake(const char *str)
40 }
41
42 /* Convert N backslashes at the end of filename to 2N backslashes */
43- if (nbs)
44- n += nbs;
45+ n += nbs;
46
47 os = q = nasm_malloc(n);
48
49@@ -824,10 +823,10 @@ static char *quote_for_pmake(const char *str)
50 switch (*p) {
51 case ' ':
52 case '\t':
53- while (nbs--)
54- *q++ = '\\';
55+ q = mempset(q, '\\', nbs);
56 *q++ = '\\';
57 *q++ = *p;
58+ nbs = 0;
59 break;
60 case '$':
61 *q++ = *p;
62@@ -849,9 +848,8 @@ static char *quote_for_pmake(const char *str)
63 break;
64 }
65 }
66- while (nbs--)
67- *q++ = '\\';
68
69+ q = mempset(q, '\\', nbs);
70 *q = '\0';
71
72 return os;
73diff --git a/configure.ac b/configure.ac
74index 39680b1..940ebe2 100644
75--- a/configure.ac
76+++ b/configure.ac
77@@ -199,6 +199,7 @@ AC_CHECK_FUNCS(strrchrnul)
78 AC_CHECK_FUNCS(iscntrl)
79 AC_CHECK_FUNCS(isascii)
80 AC_CHECK_FUNCS(mempcpy)
81+AC_CHECK_FUNCS(mempset)
82
83 AC_CHECK_FUNCS(getuid)
84 AC_CHECK_FUNCS(getgid)
85diff --git a/include/compiler.h b/include/compiler.h
86index db3d6d6..b64da6a 100644
87--- a/include/compiler.h
88+++ b/include/compiler.h
89@@ -256,6 +256,13 @@ static inline void *mempcpy(void *dst, const void *src, size_t n)
90 }
91 #endif
92
93+#ifndef HAVE_MEMPSET
94+static inline void *mempset(void *dst, int c, size_t n)
95+{
96+ return (char *)memset(dst, c, n) + n;
97+}
98+#endif
99+
100 /*
101 * Hack to support external-linkage inline functions
102 */
103--
1042.40.0
diff --git a/meta/recipes-devtools/nasm/nasm_2.15.03.bb b/meta/recipes-devtools/nasm/nasm_2.15.05.bb
index 5c4e28de06..c5638debdd 100644
--- a/meta/recipes-devtools/nasm/nasm_2.15.03.bb
+++ b/meta/recipes-devtools/nasm/nasm_2.15.05.bb
@@ -1,18 +1,21 @@
1SUMMARY = "General-purpose x86 assembler" 1SUMMARY = "General-purpose x86 assembler"
2SECTION = "devel" 2SECTION = "devel"
3HOMEPAGE = "http://www.nasm.us/"
4DESCRIPTION = "The Netwide Assembler (NASM) is an assembler and disassembler for the Intel x86 architecture."
3LICENSE = "BSD-2-Clause" 5LICENSE = "BSD-2-Clause"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=90904486f8fbf1861cf42752e1a39efe" 6LIC_FILES_CHKSUM = "file://LICENSE;md5=90904486f8fbf1861cf42752e1a39efe"
5 7
6SRC_URI = "http://www.nasm.us/pub/nasm/releasebuilds/${PV}/nasm-${PV}.tar.bz2 \ 8SRC_URI = "http://www.nasm.us/pub/nasm/releasebuilds/${PV}/nasm-${PV}.tar.bz2 \
7 file://0001-stdlib-Add-strlcat.patch \ 9 file://0001-stdlib-Add-strlcat.patch \
8 file://0002-Add-debug-prefix-map-option.patch \ 10 file://0002-Add-debug-prefix-map-option.patch \
11 file://CVE-2022-44370.patch \
9 " 12 "
10 13
11SRC_URI[sha256sum] = "04e7343d9bf112bffa9fda86f6c7c8b120c2ccd700b882e2db9f57484b1bd778" 14SRC_URI[sha256sum] = "3c4b8339e5ab54b1bcb2316101f8985a5da50a3f9e504d43fa6f35668bee2fd0"
12 15
13EXTRA_AUTORECONF_append = " -I autoconf/m4" 16EXTRA_AUTORECONF_append = " -I autoconf/m4"
14 17
15inherit autotools 18inherit autotools-brokensep
16 19
17BBCLASSEXTEND = "native" 20BBCLASSEXTEND = "native"
18 21