diff options
Diffstat (limited to 'meta/recipes-devtools')
66 files changed, 2574 insertions, 37 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.35.inc b/meta/recipes-devtools/binutils/binutils-2.35.1.inc index bc9107b084..6290d5b191 100644 --- a/meta/recipes-devtools/binutils/binutils-2.35.inc +++ b/meta/recipes-devtools/binutils/binutils-2.35.1.inc | |||
@@ -16,15 +16,15 @@ def binutils_branch_version(d): | |||
16 | 16 | ||
17 | # When upgrading to 2.35, please make sure there is no trailing .0, so | 17 | # When upgrading to 2.35, please make sure there is no trailing .0, so |
18 | # that upstream version check can work correctly. | 18 | # that upstream version check can work correctly. |
19 | PV = "2.35" | 19 | PV = "2.35.1" |
20 | CVE_VERSION = "2.35" | 20 | CVE_VERSION = "2.35.1" |
21 | BINUPV = "${@binutils_branch_version(d)}" | 21 | BINUPV = "${@binutils_branch_version(d)}" |
22 | #BRANCH = "binutils-${BINUPV}-branch" | 22 | #BRANCH = "binutils-${BINUPV}-branch" |
23 | BRANCH ?= "binutils-2_35-branch" | 23 | BRANCH ?= "binutils-2_35-branch" |
24 | 24 | ||
25 | UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)" | 25 | UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)" |
26 | 26 | ||
27 | SRCREV ?= "89a9065674a14a8bd94bb326b27d19a2f3583efb" | 27 | SRCREV ?= "7e46a74aa3713c563940960e361e08defda019c2" |
28 | BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${BRANCH};protocol=git" | 28 | BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=${BRANCH};protocol=git" |
29 | SRC_URI = "\ | 29 | SRC_URI = "\ |
30 | ${BINUTILS_GIT_URI} \ | 30 | ${BINUTILS_GIT_URI} \ |
@@ -42,5 +42,8 @@ SRC_URI = "\ | |||
42 | file://0015-sync-with-OE-libtool-changes.patch \ | 42 | file://0015-sync-with-OE-libtool-changes.patch \ |
43 | file://0016-Check-for-clang-before-checking-gcc-version.patch \ | 43 | file://0016-Check-for-clang-before-checking-gcc-version.patch \ |
44 | file://0017-gas-improve-reproducibility-for-stabs-debugging-data.patch \ | 44 | file://0017-gas-improve-reproducibility-for-stabs-debugging-data.patch \ |
45 | file://0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch \ | ||
46 | file://CVE-2020-35448.patch \ | ||
47 | file://0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch \ | ||
45 | " | 48 | " |
46 | S = "${WORKDIR}/git" | 49 | S = "${WORKDIR}/git" |
diff --git a/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.bb b/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.1.bb index 5dbaa03017..5dbaa03017 100644 --- a/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.bb +++ b/meta/recipes-devtools/binutils/binutils-cross-canadian_2.35.1.bb | |||
diff --git a/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.bb b/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.1.bb index 07a8e7c417..07a8e7c417 100644 --- a/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.bb +++ b/meta/recipes-devtools/binutils/binutils-cross-testsuite_2.35.1.bb | |||
diff --git a/meta/recipes-devtools/binutils/binutils-cross_2.35.bb b/meta/recipes-devtools/binutils/binutils-cross_2.35.1.bb index fbd1f7d25a..fbd1f7d25a 100644 --- a/meta/recipes-devtools/binutils/binutils-cross_2.35.bb +++ b/meta/recipes-devtools/binutils/binutils-cross_2.35.1.bb | |||
diff --git a/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.bb b/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.1.bb index 37f4d6d2e9..37f4d6d2e9 100644 --- a/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.bb +++ b/meta/recipes-devtools/binutils/binutils-crosssdk_2.35.1.bb | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch b/meta/recipes-devtools/binutils/binutils/0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch new file mode 100644 index 0000000000..f46ddab415 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0001-aarch64-Return-an-error-on-conditional-branch-to-an-.patch | |||
@@ -0,0 +1,135 @@ | |||
1 | From c7cd291722779c9d4703ed0010388fe394c644c8 Mon Sep 17 00:00:00 2001 | ||
2 | From: Siddhesh Poyarekar <siddesh.poyarekar@arm.com> | ||
3 | Date: Tue, 1 Sep 2020 14:25:52 +0530 | ||
4 | Subject: [PATCH] aarch64: Return an error on conditional branch to an undefined symbol | ||
5 | |||
6 | The fix in 7e05773767820b441b23a16628b55c98cb1aef46 introduced a PLT | ||
7 | for conditional jumps when the target symbol is undefined. This is | ||
8 | incorrect because conditional branch relocations are not allowed to | ||
9 | clobber IP0/IP1 and hence, should not result in a dynamic relocation. | ||
10 | |||
11 | Revert that change and in its place, issue an error when the target | ||
12 | symbol is undefined. | ||
13 | |||
14 | bfd/ | ||
15 | |||
16 | 2020-09-10 Siddhesh Poyarekar <siddesh.poyarekar@arm.com> | ||
17 | |||
18 | * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Revert | ||
19 | changes in 7e05773767820b441b23a16628b55c98cb1aef46. Set | ||
20 | error for undefined symbol in BFD_RELOC_AARCH64_BRANCH19 and | ||
21 | BFD_RELOC_AARCH64_TSTBR14 relocations. | ||
22 | |||
23 | ld/ | ||
24 | |||
25 | 2020-09-10 Siddhesh Poyarekar <siddesh.poyarekar@arm.com> | ||
26 | |||
27 | * testsuite/ld-aarch64/emit-relocs-560.d: Expect error instead | ||
28 | of valid output. | ||
29 | --- | ||
30 | Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=c7cd291722779c9d4703ed0010388fe394c644c8] | ||
31 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
32 | |||
33 | bfd/ChangeLog | 7 +++++ | ||
34 | bfd/elfnn-aarch64.c | 37 ++++++++++++----------- | ||
35 | ld/ChangeLog | 5 +++ | ||
36 | ld/testsuite/ld-aarch64/emit-relocs-560.d | 7 +---- | ||
37 | 4 files changed, 32 insertions(+), 24 deletions(-) | ||
38 | |||
39 | diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c | ||
40 | index 5b4c189b593..a9924e7ec56 100644 | ||
41 | --- a/bfd/elfnn-aarch64.c | ||
42 | +++ b/bfd/elfnn-aarch64.c | ||
43 | @@ -5447,7 +5447,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, | ||
44 | bfd_vma orig_value = value; | ||
45 | bfd_boolean resolved_to_zero; | ||
46 | bfd_boolean abs_symbol_p; | ||
47 | - bfd_boolean via_plt_p; | ||
48 | |||
49 | globals = elf_aarch64_hash_table (info); | ||
50 | |||
51 | @@ -5469,8 +5468,6 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, | ||
52 | : bfd_is_und_section (sym_sec)); | ||
53 | abs_symbol_p = h != NULL && bfd_is_abs_symbol (&h->root); | ||
54 | |||
55 | - via_plt_p = (globals->root.splt != NULL && h != NULL | ||
56 | - && h->plt.offset != (bfd_vma) - 1); | ||
57 | |||
58 | /* Since STT_GNU_IFUNC symbol must go through PLT, we handle | ||
59 | it here if it is defined in a non-shared object. */ | ||
60 | @@ -5806,23 +5803,12 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, | ||
61 | value += signed_addend; | ||
62 | break; | ||
63 | |||
64 | - case BFD_RELOC_AARCH64_BRANCH19: | ||
65 | - case BFD_RELOC_AARCH64_TSTBR14: | ||
66 | - /* A conditional branch to an undefined weak symbol is converted to a | ||
67 | - branch to itself. */ | ||
68 | - if (weak_undef_p && !via_plt_p) | ||
69 | - { | ||
70 | - value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type, | ||
71 | - place, value, | ||
72 | - signed_addend, | ||
73 | - weak_undef_p); | ||
74 | - break; | ||
75 | - } | ||
76 | - /* Fall through. */ | ||
77 | case BFD_RELOC_AARCH64_CALL26: | ||
78 | case BFD_RELOC_AARCH64_JUMP26: | ||
79 | { | ||
80 | asection *splt = globals->root.splt; | ||
81 | + bfd_boolean via_plt_p = | ||
82 | + splt != NULL && h != NULL && h->plt.offset != (bfd_vma) - 1; | ||
83 | |||
84 | /* A call to an undefined weak symbol is converted to a jump to | ||
85 | the next instruction unless a PLT entry will be created. | ||
86 | @@ -5903,6 +5889,23 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto, | ||
87 | bfd_set_error (bfd_error_bad_value); | ||
88 | return bfd_reloc_notsupported; | ||
89 | } | ||
90 | + value = _bfd_aarch64_elf_resolve_relocation (input_bfd, bfd_r_type, | ||
91 | + place, value, | ||
92 | + signed_addend, | ||
93 | + weak_undef_p); | ||
94 | + break; | ||
95 | + | ||
96 | + case BFD_RELOC_AARCH64_BRANCH19: | ||
97 | + case BFD_RELOC_AARCH64_TSTBR14: | ||
98 | + if (h && h->root.type == bfd_link_hash_undefined) | ||
99 | + { | ||
100 | + _bfd_error_handler | ||
101 | + /* xgettext:c-format */ | ||
102 | + (_("%pB: conditional branch to undefined symbol `%s' " | ||
103 | + "not allowed"), input_bfd, h->root.root.string); | ||
104 | + bfd_set_error (bfd_error_bad_value); | ||
105 | + return bfd_reloc_notsupported; | ||
106 | + } | ||
107 | /* Fall through. */ | ||
108 | |||
109 | case BFD_RELOC_AARCH64_16: | ||
110 | @@ -7968,8 +7971,6 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info, | ||
111 | break; | ||
112 | } | ||
113 | |||
114 | - case BFD_RELOC_AARCH64_BRANCH19: | ||
115 | - case BFD_RELOC_AARCH64_TSTBR14: | ||
116 | case BFD_RELOC_AARCH64_CALL26: | ||
117 | case BFD_RELOC_AARCH64_JUMP26: | ||
118 | /* If this is a local symbol then we resolve it | ||
119 | diff --git a/ld/testsuite/ld-aarch64/emit-relocs-560.d b/ld/testsuite/ld-aarch64/emit-relocs-560.d | ||
120 | index 153532457b4..8751b743bd4 100644 | ||
121 | --- a/ld/testsuite/ld-aarch64/emit-relocs-560.d | ||
122 | +++ b/ld/testsuite/ld-aarch64/emit-relocs-560.d | ||
123 | @@ -1,8 +1,3 @@ | ||
124 | #source: emit-relocs-560.s | ||
125 | #ld: -shared | ||
126 | -#readelf: -r | ||
127 | - | ||
128 | -Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 2 entries: | ||
129 | - Offset Info Type Sym. Value Sym. Name \+ Addend | ||
130 | -[0-9a-f]+ 000100000402 R_AARCH64_JUMP_SL 0000000000000000 baz \+ 0 | ||
131 | -[0-9a-f]+ 000200000402 R_AARCH64_JUMP_SL 0000000000000000 bar \+ 0 | ||
132 | +#error: .*: conditional branch to undefined symbol `bar' not allowed | ||
133 | -- | ||
134 | 2.29.2 | ||
135 | |||
diff --git a/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch b/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch new file mode 100644 index 0000000000..f46415f440 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/0001-gold-ensure-file_counts_lock-is-initialized-before-u.patch | |||
@@ -0,0 +1,41 @@ | |||
1 | From de24fc96bf24fca470a9ca13176ad9ad9cc4d5a9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Nick Gasson <nick.gasson@arm.com> | ||
3 | Date: Mon, 2 Nov 2020 12:02:05 +0800 | ||
4 | Subject: [PATCH] gold: ensure file_counts_lock is initialized before using | ||
5 | |||
6 | Since upgrading to binutils 2.35 I've been experiencing random memory | ||
7 | corruption related crashes with ld.gold --threads. It's caused by | ||
8 | multiple threads concurrently pushing elements onto the shared | ||
9 | std::vector in File_read::record_file_read(). This vector is supposed to | ||
10 | be protected by file_counts_lock, but that is initialized lazily and | ||
11 | might be NULL when File_read::open() is called, in which case | ||
12 | Hold_optional_lock silently skips locking it. | ||
13 | |||
14 | Fix by calling the initialize() method before attempting to acquire the | ||
15 | lock, the same as other places that use file_counts_lock. | ||
16 | |||
17 | PR 26827 | ||
18 | * fileread.cc (File_read::open): Ensure file_counts_lock is | ||
19 | initialized. | ||
20 | * testsuite/Makefile.am (check_PROGRAMS): Add a test that passes | ||
21 | -Wl,--threads. | ||
22 | * testsuite/Makefile.in: Regenerate. | ||
23 | |||
24 | Upstream-Status: Backport [af61e84fd2d from 2.36.0] | ||
25 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> | ||
26 | --- | ||
27 | gold/fileread.cc | 1 + | ||
28 | 1 file changed, 1 insertion(+) | ||
29 | |||
30 | diff --git a/gold/fileread.cc b/gold/fileread.cc | ||
31 | index f5ca719360d..0b5228e2afd 100644 | ||
32 | --- a/gold/fileread.cc | ||
33 | +++ b/gold/fileread.cc | ||
34 | @@ -212,6 +212,7 @@ File_read::open(const Task* task, const std::string& name) | ||
35 | gold_debug(DEBUG_FILES, "Attempt to open %s succeeded", | ||
36 | this->name_.c_str()); | ||
37 | this->token_.add_writer(task); | ||
38 | + file_counts_initialize_lock.initialize(); | ||
39 | Hold_optional_lock hl(file_counts_lock); | ||
40 | record_file_read(this->name_); | ||
41 | } | ||
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2020-35448.patch b/meta/recipes-devtools/binutils/binutils/CVE-2020-35448.patch new file mode 100644 index 0000000000..3bc64776e5 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2020-35448.patch | |||
@@ -0,0 +1,85 @@ | |||
1 | From 6caa41daeb7aa17c400b7300fb78d207cf064d70 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alan Modra <amodra@gmail.com> | ||
3 | Date: Fri, 4 Sep 2020 19:19:18 +0930 | ||
4 | Subject: [PATCH] PR26574, heap buffer overflow in | ||
5 | _bfd_elf_slurp_secondary_reloc_section | ||
6 | |||
7 | A horribly fuzzed object with section headers inside the ELF header. | ||
8 | Disallow that, and crazy reloc sizes. | ||
9 | |||
10 | PR 26574 | ||
11 | * elfcode.h (elf_object_p): Sanity check section header offset. | ||
12 | * elf.c (_bfd_elf_slurp_secondary_reloc_section): Sanity check | ||
13 | sh_entsize. | ||
14 | |||
15 | Upstream-Status: Backport | ||
16 | CVE: CVE-2020-35448 | ||
17 | |||
18 | Reference to upstream patch: | ||
19 | https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git; | ||
20 | h=8642dafaef21aa6747cec01df1977e9c52eb4679 | ||
21 | |||
22 | Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com> | ||
23 | --- | ||
24 | bfd/elf.c | 4 +++- | ||
25 | bfd/elfcode.h | 8 ++++---- | ||
26 | 2 files changed, 7 insertions(+), 5 deletions(-) | ||
27 | |||
28 | diff --git a/bfd/elf.c b/bfd/elf.c | ||
29 | index fe375e7346..9f29166399 100644 | ||
30 | --- a/bfd/elf.c | ||
31 | +++ b/bfd/elf.c | ||
32 | @@ -12527,7 +12527,9 @@ _bfd_elf_slurp_secondary_reloc_section (bfd * abfd, | ||
33 | Elf_Internal_Shdr * hdr = & elf_section_data (relsec)->this_hdr; | ||
34 | |||
35 | if (hdr->sh_type == SHT_SECONDARY_RELOC | ||
36 | - && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx) | ||
37 | + && hdr->sh_info == (unsigned) elf_section_data (sec)->this_idx | ||
38 | + && (hdr->sh_entsize == ebd->s->sizeof_rel | ||
39 | + || hdr->sh_entsize == ebd->s->sizeof_rela)) | ||
40 | { | ||
41 | bfd_byte * native_relocs; | ||
42 | bfd_byte * native_reloc; | ||
43 | diff --git a/bfd/elfcode.h b/bfd/elfcode.h | ||
44 | index f4a7829f27..54ef890637 100644 | ||
45 | --- a/bfd/elfcode.h | ||
46 | +++ b/bfd/elfcode.h | ||
47 | @@ -568,7 +568,7 @@ elf_object_p (bfd *abfd) | ||
48 | |||
49 | /* If this is a relocatable file and there is no section header | ||
50 | table, then we're hosed. */ | ||
51 | - if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_type == ET_REL) | ||
52 | + if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_type == ET_REL) | ||
53 | goto got_wrong_format_error; | ||
54 | |||
55 | /* As a simple sanity check, verify that what BFD thinks is the | ||
56 | @@ -578,7 +578,7 @@ elf_object_p (bfd *abfd) | ||
57 | goto got_wrong_format_error; | ||
58 | |||
59 | /* Further sanity check. */ | ||
60 | - if (i_ehdrp->e_shoff == 0 && i_ehdrp->e_shnum != 0) | ||
61 | + if (i_ehdrp->e_shoff < sizeof (x_ehdr) && i_ehdrp->e_shnum != 0) | ||
62 | goto got_wrong_format_error; | ||
63 | |||
64 | ebd = get_elf_backend_data (abfd); | ||
65 | @@ -615,7 +615,7 @@ elf_object_p (bfd *abfd) | ||
66 | && ebd->elf_osabi != ELFOSABI_NONE) | ||
67 | goto got_wrong_format_error; | ||
68 | |||
69 | - if (i_ehdrp->e_shoff != 0) | ||
70 | + if (i_ehdrp->e_shoff >= sizeof (x_ehdr)) | ||
71 | { | ||
72 | file_ptr where = (file_ptr) i_ehdrp->e_shoff; | ||
73 | |||
74 | @@ -807,7 +807,7 @@ elf_object_p (bfd *abfd) | ||
75 | } | ||
76 | } | ||
77 | |||
78 | - if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff != 0) | ||
79 | + if (i_ehdrp->e_shstrndx != 0 && i_ehdrp->e_shoff >= sizeof (x_ehdr)) | ||
80 | { | ||
81 | unsigned int num_sec; | ||
82 | |||
83 | -- | ||
84 | 2.29.2 | ||
85 | |||
diff --git a/meta/recipes-devtools/binutils/binutils_2.35.bb b/meta/recipes-devtools/binutils/binutils_2.35.1.bb index 2e645e1ed8..2e645e1ed8 100644 --- a/meta/recipes-devtools/binutils/binutils_2.35.bb +++ b/meta/recipes-devtools/binutils/binutils_2.35.1.bb | |||
diff --git a/meta/recipes-devtools/bison/bison/0001-Use-mapped-file-name-for-symbols.patch b/meta/recipes-devtools/bison/bison/0001-Use-mapped-file-name-for-symbols.patch new file mode 100644 index 0000000000..568ee4df19 --- /dev/null +++ b/meta/recipes-devtools/bison/bison/0001-Use-mapped-file-name-for-symbols.patch | |||
@@ -0,0 +1,62 @@ | |||
1 | From 2a3db4e3b8d33bad5577c2fcfe124ee7a202ef4f Mon Sep 17 00:00:00 2001 | ||
2 | From: Joshua Watt <JPEWhacker@gmail.com> | ||
3 | Date: Mon, 15 Feb 2021 20:39:57 -0600 | ||
4 | Subject: [PATCH] Use mapped file name for symbols | ||
5 | |||
6 | Applies the file name mapping before exporting it as a symbol. This | ||
7 | allows the symbols to correctly respect the --file-prefix-map command | ||
8 | line option. | ||
9 | |||
10 | Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> | ||
11 | Upstream-Status: Submitted [https://lists.gnu.org/archive/html/bison-patches/2021-02/msg00014.html] | ||
12 | --- | ||
13 | src/muscle-tab.c | 4 +++- | ||
14 | src/output.c | 8 ++++++-- | ||
15 | 2 files changed, 9 insertions(+), 3 deletions(-) | ||
16 | |||
17 | diff --git a/src/muscle-tab.c b/src/muscle-tab.c | ||
18 | index b610d0b8..3e7657ca 100644 | ||
19 | --- a/src/muscle-tab.c | ||
20 | +++ b/src/muscle-tab.c | ||
21 | @@ -204,8 +204,10 @@ static void | ||
22 | muscle_syncline_grow (char const *key, location loc) | ||
23 | { | ||
24 | obstack_printf (&muscle_obstack, "]b4_syncline(%d, ", loc.start.line); | ||
25 | + char *f = map_file_name (loc.start.file); | ||
26 | obstack_quote (&muscle_obstack, | ||
27 | - quotearg_style (c_quoting_style, loc.start.file)); | ||
28 | + quotearg_style (c_quoting_style, f)); | ||
29 | + free (f); | ||
30 | obstack_sgrow (&muscle_obstack, ")dnl\n["); | ||
31 | char const *extension = obstack_finish0 (&muscle_obstack); | ||
32 | muscle_grow (key, extension, "", ""); | ||
33 | diff --git a/src/output.c b/src/output.c | ||
34 | index 391d8e65..34dbc671 100644 | ||
35 | --- a/src/output.c | ||
36 | +++ b/src/output.c | ||
37 | @@ -531,7 +531,9 @@ user_actions_output (FILE *out) | ||
38 | { | ||
39 | fprintf (out, "b4_syncline(%d, ", | ||
40 | rules[r].action_loc.start.line); | ||
41 | - string_output (out, rules[r].action_loc.start.file); | ||
42 | + char *f = map_file_name (rules[r].action_loc.start.file); | ||
43 | + string_output (out, f); | ||
44 | + free(f); | ||
45 | fprintf (out, ")dnl\n"); | ||
46 | } | ||
47 | fprintf (out, "[%*s%s]],\n[[", | ||
48 | @@ -629,8 +631,10 @@ prepare_symbol_definitions (void) | ||
49 | |||
50 | if (p->code) | ||
51 | { | ||
52 | + char *f = map_file_name (p->location.start.file); | ||
53 | SET_KEY2 (pname, "file"); | ||
54 | - MUSCLE_INSERT_C_STRING (key, p->location.start.file); | ||
55 | + MUSCLE_INSERT_C_STRING (key, f); | ||
56 | + free (f); | ||
57 | |||
58 | SET_KEY2 (pname, "line"); | ||
59 | MUSCLE_INSERT_INT (key, p->location.start.line); | ||
60 | -- | ||
61 | 2.30.0 | ||
62 | |||
diff --git a/meta/recipes-devtools/bison/bison_3.7.2.bb b/meta/recipes-devtools/bison/bison_3.7.2.bb index ace4ea5c3f..6fd9d288e0 100644 --- a/meta/recipes-devtools/bison/bison_3.7.2.bb +++ b/meta/recipes-devtools/bison/bison_3.7.2.bb | |||
@@ -11,6 +11,7 @@ DEPENDS = "bison-native flex-native" | |||
11 | 11 | ||
12 | SRC_URI = "${GNU_MIRROR}/bison/bison-${PV}.tar.xz \ | 12 | SRC_URI = "${GNU_MIRROR}/bison/bison-${PV}.tar.xz \ |
13 | file://add-with-bisonlocaledir.patch \ | 13 | file://add-with-bisonlocaledir.patch \ |
14 | file://0001-Use-mapped-file-name-for-symbols.patch \ | ||
14 | " | 15 | " |
15 | SRC_URI[sha256sum] = "7948d193104d979c0fb0294a1854c73c89d72ae41acfc081826142578a78a91b" | 16 | SRC_URI[sha256sum] = "7948d193104d979c0fb0294a1854c73c89d72ae41acfc081826142578a78a91b" |
16 | 17 | ||
diff --git a/meta/recipes-devtools/diffstat/diffstat_1.63.bb b/meta/recipes-devtools/diffstat/diffstat_1.63.bb index 61b2ea5dc2..863f924b22 100644 --- a/meta/recipes-devtools/diffstat/diffstat_1.63.bb +++ b/meta/recipes-devtools/diffstat/diffstat_1.63.bb | |||
@@ -5,7 +5,7 @@ reviewing large, complex patch files." | |||
5 | HOMEPAGE = "http://invisible-island.net/diffstat/" | 5 | HOMEPAGE = "http://invisible-island.net/diffstat/" |
6 | SECTION = "devel" | 6 | SECTION = "devel" |
7 | LICENSE = "MIT" | 7 | LICENSE = "MIT" |
8 | LIC_FILES_CHKSUM = "file://install-sh;endline=42;md5=b3549726c1022bee09c174c72a0ca4a5" | 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=a3d0bb117493e804b0c1a868ddf23321" |
9 | 9 | ||
10 | SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \ | 10 | SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \ |
11 | file://run-ptest \ | 11 | file://run-ptest \ |
@@ -16,8 +16,6 @@ SRC_URI = "http://invisible-mirror.net/archives/${BPN}/${BP}.tgz \ | |||
16 | SRC_URI[md5sum] = "b9272ec8af6257103261ec3622692991" | 16 | SRC_URI[md5sum] = "b9272ec8af6257103261ec3622692991" |
17 | SRC_URI[sha256sum] = "7eddd53401b99b90bac3f7ebf23dd583d7d99c6106e67a4f1161b7a20110dc6f" | 17 | SRC_URI[sha256sum] = "7eddd53401b99b90bac3f7ebf23dd583d7d99c6106e67a4f1161b7a20110dc6f" |
18 | 18 | ||
19 | S = "${WORKDIR}/diffstat-${PV}" | ||
20 | |||
21 | inherit autotools gettext ptest | 19 | inherit autotools gettext ptest |
22 | 20 | ||
23 | EXTRA_AUTORECONF += "--exclude=aclocal" | 21 | EXTRA_AUTORECONF += "--exclude=aclocal" |
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb index 15054768dd..e6a4bd1f8c 100644 --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.45.6.bb | |||
@@ -125,6 +125,8 @@ do_compile_ptest() { | |||
125 | } | 125 | } |
126 | 126 | ||
127 | do_install_ptest() { | 127 | do_install_ptest() { |
128 | # This file's permissions depends on the host umask so be deterministic | ||
129 | chmod 0644 ${B}/tests/test_data.tmp | ||
128 | cp -R --no-dereference --preserve=mode,links -v ${B}/tests ${D}${PTEST_PATH}/test | 130 | cp -R --no-dereference --preserve=mode,links -v ${B}/tests ${D}${PTEST_PATH}/test |
129 | cp -R --no-dereference --preserve=mode,links -v ${S}/tests/* ${D}${PTEST_PATH}/test | 131 | cp -R --no-dereference --preserve=mode,links -v ${S}/tests/* ${D}${PTEST_PATH}/test |
130 | sed -e 's!../e2fsck/e2fsck!e2fsck!g' \ | 132 | sed -e 's!../e2fsck/e2fsck!e2fsck!g' \ |
diff --git a/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch b/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch new file mode 100644 index 0000000000..c8202b6bd5 --- /dev/null +++ b/meta/recipes-devtools/flex/flex/0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From 440f3f55739468cd26e22f31871eca8cbbd53294 Mon Sep 17 00:00:00 2001 | ||
2 | From: Oleksiy Obitotskyy <oobitots@cisco.com> | ||
3 | Date: Wed, 6 Jan 2021 06:12:14 -0800 | ||
4 | Subject: [PATCH] Emit no #line directives if gen_line_dirs is false | ||
5 | |||
6 | If we set --noline we should not print line directives. | ||
7 | But setting --noline means gen_line_dirs is false. | ||
8 | |||
9 | Upstream-Status: Submitted | ||
10 | Signed-off-by: Oleksiy Obitotskyy <oobitots@cisco.com> | ||
11 | --- | ||
12 | src/buf.c | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/src/buf.c b/src/buf.c | ||
16 | index 185083c..4439e28 100644 | ||
17 | --- a/src/buf.c | ||
18 | +++ b/src/buf.c | ||
19 | @@ -95,8 +95,8 @@ struct Buf *buf_linedir (struct Buf *buf, const char* filename, int lineno) | ||
20 | const char *src; | ||
21 | size_t tsz; | ||
22 | |||
23 | - if (gen_line_dirs) | ||
24 | - return buf; | ||
25 | + if (!gen_line_dirs) | ||
26 | + return buf; | ||
27 | |||
28 | tsz = strlen("#line \"\"\n") + /* constant parts */ | ||
29 | 2 * strlen (filename) + /* filename with possibly all backslashes escaped */ | ||
30 | -- | ||
31 | 2.26.2.Cisco | ||
32 | |||
diff --git a/meta/recipes-devtools/flex/flex_2.6.4.bb b/meta/recipes-devtools/flex/flex_2.6.4.bb index 3d57572865..1d43d2228a 100644 --- a/meta/recipes-devtools/flex/flex_2.6.4.bb +++ b/meta/recipes-devtools/flex/flex_2.6.4.bb | |||
@@ -16,6 +16,7 @@ SRC_URI = "https://github.com/westes/flex/releases/download/v${PV}/flex-${PV}.ta | |||
16 | ${@bb.utils.contains('PTEST_ENABLED', '1', '', 'file://disable-tests.patch', d)} \ | 16 | ${@bb.utils.contains('PTEST_ENABLED', '1', '', 'file://disable-tests.patch', d)} \ |
17 | file://0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch \ | 17 | file://0001-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch \ |
18 | file://check-funcs.patch \ | 18 | file://check-funcs.patch \ |
19 | file://0001-Emit-no-line-directives-if-gen_line_dirs-is-false.patch \ | ||
19 | " | 20 | " |
20 | 21 | ||
21 | SRC_URI[md5sum] = "2882e3179748cc9f9c23ec593d6adc8d" | 22 | SRC_URI[md5sum] = "2882e3179748cc9f9c23ec593d6adc8d" |
diff --git a/meta/recipes-devtools/gcc/gcc-10.2.inc b/meta/recipes-devtools/gcc/gcc-10.2.inc index 7625af5110..82f180db77 100644 --- a/meta/recipes-devtools/gcc/gcc-10.2.inc +++ b/meta/recipes-devtools/gcc/gcc-10.2.inc | |||
@@ -69,6 +69,7 @@ SRC_URI = "\ | |||
69 | file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \ | 69 | file://0002-aarch64-Introduce-SLS-mitigation-for-RET-and-BR-inst.patch \ |
70 | file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \ | 70 | file://0003-aarch64-Mitigate-SLS-for-BLR-instruction.patch \ |
71 | file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \ | 71 | file://0001-aarch64-Fix-up-__aarch64_cas16_acq_rel-fallback.patch \ |
72 | file://0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch \ | ||
72 | " | 73 | " |
73 | SRC_URI[sha256sum] = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c" | 74 | SRC_URI[sha256sum] = "b8dd4368bb9c7f0b98188317ee0254dd8cc99d1e3a18d0ff146c855fe16c1d8c" |
74 | 75 | ||
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers.inc b/meta/recipes-devtools/gcc/gcc-sanitizers.inc index 668e14a59f..9e643ee277 100644 --- a/meta/recipes-devtools/gcc/gcc-sanitizers.inc +++ b/meta/recipes-devtools/gcc/gcc-sanitizers.inc | |||
@@ -35,6 +35,11 @@ do_compile () { | |||
35 | do_install () { | 35 | do_install () { |
36 | cd ${B}/${TARGET_SYS}/libsanitizer/ | 36 | cd ${B}/${TARGET_SYS}/libsanitizer/ |
37 | oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install | 37 | oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install |
38 | if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then | ||
39 | install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include | ||
40 | mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include | ||
41 | rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include | ||
42 | fi | ||
38 | if [ -d ${D}${infodir} ]; then | 43 | if [ -d ${D}${infodir} ]; then |
39 | rmdir --ignore-fail-on-non-empty -p ${D}${infodir} | 44 | rmdir --ignore-fail-on-non-empty -p ${D}${infodir} |
40 | fi | 45 | fi |
@@ -109,4 +114,4 @@ FILES_libtsan-dev += "\ | |||
109 | " | 114 | " |
110 | FILES_libtsan-staticdev += "${libdir}/libtsan.a" | 115 | FILES_libtsan-staticdev += "${libdir}/libtsan.a" |
111 | 116 | ||
112 | FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" | 117 | FILES_${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" |
diff --git a/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch b/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch new file mode 100644 index 0000000000..addecb4bd8 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0001-libatomic-libgomp-libitc-Fix-bootstrap-PR70454.patch | |||
@@ -0,0 +1,208 @@ | |||
1 | From 2824d2418605e092899117e77bc8ebf332321807 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jakub Jelinek <jakub@redhat.com> | ||
3 | Date: Fri, 15 Jan 2021 13:12:59 +0100 | ||
4 | Subject: [PATCH] libatomic, libgomp, libitc: Fix bootstrap [PR70454] | ||
5 | |||
6 | The recent changes to error on mixing -march=i386 and -fcf-protection broke | ||
7 | bootstrap. This patch changes lib{atomic,gomp,itm} configury, so that it | ||
8 | only adds -march=i486 to flags if really needed (i.e. when 486 or later isn't | ||
9 | on by default already). Similarly, it will not use ifuncs if -mcx16 | ||
10 | (or -march=i686 for 32-bit) is on by default. | ||
11 | |||
12 | 2021-01-15 Jakub Jelinek <jakub@redhat.com> | ||
13 | |||
14 | PR target/70454 | ||
15 | libatomic/ | ||
16 | * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to | ||
17 | be added through preprocessor check on | ||
18 | __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. Determine if try_ifunc is needed | ||
19 | based on preprocessor check on __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 | ||
20 | or __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8. | ||
21 | libgomp/ | ||
22 | * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to | ||
23 | be added through preprocessor check on | ||
24 | __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. | ||
25 | libitm/ | ||
26 | * configure.tgt: For i?86 and x86_64 determine if -march=i486 needs to | ||
27 | be added through preprocessor check on | ||
28 | __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4. | ||
29 | |||
30 | Upstream-Status: Backport [master post 10.x release] | ||
31 | --- | ||
32 | libatomic/configure.tgt | 56 +++++++++++++++++++++++------------------ | ||
33 | libgomp/configure.tgt | 35 +++++++++++--------------- | ||
34 | libitm/configure.tgt | 37 +++++++++++++-------------- | ||
35 | 3 files changed, 64 insertions(+), 64 deletions(-) | ||
36 | |||
37 | diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt | ||
38 | index 5dd0926d20..6ea082a29b 100644 | ||
39 | --- a/libatomic/configure.tgt | ||
40 | +++ b/libatomic/configure.tgt | ||
41 | @@ -81,32 +81,40 @@ case "${target_cpu}" in | ||
42 | ARCH=sparc | ||
43 | ;; | ||
44 | |||
45 | - i[3456]86) | ||
46 | - case " ${CC} ${CFLAGS} " in | ||
47 | - *" -m64 "*|*" -mx32 "*) | ||
48 | - ;; | ||
49 | - *) | ||
50 | - if test -z "$with_arch"; then | ||
51 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
52 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
53 | - fi | ||
54 | - esac | ||
55 | - ARCH=x86 | ||
56 | - # ??? Detect when -march=i686 is already enabled. | ||
57 | - try_ifunc=yes | ||
58 | - ;; | ||
59 | - x86_64) | ||
60 | - case " ${CC} ${CFLAGS} " in | ||
61 | - *" -m32 "*) | ||
62 | + i[3456]86 | x86_64) | ||
63 | + cat > conftestx.c <<EOF | ||
64 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | ||
65 | +#error need -march=i486 | ||
66 | +#endif | ||
67 | +EOF | ||
68 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
69 | + : | ||
70 | + else | ||
71 | + if test "${target_cpu}" = x86_64; then | ||
72 | XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
73 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
74 | - ;; | ||
75 | - *) | ||
76 | - ;; | ||
77 | - esac | ||
78 | + else | ||
79 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
80 | + fi | ||
81 | + XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
82 | + fi | ||
83 | + cat > conftestx.c <<EOF | ||
84 | +#ifdef __x86_64__ | ||
85 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 | ||
86 | +#error need -mcx16 | ||
87 | +#endif | ||
88 | +#else | ||
89 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 | ||
90 | +#error need -march=i686 | ||
91 | +#endif | ||
92 | +#endif | ||
93 | +EOF | ||
94 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
95 | + try_ifunc=no | ||
96 | + else | ||
97 | + try_ifunc=yes | ||
98 | + fi | ||
99 | + rm -f conftestx.c | ||
100 | ARCH=x86 | ||
101 | - # ??? Detect when -mcx16 is already enabled. | ||
102 | - try_ifunc=yes | ||
103 | ;; | ||
104 | |||
105 | *) ARCH="${target_cpu}" ;; | ||
106 | diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt | ||
107 | index 4790a31e39..761ef2a7db 100644 | ||
108 | --- a/libgomp/configure.tgt | ||
109 | +++ b/libgomp/configure.tgt | ||
110 | @@ -70,28 +70,23 @@ if test x$enable_linux_futex = xyes; then | ||
111 | ;; | ||
112 | |||
113 | # Note that bare i386 is not included here. We need cmpxchg. | ||
114 | - i[456]86-*-linux*) | ||
115 | + i[456]86-*-linux* | x86_64-*-linux*) | ||
116 | config_path="linux/x86 linux posix" | ||
117 | - case " ${CC} ${CFLAGS} " in | ||
118 | - *" -m64 "*|*" -mx32 "*) | ||
119 | - ;; | ||
120 | - *) | ||
121 | - if test -z "$with_arch"; then | ||
122 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
123 | - fi | ||
124 | - esac | ||
125 | - ;; | ||
126 | - | ||
127 | - # Similar jiggery-pokery for x86_64 multilibs, except here we | ||
128 | - # can't rely on the --with-arch configure option, since that | ||
129 | - # applies to the 64-bit side. | ||
130 | - x86_64-*-linux*) | ||
131 | - config_path="linux/x86 linux posix" | ||
132 | - case " ${CC} ${CFLAGS} " in | ||
133 | - *" -m32 "*) | ||
134 | + cat > conftestx.c <<EOF | ||
135 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | ||
136 | +#error need -march=i486 | ||
137 | +#endif | ||
138 | +EOF | ||
139 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
140 | + : | ||
141 | + else | ||
142 | + if test "${target_cpu}" = x86_64; then | ||
143 | XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
144 | - ;; | ||
145 | - esac | ||
146 | + else | ||
147 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
148 | + fi | ||
149 | + fi | ||
150 | + rm -f conftestx.c | ||
151 | ;; | ||
152 | |||
153 | # Note that sparcv7 and sparcv8 is not included here. We need cas. | ||
154 | diff --git a/libitm/configure.tgt b/libitm/configure.tgt | ||
155 | index 04109160e9..ca62bac627 100644 | ||
156 | --- a/libitm/configure.tgt | ||
157 | +++ b/libitm/configure.tgt | ||
158 | @@ -58,16 +58,23 @@ case "${target_cpu}" in | ||
159 | |||
160 | arm*) ARCH=arm ;; | ||
161 | |||
162 | - i[3456]86) | ||
163 | - case " ${CC} ${CFLAGS} " in | ||
164 | - *" -m64 "*|*" -mx32 "*) | ||
165 | - ;; | ||
166 | - *) | ||
167 | - if test -z "$with_arch"; then | ||
168 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
169 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
170 | - fi | ||
171 | - esac | ||
172 | + i[3456]86 | x86_64) | ||
173 | + cat > conftestx.c <<EOF | ||
174 | +#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | ||
175 | +#error need -march=i486 | ||
176 | +#endif | ||
177 | +EOF | ||
178 | + if ${CC} ${CFLAGS} -E conftestx.c > /dev/null 2>&1; then | ||
179 | + : | ||
180 | + else | ||
181 | + if test "${target_cpu}" = x86_64; then | ||
182 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
183 | + else | ||
184 | + XCFLAGS="${XCFLAGS} -march=i486 -mtune=${target_cpu}" | ||
185 | + fi | ||
186 | + XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
187 | + fi | ||
188 | + rm -f conftestx.c | ||
189 | XCFLAGS="${XCFLAGS} -mrtm" | ||
190 | ARCH=x86 | ||
191 | ;; | ||
192 | @@ -102,16 +109,6 @@ case "${target_cpu}" in | ||
193 | ARCH=sparc | ||
194 | ;; | ||
195 | |||
196 | - x86_64) | ||
197 | - case " ${CC} ${CFLAGS} " in | ||
198 | - *" -m32 "*) | ||
199 | - XCFLAGS="${XCFLAGS} -march=i486 -mtune=generic" | ||
200 | - XCFLAGS="${XCFLAGS} -fomit-frame-pointer" | ||
201 | - ;; | ||
202 | - esac | ||
203 | - XCFLAGS="${XCFLAGS} -mrtm" | ||
204 | - ARCH=x86 | ||
205 | - ;; | ||
206 | s390|s390x) | ||
207 | XCFLAGS="${XCFLAGS} -mzarch -mhtm" | ||
208 | ARCH=s390 | ||
diff --git a/meta/recipes-devtools/git/git.inc b/meta/recipes-devtools/git/git.inc index 544e23c844..3e78254eec 100644 --- a/meta/recipes-devtools/git/git.inc +++ b/meta/recipes-devtools/git/git.inc | |||
@@ -7,7 +7,10 @@ DEPENDS = "openssl curl zlib expat" | |||
7 | PROVIDES_append_class-native = " git-replacement-native" | 7 | PROVIDES_append_class-native = " git-replacement-native" |
8 | 8 | ||
9 | SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ | 9 | SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \ |
10 | ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages" | 10 | ${KERNELORG_MIRROR}/software/scm/git/git-manpages-${PV}.tar.gz;name=manpages \ |
11 | file://fixsort.patch \ | ||
12 | file://CVE-2021-21300.patch \ | ||
13 | " | ||
11 | 14 | ||
12 | S = "${WORKDIR}/git-${PV}" | 15 | S = "${WORKDIR}/git-${PV}" |
13 | 16 | ||
diff --git a/meta/recipes-devtools/git/git/CVE-2021-21300.patch b/meta/recipes-devtools/git/git/CVE-2021-21300.patch new file mode 100644 index 0000000000..390570fe78 --- /dev/null +++ b/meta/recipes-devtools/git/git/CVE-2021-21300.patch | |||
@@ -0,0 +1,304 @@ | |||
1 | From ba07d31bd2140190c4d8c197c9b8a503544b4c29 Mon Sep 17 00:00:00 2001 | ||
2 | From: Minjae Kim <flowrgom@gmail.com> | ||
3 | Date: Sat, 27 Mar 2021 14:05:56 +0900 | ||
4 | Subject: [PATCH] checkout: fix bug that makes checkout follow symlinks in | ||
5 | leading path | ||
6 | |||
7 | Before checking out a file, we have to confirm that all of its leading | ||
8 | components are real existing directories. And to reduce the number of | ||
9 | lstat() calls in this process, we cache the last leading path known to | ||
10 | contain only directories. However, when a path collision occurs (e.g. | ||
11 | when checking out case-sensitive files in case-insensitive file | ||
12 | systems), a cached path might have its file type changed on disk, | ||
13 | leaving the cache on an invalid state. Normally, this doesn't bring | ||
14 | any bad consequences as we usually check out files in index order, and | ||
15 | therefore, by the time the cached path becomes outdated, we no longer | ||
16 | need it anyway (because all files in that directory would have already | ||
17 | been written). | ||
18 | |||
19 | But, there are some users of the checkout machinery that do not always | ||
20 | follow the index order. In particular: checkout-index writes the paths | ||
21 | in the same order that they appear on the CLI (or stdin); and the | ||
22 | delayed checkout feature -- used when a long-running filter process | ||
23 | replies with "status=delayed" -- postpones the checkout of some entries, | ||
24 | thus modifying the checkout order. | ||
25 | |||
26 | When we have to check out an out-of-order entry and the lstat() cache is | ||
27 | invalid (due to a previous path collision), checkout_entry() may end up | ||
28 | using the invalid data and thrusting that the leading components are | ||
29 | real directories when, in reality, they are not. In the best case | ||
30 | scenario, where the directory was replaced by a regular file, the user | ||
31 | will get an error: "fatal: unable to create file 'foo/bar': Not a | ||
32 | directory". But if the directory was replaced by a symlink, checkout | ||
33 | could actually end up following the symlink and writing the file at a | ||
34 | wrong place, even outside the repository. Since delayed checkout is | ||
35 | affected by this bug, it could be used by an attacker to write | ||
36 | arbitrary files during the clone of a maliciously crafted repository. | ||
37 | |||
38 | Some candidate solutions considered were to disable the lstat() cache | ||
39 | during unordered checkouts or sort the entries before passing them to | ||
40 | the checkout machinery. But both ideas include some performance penalty | ||
41 | and they don't future-proof the code against new unordered use cases. | ||
42 | |||
43 | Instead, we now manually reset the lstat cache whenever we successfully | ||
44 | remove a directory. Note: We are not even checking whether the directory | ||
45 | was the same as the lstat cache points to because we might face a | ||
46 | scenario where the paths refer to the same location but differ due to | ||
47 | case folding, precomposed UTF-8 issues, or the presence of `..` | ||
48 | components in the path. Two regression tests, with case-collisions and | ||
49 | utf8-collisions, are also added for both checkout-index and delayed | ||
50 | checkout. | ||
51 | |||
52 | Note: to make the previously mentioned clone attack unfeasible, it would | ||
53 | be sufficient to reset the lstat cache only after the remove_subtree() | ||
54 | call inside checkout_entry(). This is the place where we would remove a | ||
55 | directory whose path collides with the path of another entry that we are | ||
56 | currently trying to check out (possibly a symlink). However, in the | ||
57 | interest of a thorough fix that does not leave Git open to | ||
58 | similar-but-not-identical attack vectors, we decided to intercept | ||
59 | all `rmdir()` calls in one fell swoop. | ||
60 | |||
61 | This addresses CVE-2021-21300. | ||
62 | |||
63 | Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de> | ||
64 | Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> | ||
65 | |||
66 | Upstream-Status: Acepted [https://github.com/git/git/commit/684dd4c2b414bcf648505e74498a608f28de4592] | ||
67 | CVE: CVE-2021-21300 | ||
68 | Signed-off-by: Minjae Kim <flowergom@gmail.com> | ||
69 | --- | ||
70 | cache.h | 1 + | ||
71 | compat/mingw.c | 2 ++ | ||
72 | git-compat-util.h | 5 +++++ | ||
73 | symlinks.c | 24 ++++++++++++++++++++ | ||
74 | t/t0021-conversion.sh | 39 ++++++++++++++++++++++++++++++++ | ||
75 | t/t0021/rot13-filter.pl | 21 ++++++++++++++--- | ||
76 | t/t2006-checkout-index-basic.sh | 40 +++++++++++++++++++++++++++++++++ | ||
77 | 7 files changed, 129 insertions(+), 3 deletions(-) | ||
78 | |||
79 | diff --git a/cache.h b/cache.h | ||
80 | index 6544264..64226c3 100644 | ||
81 | --- a/cache.h | ||
82 | +++ b/cache.h | ||
83 | @@ -1733,6 +1733,7 @@ int has_symlink_leading_path(const char *name, int len); | ||
84 | int threaded_has_symlink_leading_path(struct cache_def *, const char *, int); | ||
85 | int check_leading_path(const char *name, int len); | ||
86 | int has_dirs_only_path(const char *name, int len, int prefix_len); | ||
87 | +extern void invalidate_lstat_cache(void); | ||
88 | void schedule_dir_for_removal(const char *name, int len); | ||
89 | void remove_scheduled_dirs(void); | ||
90 | |||
91 | diff --git a/compat/mingw.c b/compat/mingw.c | ||
92 | index 8ee0b64..be2b88e 100644 | ||
93 | --- a/compat/mingw.c | ||
94 | +++ b/compat/mingw.c | ||
95 | @@ -364,6 +364,8 @@ int mingw_rmdir(const char *pathname) | ||
96 | ask_yes_no_if_possible("Deletion of directory '%s' failed. " | ||
97 | "Should I try again?", pathname)) | ||
98 | ret = _wrmdir(wpathname); | ||
99 | + if (!ret) | ||
100 | + invalidate_lstat_cache(); | ||
101 | return ret; | ||
102 | } | ||
103 | |||
104 | diff --git a/git-compat-util.h b/git-compat-util.h | ||
105 | index 5637114..d983853 100644 | ||
106 | --- a/git-compat-util.h | ||
107 | +++ b/git-compat-util.h | ||
108 | @@ -345,6 +345,11 @@ static inline int noop_core_config(const char *var, const char *value, void *cb) | ||
109 | #define platform_core_config noop_core_config | ||
110 | #endif | ||
111 | |||
112 | +int lstat_cache_aware_rmdir(const char *path); | ||
113 | +#if !defined(__MINGW32__) && !defined(_MSC_VER) | ||
114 | +#define rmdir lstat_cache_aware_rmdir | ||
115 | +#endif | ||
116 | + | ||
117 | #ifndef has_dos_drive_prefix | ||
118 | static inline int git_has_dos_drive_prefix(const char *path) | ||
119 | { | ||
120 | diff --git a/symlinks.c b/symlinks.c | ||
121 | index 69d458a..7dbb6b2 100644 | ||
122 | --- a/symlinks.c | ||
123 | +++ b/symlinks.c | ||
124 | @@ -267,6 +267,13 @@ int has_dirs_only_path(const char *name, int len, int prefix_len) | ||
125 | */ | ||
126 | static int threaded_has_dirs_only_path(struct cache_def *cache, const char *name, int len, int prefix_len) | ||
127 | { | ||
128 | + /* | ||
129 | + * Note: this function is used by the checkout machinery, which also | ||
130 | + * takes care to properly reset the cache when it performs an operation | ||
131 | + * that would leave the cache outdated. If this function starts caching | ||
132 | + * anything else besides FL_DIR, remember to also invalidate the cache | ||
133 | + * when creating or deleting paths that might be in the cache. | ||
134 | + */ | ||
135 | return lstat_cache(cache, name, len, | ||
136 | FL_DIR|FL_FULLPATH, prefix_len) & | ||
137 | FL_DIR; | ||
138 | @@ -321,3 +328,20 @@ void remove_scheduled_dirs(void) | ||
139 | { | ||
140 | do_remove_scheduled_dirs(0); | ||
141 | } | ||
142 | + | ||
143 | +void invalidate_lstat_cache(void) | ||
144 | +{ | ||
145 | + reset_lstat_cache(&default_cache); | ||
146 | +} | ||
147 | + | ||
148 | +#undef rmdir | ||
149 | +int lstat_cache_aware_rmdir(const char *path) | ||
150 | +{ | ||
151 | + /* Any change in this function must be made also in `mingw_rmdir()` */ | ||
152 | + int ret = rmdir(path); | ||
153 | + | ||
154 | + if (!ret) | ||
155 | + invalidate_lstat_cache(); | ||
156 | + | ||
157 | + return ret; | ||
158 | +} | ||
159 | diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh | ||
160 | index 4bfffa9..c42f51e 100755 | ||
161 | --- a/t/t0021-conversion.sh | ||
162 | +++ b/t/t0021-conversion.sh | ||
163 | @@ -957,4 +957,43 @@ test_expect_success PERL 'invalid file in delayed checkout' ' | ||
164 | grep "error: external filter .* signaled that .unfiltered. is now available although it has not been delayed earlier" git-stderr.log | ||
165 | ' | ||
166 | |||
167 | +for mode in 'case' 'utf-8' | ||
168 | +do | ||
169 | + case "$mode" in | ||
170 | + case) dir='A' symlink='a' mode_prereq='CASE_INSENSITIVE_FS' ;; | ||
171 | + utf-8) | ||
172 | + dir=$(printf "\141\314\210") symlink=$(printf "\303\244") | ||
173 | + mode_prereq='UTF8_NFD_TO_NFC' ;; | ||
174 | + esac | ||
175 | + | ||
176 | + test_expect_success PERL,SYMLINKS,$mode_prereq \ | ||
177 | + "delayed checkout with $mode-collision don't write to the wrong place" ' | ||
178 | + test_config_global filter.delay.process \ | ||
179 | + "\"$TEST_ROOT/rot13-filter.pl\" --always-delay delayed.log clean smudge delay" && | ||
180 | + test_config_global filter.delay.required true && | ||
181 | + git init $mode-collision && | ||
182 | + ( | ||
183 | + cd $mode-collision && | ||
184 | + mkdir target-dir && | ||
185 | + empty_oid=$(printf "" | git hash-object -w --stdin) && | ||
186 | + symlink_oid=$(printf "%s" "$PWD/target-dir" | git hash-object -w --stdin) && | ||
187 | + attr_oid=$(echo "$dir/z filter=delay" | git hash-object -w --stdin) && | ||
188 | + cat >objs <<-EOF && | ||
189 | + 100644 blob $empty_oid $dir/x | ||
190 | + 100644 blob $empty_oid $dir/y | ||
191 | + 100644 blob $empty_oid $dir/z | ||
192 | + 120000 blob $symlink_oid $symlink | ||
193 | + 100644 blob $attr_oid .gitattributes | ||
194 | + EOF | ||
195 | + git update-index --index-info <objs && | ||
196 | + git commit -m "test commit" | ||
197 | + ) && | ||
198 | + git clone $mode-collision $mode-collision-cloned && | ||
199 | + # Make sure z was really delayed | ||
200 | + grep "IN: smudge $dir/z .* \\[DELAYED\\]" $mode-collision-cloned/delayed.log && | ||
201 | + # Should not create $dir/z at $symlink/z | ||
202 | + test_path_is_missing $mode-collision/target-dir/z | ||
203 | + ' | ||
204 | +done | ||
205 | + | ||
206 | test_done | ||
207 | diff --git a/t/t0021/rot13-filter.pl b/t/t0021/rot13-filter.pl | ||
208 | index cd32a82..7bb9376 100644 | ||
209 | --- a/t/t0021/rot13-filter.pl | ||
210 | +++ b/t/t0021/rot13-filter.pl | ||
211 | @@ -2,9 +2,15 @@ | ||
212 | # Example implementation for the Git filter protocol version 2 | ||
213 | # See Documentation/gitattributes.txt, section "Filter Protocol" | ||
214 | # | ||
215 | -# The first argument defines a debug log file that the script write to. | ||
216 | -# All remaining arguments define a list of supported protocol | ||
217 | -# capabilities ("clean", "smudge", etc). | ||
218 | +# Usage: rot13-filter.pl [--always-delay] <log path> <capabilities> | ||
219 | +# | ||
220 | +# Log path defines a debug log file that the script writes to. The | ||
221 | +# subsequent arguments define a list of supported protocol capabilities | ||
222 | +# ("clean", "smudge", etc). | ||
223 | +# | ||
224 | +# When --always-delay is given all pathnames with the "can-delay" flag | ||
225 | +# that don't appear on the list bellow are delayed with a count of 1 | ||
226 | +# (see more below). | ||
227 | # | ||
228 | # This implementation supports special test cases: | ||
229 | # (1) If data with the pathname "clean-write-fail.r" is processed with | ||
230 | @@ -53,6 +59,13 @@ sub gitperllib { | ||
231 | use Git::Packet; | ||
232 | |||
233 | my $MAX_PACKET_CONTENT_SIZE = 65516; | ||
234 | + | ||
235 | +my $always_delay = 0; | ||
236 | +if ( $ARGV[0] eq '--always-delay' ) { | ||
237 | + $always_delay = 1; | ||
238 | + shift @ARGV; | ||
239 | +} | ||
240 | + | ||
241 | my $log_file = shift @ARGV; | ||
242 | my @capabilities = @ARGV; | ||
243 | |||
244 | @@ -134,6 +147,8 @@ sub rot13 { | ||
245 | if ( $buffer eq "can-delay=1" ) { | ||
246 | if ( exists $DELAY{$pathname} and $DELAY{$pathname}{"requested"} == 0 ) { | ||
247 | $DELAY{$pathname}{"requested"} = 1; | ||
248 | + } elsif ( !exists $DELAY{$pathname} and $always_delay ) { | ||
249 | + $DELAY{$pathname} = { "requested" => 1, "count" => 1 }; | ||
250 | } | ||
251 | } elsif ($buffer =~ /^(ref|treeish|blob)=/) { | ||
252 | print $debug " $buffer"; | ||
253 | diff --git a/t/t2006-checkout-index-basic.sh b/t/t2006-checkout-index-basic.sh | ||
254 | index 57cbdfe..f223a02 100755 | ||
255 | --- a/t/t2006-checkout-index-basic.sh | ||
256 | +++ b/t/t2006-checkout-index-basic.sh | ||
257 | @@ -21,4 +21,44 @@ test_expect_success 'checkout-index -h in broken repository' ' | ||
258 | test_i18ngrep "[Uu]sage" broken/usage | ||
259 | ' | ||
260 | |||
261 | +for mode in 'case' 'utf-8' | ||
262 | +do | ||
263 | + case "$mode" in | ||
264 | + case) dir='A' symlink='a' mode_prereq='CASE_INSENSITIVE_FS' ;; | ||
265 | + utf-8) | ||
266 | + dir=$(printf "\141\314\210") symlink=$(printf "\303\244") | ||
267 | + mode_prereq='UTF8_NFD_TO_NFC' ;; | ||
268 | + esac | ||
269 | + | ||
270 | + test_expect_success SYMLINKS,$mode_prereq \ | ||
271 | + "checkout-index with $mode-collision don't write to the wrong place" ' | ||
272 | + git init $mode-collision && | ||
273 | + ( | ||
274 | + cd $mode-collision && | ||
275 | + mkdir target-dir && | ||
276 | + empty_obj_hex=$(git hash-object -w --stdin </dev/null) && | ||
277 | + symlink_hex=$(printf "%s" "$PWD/target-dir" | git hash-object -w --stdin) && | ||
278 | + cat >objs <<-EOF && | ||
279 | + 100644 blob ${empty_obj_hex} ${dir}/x | ||
280 | + 100644 blob ${empty_obj_hex} ${dir}/y | ||
281 | + 100644 blob ${empty_obj_hex} ${dir}/z | ||
282 | + 120000 blob ${symlink_hex} ${symlink} | ||
283 | + EOF | ||
284 | + git update-index --index-info <objs && | ||
285 | + # Note: the order is important here to exercise the | ||
286 | + # case where the file at ${dir} has its type changed by | ||
287 | + # the time Git tries to check out ${dir}/z. | ||
288 | + # | ||
289 | + # Also, we use core.precomposeUnicode=false because we | ||
290 | + # want Git to treat the UTF-8 paths transparently on | ||
291 | + # Mac OS, matching what is in the index. | ||
292 | + # | ||
293 | + git -c core.precomposeUnicode=false checkout-index -f \ | ||
294 | + ${dir}/x ${dir}/y ${symlink} ${dir}/z && | ||
295 | + # Should not create ${dir}/z at ${symlink}/z | ||
296 | + test_path_is_missing target-dir/z | ||
297 | + ) | ||
298 | + ' | ||
299 | +done | ||
300 | + | ||
301 | test_done | ||
302 | -- | ||
303 | 2.17.1 | ||
304 | |||
diff --git a/meta/recipes-devtools/git/git/fixsort.patch b/meta/recipes-devtools/git/git/fixsort.patch new file mode 100644 index 0000000000..07a487e8ca --- /dev/null +++ b/meta/recipes-devtools/git/git/fixsort.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | [PATCH] generate-configlist.sh: Fix determinism issue | ||
2 | |||
3 | Currently git binaries are not entirely reproducible, at least partly | ||
4 | due to config-list.h differing in order depending on the system's | ||
5 | locale settings. Under different locales, the entries: | ||
6 | |||
7 | "sendemail.identity", | ||
8 | "sendemail.<identity>.*", | ||
9 | |||
10 | would differ in order for example and this leads to differences in | ||
11 | the debug symbols for the binaries. | ||
12 | |||
13 | This can be fixed by specifying the C locale for the sort in the | ||
14 | shell script generating the header. | ||
15 | |||
16 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
17 | Upstream-Status: Submitted [https://public-inbox.org/git/f029a942dd3d50d85e60bd37d8e454524987842f.camel@linuxfoundation.org/T/#u] | ||
18 | |||
19 | Index: git-2.30.0/generate-configlist.sh | ||
20 | =================================================================== | ||
21 | --- git-2.30.0.orig/generate-configlist.sh | ||
22 | +++ git-2.30.0/generate-configlist.sh | ||
23 | @@ -9,7 +9,7 @@ static const char *config_name_list[] = | ||
24 | EOF | ||
25 | grep -h '^[a-zA-Z].*\..*::$' Documentation/*config.txt Documentation/config/*.txt | | ||
26 | sed '/deprecated/d; s/::$//; s/, */\n/g' | | ||
27 | - sort | | ||
28 | + LC_ALL=C sort | | ||
29 | sed 's/^.*$/ "&",/' | ||
30 | cat <<EOF | ||
31 | NULL, | ||
diff --git a/meta/recipes-devtools/go/go-1.15.inc b/meta/recipes-devtools/go/go-1.15.inc index 97d748b922..7c8190f68c 100644 --- a/meta/recipes-devtools/go/go-1.15.inc +++ b/meta/recipes-devtools/go/go-1.15.inc | |||
@@ -1,8 +1,7 @@ | |||
1 | require go-common.inc | 1 | require go-common.inc |
2 | 2 | ||
3 | GO_BASEVERSION = "1.15" | 3 | GO_BASEVERSION = "1.15" |
4 | GO_MINOR = ".2" | 4 | PV = "1.15.8" |
5 | PV .= "${GO_MINOR}" | ||
6 | FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" | 5 | FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:" |
7 | 6 | ||
8 | LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" | 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" |
@@ -17,4 +16,4 @@ SRC_URI += "\ | |||
17 | file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ | 16 | file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ |
18 | file://0008-use-GOBUILDMODE-to-set-buildmode.patch \ | 17 | file://0008-use-GOBUILDMODE-to-set-buildmode.patch \ |
19 | " | 18 | " |
20 | SRC_URI[main.sha256sum] = "28bf9d0bcde251011caae230a4a05d917b172ea203f2a62f2c2f9533589d4b4d" | 19 | SRC_URI[main.sha256sum] = "540c0ab7781084d124991321ed1458e479982de94454a98afab6acadf38497c2" |
diff --git a/meta/recipes-devtools/go/go-binary-native_1.15.2.bb b/meta/recipes-devtools/go/go-binary-native_1.15.8.bb index ccd2d5ebad..df697e2781 100644 --- a/meta/recipes-devtools/go/go-binary-native_1.15.2.bb +++ b/meta/recipes-devtools/go/go-binary-native_1.15.8.bb | |||
@@ -8,8 +8,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" | |||
8 | PROVIDES = "go-native" | 8 | PROVIDES = "go-native" |
9 | 9 | ||
10 | SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}" | 10 | SRC_URI = "https://dl.google.com/go/go${PV}.${BUILD_GOOS}-${BUILD_GOARCH}.tar.gz;name=go_${BUILD_GOTUPLE}" |
11 | SRC_URI[go_linux_amd64.sha256sum] = "b49fda1ca29a1946d6bb2a5a6982cf07ccd2aba849289508ee0f9918f6bb4552" | 11 | SRC_URI[go_linux_amd64.sha256sum] = "d3379c32a90fdf9382166f8f48034c459a8cc433730bc9476d39d9082c94583b" |
12 | SRC_URI[go_linux_arm64.sha256sum] = "c8ec460cc82d61604b048f9439c06bd591722efce5cd48f49e19b5f6226bd36d" | 12 | SRC_URI[go_linux_arm64.sha256sum] = "0e31ea4bf53496b0f0809730520dee98c0ae5c530f3701a19df0ba0a327bf3d2" |
13 | 13 | ||
14 | UPSTREAM_CHECK_URI = "https://golang.org/dl/" | 14 | UPSTREAM_CHECK_URI = "https://golang.org/dl/" |
15 | UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux" | 15 | UPSTREAM_CHECK_REGEX = "go(?P<pver>\d+(\.\d+)+)\.linux" |
diff --git a/meta/recipes-devtools/go/go-runtime_1.15.bb b/meta/recipes-devtools/go/go-runtime_1.15.bb index 4eeee65e0c..d6ddb31ed4 100644 --- a/meta/recipes-devtools/go/go-runtime_1.15.bb +++ b/meta/recipes-devtools/go/go-runtime_1.15.bb | |||
@@ -1,3 +1,4 @@ | |||
1 | export CGO_ENABLED_riscv64 = "" | 1 | export CGO_ENABLED_riscv64 = "" |
2 | require go-${PV}.inc | 2 | require go-${PV}.inc |
3 | require go-runtime.inc | 3 | require go-runtime.inc |
4 | |||
diff --git a/meta/recipes-devtools/go/go_1.15.bb b/meta/recipes-devtools/go/go_1.15.bb index 4bf9dd50b2..d4812c0f0a 100644 --- a/meta/recipes-devtools/go/go_1.15.bb +++ b/meta/recipes-devtools/go/go_1.15.bb | |||
@@ -6,6 +6,8 @@ inherit linuxloader | |||
6 | export GOBUILDMODE="" | 6 | export GOBUILDMODE="" |
7 | export CGO_ENABLED_riscv64 = "" | 7 | export CGO_ENABLED_riscv64 = "" |
8 | export GO_LDSO = "${@get_linuxloader(d)}" | 8 | export GO_LDSO = "${@get_linuxloader(d)}" |
9 | export CC_FOR_TARGET = "gcc" | ||
10 | export CXX_FOR_TARGET = "g++" | ||
9 | 11 | ||
10 | # mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv and its | 12 | # mips/rv64 doesn't support -buildmode=pie, so skip the QA checking for mips/riscv and its |
11 | # variants. | 13 | # variants. |
@@ -13,3 +15,4 @@ python() { | |||
13 | if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True): | 15 | if 'mips' in d.getVar('TARGET_ARCH',True) or 'riscv' in d.getVar('TARGET_ARCH',True): |
14 | d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel") | 16 | d.appendVar('INSANE_SKIP_%s' % d.getVar('PN',True), " textrel") |
15 | } | 17 | } |
18 | |||
diff --git a/meta/recipes-devtools/libtool/libtool-2.4.6.inc b/meta/recipes-devtools/libtool/libtool-2.4.6.inc index 8e17b56d46..19a03d4733 100644 --- a/meta/recipes-devtools/libtool/libtool-2.4.6.inc +++ b/meta/recipes-devtools/libtool/libtool-2.4.6.inc | |||
@@ -21,6 +21,7 @@ SRC_URI = "${GNU_MIRROR}/libtool/libtool-${PV}.tar.gz \ | |||
21 | file://unwind-opt-parsing.patch \ | 21 | file://unwind-opt-parsing.patch \ |
22 | file://0001-libtool-Fix-support-for-NIOS2-processor.patch \ | 22 | file://0001-libtool-Fix-support-for-NIOS2-processor.patch \ |
23 | file://0001-libtool-Check-for-static-libs-for-internal-compiler-.patch \ | 23 | file://0001-libtool-Check-for-static-libs-for-internal-compiler-.patch \ |
24 | file://0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch \ | ||
24 | " | 25 | " |
25 | 26 | ||
26 | SRC_URI[md5sum] = "addf44b646ddb4e3919805aa88fa7c5e" | 27 | SRC_URI[md5sum] = "addf44b646ddb4e3919805aa88fa7c5e" |
diff --git a/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch b/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch new file mode 100644 index 0000000000..2e9908725e --- /dev/null +++ b/meta/recipes-devtools/libtool/libtool/0001-Makefile.am-make-sure-autoheader-run-before-autoconf.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From dfbbbd359e43e0a55fbea06f2647279ad8761cb9 Mon Sep 17 00:00:00 2001 | ||
2 | From: Mingli Yu <mingli.yu@windriver.com> | ||
3 | Date: Wed, 24 Mar 2021 03:04:13 +0000 | ||
4 | Subject: [PATCH] Makefile.am: make sure autoheader run before autoconf | ||
5 | |||
6 | autoheader will update ../libtool-2.4.6/libltdl/config-h.in which | ||
7 | autoconf needs, so there comes a race sometimes as below: | ||
8 | | configure.ac:45: error: required file 'config-h.in' not found | ||
9 | | touch '../libtool-2.4.6/libltdl/config-h.in' | ||
10 | |||
11 | So make sure autoheader run before autoconf to avoid this race. | ||
12 | |||
13 | Upstream-Status: Submitted [libtool-patches@gnu.org maillist] | ||
14 | |||
15 | Signed-off-by: Mingli Yu <mingli.yu@windriver.com> | ||
16 | --- | ||
17 | Makefile.am | 2 +- | ||
18 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/Makefile.am b/Makefile.am | ||
21 | index 4142c90..fe1a9fc 100644 | ||
22 | --- a/Makefile.am | ||
23 | +++ b/Makefile.am | ||
24 | @@ -365,7 +365,7 @@ lt_configure_deps = $(lt_aclocal_m4) $(lt_aclocal_m4_deps) | ||
25 | $(lt_aclocal_m4): $(lt_aclocal_m4_deps) | ||
26 | $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(ACLOCAL) -I ../m4 | ||
27 | |||
28 | -$(lt_configure): $(lt_configure_deps) | ||
29 | +$(lt_configure): $(lt_configure_deps) $(lt_config_h_in) | ||
30 | $(AM_V_GEN)cd '$(srcdir)/$(ltdl_dir)' && $(AUTOCONF) | ||
31 | |||
32 | $(lt_config_h_in): $(lt_configure_deps) | ||
33 | -- | ||
34 | 2.29.2 | ||
35 | |||
diff --git a/meta/recipes-devtools/llvm/llvm_git.bb b/meta/recipes-devtools/llvm/llvm_git.bb index 4c2d490315..b146d0e6e3 100644 --- a/meta/recipes-devtools/llvm/llvm_git.bb +++ b/meta/recipes-devtools/llvm/llvm_git.bb | |||
@@ -99,6 +99,11 @@ do_configure_prepend() { | |||
99 | sed -ri "s#lib/${LLVM_DIR}#${baselib}/${LLVM_DIR}#g" ${S}/tools/llvm-config/llvm-config.cpp | 99 | sed -ri "s#lib/${LLVM_DIR}#${baselib}/${LLVM_DIR}#g" ${S}/tools/llvm-config/llvm-config.cpp |
100 | } | 100 | } |
101 | 101 | ||
102 | # patch out build host paths for reproducibility | ||
103 | do_compile_prepend_class-target() { | ||
104 | sed -i -e "s,${WORKDIR},,g" ${B}/tools/llvm-config/BuildVariables.inc | ||
105 | } | ||
106 | |||
102 | do_compile() { | 107 | do_compile() { |
103 | ninja -v ${PARALLEL_MAKE} | 108 | ninja -v ${PARALLEL_MAKE} |
104 | } | 109 | } |
diff --git a/meta/recipes-devtools/mtd/mtd-utils_git.bb b/meta/recipes-devtools/mtd/mtd-utils_git.bb index 8d6bbfca3f..ff42219513 100644 --- a/meta/recipes-devtools/mtd/mtd-utils_git.bb +++ b/meta/recipes-devtools/mtd/mtd-utils_git.bb | |||
@@ -42,11 +42,9 @@ ALTERNATIVE_PRIORITY = "100" | |||
42 | ALTERNATIVE_${PN} = "flashcp flash_eraseall flash_lock flash_unlock nanddump nandwrite" | 42 | ALTERNATIVE_${PN} = "flashcp flash_eraseall flash_lock flash_unlock nanddump nandwrite" |
43 | ALTERNATIVE_${PN}-ubifs = "ubiattach ubidetach ubimkvol ubirename ubirmvol ubirsvol ubiupdatevol" | 43 | ALTERNATIVE_${PN}-ubifs = "ubiattach ubidetach ubimkvol ubirename ubirmvol ubirsvol ubiupdatevol" |
44 | 44 | ||
45 | ALTERNATIVE_LINK_NAME[flash_eraseall] = "${sbindir}/flash_eraseall" | ||
46 | ALTERNATIVE_LINK_NAME[nandwrite] = "${sbindir}/nandwrite" | 45 | ALTERNATIVE_LINK_NAME[nandwrite] = "${sbindir}/nandwrite" |
47 | ALTERNATIVE_LINK_NAME[nanddump] = "${sbindir}/nanddump" | 46 | ALTERNATIVE_LINK_NAME[nanddump] = "${sbindir}/nanddump" |
48 | ALTERNATIVE_LINK_NAME[ubiattach] = "${sbindir}/ubiattach" | 47 | ALTERNATIVE_LINK_NAME[ubiattach] = "${sbindir}/ubiattach" |
49 | ALTERNATIVE_LINK_NAME[ubiattach] = "${sbindir}/ubiattach" | ||
50 | ALTERNATIVE_LINK_NAME[ubidetach] = "${sbindir}/ubidetach" | 48 | ALTERNATIVE_LINK_NAME[ubidetach] = "${sbindir}/ubidetach" |
51 | ALTERNATIVE_LINK_NAME[ubimkvol] = "${sbindir}/ubimkvol" | 49 | ALTERNATIVE_LINK_NAME[ubimkvol] = "${sbindir}/ubimkvol" |
52 | ALTERNATIVE_LINK_NAME[ubirename] = "${sbindir}/ubirename" | 50 | ALTERNATIVE_LINK_NAME[ubirename] = "${sbindir}/ubirename" |
diff --git a/meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch b/meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch new file mode 100644 index 0000000000..4578fa33be --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/sourcedateepoch.patch | |||
@@ -0,0 +1,24 @@ | |||
1 | Having CLEAN_DATE come from the current date doesn't allow for build | ||
2 | reproducibility. Add the option of using SOURCE_DATE_EPOCH if set | ||
3 | which for OE, it will be. | ||
4 | |||
5 | Upstream-Status: Pending | ||
6 | RP 2021/2/2 | ||
7 | |||
8 | Index: opkg-0.4.4/configure.ac | ||
9 | =================================================================== | ||
10 | --- opkg-0.4.4.orig/configure.ac | ||
11 | +++ opkg-0.4.4/configure.ac | ||
12 | @@ -281,7 +281,11 @@ AC_FUNC_UTIME_NULL | ||
13 | AC_FUNC_VPRINTF | ||
14 | AC_CHECK_FUNCS([memmove memset mkdir regcomp strchr strcspn strdup strerror strndup strrchr strstr strtol strtoul sysinfo utime]) | ||
15 | |||
16 | -CLEAN_DATE=`date +"%B %Y" | tr -d '\n'` | ||
17 | +if ! test -z "$SOURCE_DATE_EPOCH" ; then | ||
18 | + CLEAN_DATE=`LC_ALL=C date -d @$SOURCE_DATE_EPOCH +"%B %Y" | tr -d '\n'` | ||
19 | +else | ||
20 | + CLEAN_DATE=`date +"%B %Y" | tr -d '\n'` | ||
21 | +fi | ||
22 | |||
23 | AC_SUBST([CLEAN_DATE]) | ||
24 | |||
diff --git a/meta/recipes-devtools/opkg/opkg_0.4.3.bb b/meta/recipes-devtools/opkg/opkg_0.4.3.bb index 46b7aa2523..ea01d473fc 100644 --- a/meta/recipes-devtools/opkg/opkg_0.4.3.bb +++ b/meta/recipes-devtools/opkg/opkg_0.4.3.bb | |||
@@ -14,6 +14,7 @@ PE = "1" | |||
14 | SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \ | 14 | SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz \ |
15 | file://opkg.conf \ | 15 | file://opkg.conf \ |
16 | file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ | 16 | file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ |
17 | file://sourcedateepoch.patch \ | ||
17 | file://run-ptest \ | 18 | file://run-ptest \ |
18 | " | 19 | " |
19 | 20 | ||
diff --git a/meta/recipes-devtools/patch/patch/CVE-2019-20633.patch b/meta/recipes-devtools/patch/patch/CVE-2019-20633.patch new file mode 100644 index 0000000000..03988a179c --- /dev/null +++ b/meta/recipes-devtools/patch/patch/CVE-2019-20633.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 15b158db3ae11cb835f2eb8d2eb48e09d1a4af48 Mon Sep 17 00:00:00 2001 | ||
2 | From: Andreas Gruenbacher <agruen@gnu.org> | ||
3 | Date: Mon, 15 Jul 2019 19:10:02 +0200 | ||
4 | Subject: Avoid invalid memory access in context format diffs | ||
5 | |||
6 | * src/pch.c (another_hunk): Avoid invalid memory access in context format | ||
7 | diffs. | ||
8 | |||
9 | CVE: CVE-2019-20633 | ||
10 | Upstream-Status: Backport[https://git.savannah.gnu.org/cgit/patch.git/patch/?id=15b158db3ae11cb835f2eb8d2eb48e09d1a4af48] | ||
11 | Signed-off-by: Scott Murray <scott.murray@konsulko.com> | ||
12 | |||
13 | --- | ||
14 | src/pch.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/src/pch.c b/src/pch.c | ||
18 | index a500ad9..cb54e03 100644 | ||
19 | --- a/src/pch.c | ||
20 | +++ b/src/pch.c | ||
21 | @@ -1328,6 +1328,7 @@ another_hunk (enum diff difftype, bool rev) | ||
22 | ptrn_prefix_context = context; | ||
23 | ptrn_suffix_context = context; | ||
24 | if (repl_beginning | ||
25 | + || p_end <= 0 | ||
26 | || (p_end | ||
27 | != p_ptrn_lines + 1 + (p_Char[p_end - 1] == '\n'))) | ||
28 | { | ||
29 | -- | ||
30 | cgit v1.2.1 | ||
31 | |||
diff --git a/meta/recipes-devtools/patch/patch_2.7.6.bb b/meta/recipes-devtools/patch/patch_2.7.6.bb index b5897b357a..1997af0c25 100644 --- a/meta/recipes-devtools/patch/patch_2.7.6.bb +++ b/meta/recipes-devtools/patch/patch_2.7.6.bb | |||
@@ -10,6 +10,7 @@ SRC_URI += "file://0001-Unset-need_charset_alias-when-building-for-musl.patch \ | |||
10 | file://0001-Invoke-ed-directly-instead-of-using-the-shell.patch \ | 10 | file://0001-Invoke-ed-directly-instead-of-using-the-shell.patch \ |
11 | file://0001-Don-t-leak-temporary-file-on-failed-ed-style-patch.patch \ | 11 | file://0001-Don-t-leak-temporary-file-on-failed-ed-style-patch.patch \ |
12 | file://0001-Don-t-leak-temporary-file-on-failed-multi-file-ed.patch \ | 12 | file://0001-Don-t-leak-temporary-file-on-failed-multi-file-ed.patch \ |
13 | file://CVE-2019-20633.patch \ | ||
13 | " | 14 | " |
14 | 15 | ||
15 | SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600" | 16 | SRC_URI[md5sum] = "4c68cee989d83c87b00a3860bcd05600" |
diff --git a/meta/recipes-devtools/perl/perl_5.32.0.bb b/meta/recipes-devtools/perl/perl_5.32.0.bb index bba8263b90..3815dd44b1 100644 --- a/meta/recipes-devtools/perl/perl_5.32.0.bb +++ b/meta/recipes-devtools/perl/perl_5.32.0.bb | |||
@@ -137,8 +137,9 @@ do_install() { | |||
137 | install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/ | 137 | install lib/ExtUtils/typemap ${D}${libdir}/perl5/${PV}/ExtUtils/ |
138 | 138 | ||
139 | # Fix up shared library | 139 | # Fix up shared library |
140 | rm ${D}/${libdir}/perl5/${PV}/*/CORE/libperl.so | 140 | dir=$(echo ${D}/${libdir}/perl5/${PV}/*/CORE) |
141 | ln -sf ../../../../libperl.so.${PERL_LIB_VER} $(echo ${D}/${libdir}/perl5/${PV}/*/CORE)/libperl.so | 141 | rm $dir/libperl.so |
142 | ln -sf ../../../../libperl.so.${PERL_LIB_VER} $dir/libperl.so | ||
142 | 143 | ||
143 | # Try to catch Bug #13946 | 144 | # Try to catch Bug #13946 |
144 | if [ -e ${D}/${libdir}/perl5/${PV}/Storable.pm ]; then | 145 | if [ -e ${D}/${libdir}/perl5/${PV}/Storable.pm ]; then |
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb index 2e13fec540..4eab133128 100644 --- a/meta/recipes-devtools/pseudo/pseudo_git.bb +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb | |||
@@ -6,7 +6,7 @@ SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \ | |||
6 | file://fallback-group \ | 6 | file://fallback-group \ |
7 | " | 7 | " |
8 | 8 | ||
9 | SRCREV = "cca0d7f15b7197095cd587420d31b187620c3093" | 9 | SRCREV = "ee24ebec9e5a11dd5208c9be2870f35eab3b9e20" |
10 | S = "${WORKDIR}/git" | 10 | S = "${WORKDIR}/git" |
11 | PV = "1.9.0+git${SRCPV}" | 11 | PV = "1.9.0+git${SRCPV}" |
12 | 12 | ||
diff --git a/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb b/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb index 89538d2f27..9d0666a5c1 100644 --- a/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb +++ b/meta/recipes-devtools/python/python3-jinja2_2.11.2.bb | |||
@@ -7,6 +7,8 @@ SRC_URI[sha256sum] = "89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c65 | |||
7 | 7 | ||
8 | PYPI_PACKAGE = "Jinja2" | 8 | PYPI_PACKAGE = "Jinja2" |
9 | 9 | ||
10 | CVE_PRODUCT = "jinja2 jinja" | ||
11 | |||
10 | CLEANBROKEN = "1" | 12 | CLEANBROKEN = "1" |
11 | 13 | ||
12 | inherit pypi setuptools3 | 14 | inherit pypi setuptools3 |
diff --git a/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb b/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb index 34c8543bce..1734610d12 100644 --- a/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb +++ b/meta/recipes-devtools/python/python3-pycairo_1.19.1.bb | |||
@@ -18,7 +18,7 @@ SRC_URI[sha256sum] = "2c143183280feb67f5beb4e543fd49990c28e7df427301ede04fc550d3 | |||
18 | 18 | ||
19 | S = "${WORKDIR}/pycairo-${PV}" | 19 | S = "${WORKDIR}/pycairo-${PV}" |
20 | 20 | ||
21 | inherit meson pkgconfig | 21 | inherit meson pkgconfig python3targetconfig |
22 | 22 | ||
23 | CFLAGS += "-fPIC" | 23 | CFLAGS += "-fPIC" |
24 | 24 | ||
diff --git a/meta/recipes-devtools/python/python3/CVE-2021-23336.patch b/meta/recipes-devtools/python/python3/CVE-2021-23336.patch new file mode 100644 index 0000000000..27893f69fb --- /dev/null +++ b/meta/recipes-devtools/python/python3/CVE-2021-23336.patch | |||
@@ -0,0 +1,548 @@ | |||
1 | From e3110c3cfbb7daa690d54d0eff6c264c870a71bf Mon Sep 17 00:00:00 2001 | ||
2 | From: Senthil Kumaran <senthil@uthcode.com> | ||
3 | Date: Mon, 15 Feb 2021 10:15:02 -0800 | ||
4 | Subject: [PATCH] [3.8] bpo-42967: only use '&' as a query string separator | ||
5 | (GH-24297) (#24529) | ||
6 | MIME-Version: 1.0 | ||
7 | Content-Type: text/plain; charset=UTF-8 | ||
8 | Content-Transfer-Encoding: 8bit | ||
9 | |||
10 | * bpo-42967: only use '&' as a query string separator (#24297) | ||
11 | |||
12 | bpo-42967: [security] Address a web cache-poisoning issue reported in | ||
13 | urllib.parse.parse_qsl(). | ||
14 | |||
15 | urllib.parse will only us "&" as query string separator by default | ||
16 | instead of both ";" and "&" as allowed in earlier versions. An optional | ||
17 | argument seperator with default value "&" is added to specify the | ||
18 | separator. | ||
19 | |||
20 | Co-authored-by: Éric Araujo <merwok@netwok.org> | ||
21 | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> | ||
22 | Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> | ||
23 | Co-authored-by: Éric Araujo <merwok@netwok.org> | ||
24 | (cherry picked from commit fcbe0cb04d35189401c0c880ebfb4311e952d776) | ||
25 | |||
26 | * [3.8] bpo-42967: only use '&' as a query string separator (GH-24297) | ||
27 | |||
28 | bpo-42967: [security] Address a web cache-poisoning issue reported in urllib.parse.parse_qsl(). | ||
29 | |||
30 | urllib.parse will only us "&" as query string separator by default instead of both ";" and "&" as allowed in earlier versions. An optional argument seperator with default value "&" is added to specify the separator. | ||
31 | |||
32 | Co-authored-by: Éric Araujo <merwok@netwok.org> | ||
33 | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> | ||
34 | Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com> | ||
35 | Co-authored-by: Éric Araujo <merwok@netwok.org>. | ||
36 | (cherry picked from commit fcbe0cb04d35189401c0c880ebfb4311e952d776) | ||
37 | |||
38 | Co-authored-by: Adam Goldschmidt <adamgold7@gmail.com> | ||
39 | |||
40 | * Update correct version information. | ||
41 | |||
42 | * fix docs and make logic clearer | ||
43 | |||
44 | Co-authored-by: Adam Goldschmidt <adamgold7@gmail.com> | ||
45 | Co-authored-by: Fidget-Spinner <28750310+Fidget-Spinner@users.noreply.github.com> | ||
46 | |||
47 | Upstream-Status: Backport [https://github.com/python/cpython/commit/e3110c3cfbb7daa690d54d0eff6c264c870a71bf] | ||
48 | CVE: CVE-2020-23336 | ||
49 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
50 | |||
51 | --- | ||
52 | Doc/library/cgi.rst | 11 ++- | ||
53 | Doc/library/urllib.parse.rst | 22 +++++- | ||
54 | Doc/whatsnew/3.6.rst | 13 ++++ | ||
55 | Doc/whatsnew/3.7.rst | 13 ++++ | ||
56 | Doc/whatsnew/3.8.rst | 13 ++++ | ||
57 | Lib/cgi.py | 23 ++++--- | ||
58 | Lib/test/test_cgi.py | 29 ++++++-- | ||
59 | Lib/test/test_urlparse.py | 68 +++++++++++++------ | ||
60 | Lib/urllib/parse.py | 19 ++++-- | ||
61 | .../2021-02-14-15-59-16.bpo-42967.YApqDS.rst | 1 + | ||
62 | 10 files changed, 166 insertions(+), 46 deletions(-) | ||
63 | create mode 100644 Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst | ||
64 | |||
65 | diff --git a/Doc/library/cgi.rst b/Doc/library/cgi.rst | ||
66 | index 4048592e7361f..880074bed6026 100644 | ||
67 | --- a/Doc/library/cgi.rst | ||
68 | +++ b/Doc/library/cgi.rst | ||
69 | @@ -277,14 +277,16 @@ These are useful if you want more control, or if you want to employ some of the | ||
70 | algorithms implemented in this module in other circumstances. | ||
71 | |||
72 | |||
73 | -.. function:: parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False) | ||
74 | +.. function:: parse(fp=None, environ=os.environ, keep_blank_values=False, strict_parsing=False, separator="&") | ||
75 | |||
76 | Parse a query in the environment or from a file (the file defaults to | ||
77 | - ``sys.stdin``). The *keep_blank_values* and *strict_parsing* parameters are | ||
78 | + ``sys.stdin``). The *keep_blank_values*, *strict_parsing* and *separator* parameters are | ||
79 | passed to :func:`urllib.parse.parse_qs` unchanged. | ||
80 | |||
81 | + .. versionchanged:: 3.8.8 | ||
82 | + Added the *separator* parameter. | ||
83 | |||
84 | -.. function:: parse_multipart(fp, pdict, encoding="utf-8", errors="replace") | ||
85 | +.. function:: parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator="&") | ||
86 | |||
87 | Parse input of type :mimetype:`multipart/form-data` (for file uploads). | ||
88 | Arguments are *fp* for the input file, *pdict* for a dictionary containing | ||
89 | @@ -303,6 +305,9 @@ algorithms implemented in this module in other circumstances. | ||
90 | Added the *encoding* and *errors* parameters. For non-file fields, the | ||
91 | value is now a list of strings, not bytes. | ||
92 | |||
93 | + .. versionchanged:: 3.8.8 | ||
94 | + Added the *separator* parameter. | ||
95 | + | ||
96 | |||
97 | .. function:: parse_header(string) | ||
98 | |||
99 | diff --git a/Doc/library/urllib.parse.rst b/Doc/library/urllib.parse.rst | ||
100 | index 25e5cc1a6ce0b..fcad7076e6c77 100644 | ||
101 | --- a/Doc/library/urllib.parse.rst | ||
102 | +++ b/Doc/library/urllib.parse.rst | ||
103 | @@ -165,7 +165,7 @@ or on combining URL components into a URL string. | ||
104 | now raise :exc:`ValueError`. | ||
105 | |||
106 | |||
107 | -.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None) | ||
108 | +.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&') | ||
109 | |||
110 | Parse a query string given as a string argument (data of type | ||
111 | :mimetype:`application/x-www-form-urlencoded`). Data are returned as a | ||
112 | @@ -190,6 +190,9 @@ or on combining URL components into a URL string. | ||
113 | read. If set, then throws a :exc:`ValueError` if there are more than | ||
114 | *max_num_fields* fields read. | ||
115 | |||
116 | + The optional argument *separator* is the symbol to use for separating the | ||
117 | + query arguments. It defaults to ``&``. | ||
118 | + | ||
119 | Use the :func:`urllib.parse.urlencode` function (with the ``doseq`` | ||
120 | parameter set to ``True``) to convert such dictionaries into query | ||
121 | strings. | ||
122 | @@ -201,8 +204,14 @@ or on combining URL components into a URL string. | ||
123 | .. versionchanged:: 3.8 | ||
124 | Added *max_num_fields* parameter. | ||
125 | |||
126 | + .. versionchanged:: 3.8.8 | ||
127 | + Added *separator* parameter with the default value of ``&``. Python | ||
128 | + versions earlier than Python 3.8.8 allowed using both ``;`` and ``&`` as | ||
129 | + query parameter separator. This has been changed to allow only a single | ||
130 | + separator key, with ``&`` as the default separator. | ||
131 | + | ||
132 | |||
133 | -.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None) | ||
134 | +.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None, separator='&') | ||
135 | |||
136 | Parse a query string given as a string argument (data of type | ||
137 | :mimetype:`application/x-www-form-urlencoded`). Data are returned as a list of | ||
138 | @@ -226,6 +235,9 @@ or on combining URL components into a URL string. | ||
139 | read. If set, then throws a :exc:`ValueError` if there are more than | ||
140 | *max_num_fields* fields read. | ||
141 | |||
142 | + The optional argument *separator* is the symbol to use for separating the | ||
143 | + query arguments. It defaults to ``&``. | ||
144 | + | ||
145 | Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into | ||
146 | query strings. | ||
147 | |||
148 | @@ -235,6 +247,12 @@ or on combining URL components into a URL string. | ||
149 | .. versionchanged:: 3.8 | ||
150 | Added *max_num_fields* parameter. | ||
151 | |||
152 | + .. versionchanged:: 3.8.8 | ||
153 | + Added *separator* parameter with the default value of ``&``. Python | ||
154 | + versions earlier than Python 3.8.8 allowed using both ``;`` and ``&`` as | ||
155 | + query parameter separator. This has been changed to allow only a single | ||
156 | + separator key, with ``&`` as the default separator. | ||
157 | + | ||
158 | |||
159 | .. function:: urlunparse(parts) | ||
160 | |||
161 | diff --git a/Doc/whatsnew/3.6.rst b/Doc/whatsnew/3.6.rst | ||
162 | index 85a6657fdfbda..03a877a3d9178 100644 | ||
163 | --- a/Doc/whatsnew/3.6.rst | ||
164 | +++ b/Doc/whatsnew/3.6.rst | ||
165 | @@ -2443,3 +2443,16 @@ because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more | ||
166 | details, see the documentation for ``loop.create_datagram_endpoint()``. | ||
167 | (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in | ||
168 | :issue:`37228`.) | ||
169 | + | ||
170 | +Notable changes in Python 3.6.13 | ||
171 | +================================ | ||
172 | + | ||
173 | +Earlier Python versions allowed using both ``;`` and ``&`` as | ||
174 | +query parameter separators in :func:`urllib.parse.parse_qs` and | ||
175 | +:func:`urllib.parse.parse_qsl`. Due to security concerns, and to conform with | ||
176 | +newer W3C recommendations, this has been changed to allow only a single | ||
177 | +separator key, with ``&`` as the default. This change also affects | ||
178 | +:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected | ||
179 | +functions internally. For more details, please see their respective | ||
180 | +documentation. | ||
181 | +(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.) | ||
182 | diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst | ||
183 | index 4933cba3990b1..824dc13e0c6fd 100644 | ||
184 | --- a/Doc/whatsnew/3.7.rst | ||
185 | +++ b/Doc/whatsnew/3.7.rst | ||
186 | @@ -2556,3 +2556,16 @@ because of the behavior of the socket option ``SO_REUSEADDR`` in UDP. For more | ||
187 | details, see the documentation for ``loop.create_datagram_endpoint()``. | ||
188 | (Contributed by Kyle Stanley, Antoine Pitrou, and Yury Selivanov in | ||
189 | :issue:`37228`.) | ||
190 | + | ||
191 | +Notable changes in Python 3.7.10 | ||
192 | +================================ | ||
193 | + | ||
194 | +Earlier Python versions allowed using both ``;`` and ``&`` as | ||
195 | +query parameter separators in :func:`urllib.parse.parse_qs` and | ||
196 | +:func:`urllib.parse.parse_qsl`. Due to security concerns, and to conform with | ||
197 | +newer W3C recommendations, this has been changed to allow only a single | ||
198 | +separator key, with ``&`` as the default. This change also affects | ||
199 | +:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected | ||
200 | +functions internally. For more details, please see their respective | ||
201 | +documentation. | ||
202 | +(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.) | ||
203 | diff --git a/Doc/whatsnew/3.8.rst b/Doc/whatsnew/3.8.rst | ||
204 | index 1a192800b2f02..632ccc1f2c40a 100644 | ||
205 | --- a/Doc/whatsnew/3.8.rst | ||
206 | +++ b/Doc/whatsnew/3.8.rst | ||
207 | @@ -2251,3 +2251,16 @@ The constant values of future flags in the :mod:`__future__` module | ||
208 | are updated in order to prevent collision with compiler flags. Previously | ||
209 | ``PyCF_ALLOW_TOP_LEVEL_AWAIT`` was clashing with ``CO_FUTURE_DIVISION``. | ||
210 | (Contributed by Batuhan Taskaya in :issue:`39562`) | ||
211 | + | ||
212 | +Notable changes in Python 3.8.8 | ||
213 | +=============================== | ||
214 | + | ||
215 | +Earlier Python versions allowed using both ``;`` and ``&`` as | ||
216 | +query parameter separators in :func:`urllib.parse.parse_qs` and | ||
217 | +:func:`urllib.parse.parse_qsl`. Due to security concerns, and to conform with | ||
218 | +newer W3C recommendations, this has been changed to allow only a single | ||
219 | +separator key, with ``&`` as the default. This change also affects | ||
220 | +:func:`cgi.parse` and :func:`cgi.parse_multipart` as they use the affected | ||
221 | +functions internally. For more details, please see their respective | ||
222 | +documentation. | ||
223 | +(Contributed by Adam Goldschmidt, Senthil Kumaran and Ken Jin in :issue:`42967`.) | ||
224 | diff --git a/Lib/cgi.py b/Lib/cgi.py | ||
225 | index 77ab703cc0360..1e880e51848af 100755 | ||
226 | --- a/Lib/cgi.py | ||
227 | +++ b/Lib/cgi.py | ||
228 | @@ -115,7 +115,8 @@ def closelog(): | ||
229 | # 0 ==> unlimited input | ||
230 | maxlen = 0 | ||
231 | |||
232 | -def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0): | ||
233 | +def parse(fp=None, environ=os.environ, keep_blank_values=0, | ||
234 | + strict_parsing=0, separator='&'): | ||
235 | """Parse a query in the environment or from a file (default stdin) | ||
236 | |||
237 | Arguments, all optional: | ||
238 | @@ -134,6 +135,9 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0): | ||
239 | strict_parsing: flag indicating what to do with parsing errors. | ||
240 | If false (the default), errors are silently ignored. | ||
241 | If true, errors raise a ValueError exception. | ||
242 | + | ||
243 | + separator: str. The symbol to use for separating the query arguments. | ||
244 | + Defaults to &. | ||
245 | """ | ||
246 | if fp is None: | ||
247 | fp = sys.stdin | ||
248 | @@ -154,7 +158,7 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0): | ||
249 | if environ['REQUEST_METHOD'] == 'POST': | ||
250 | ctype, pdict = parse_header(environ['CONTENT_TYPE']) | ||
251 | if ctype == 'multipart/form-data': | ||
252 | - return parse_multipart(fp, pdict) | ||
253 | + return parse_multipart(fp, pdict, separator=separator) | ||
254 | elif ctype == 'application/x-www-form-urlencoded': | ||
255 | clength = int(environ['CONTENT_LENGTH']) | ||
256 | if maxlen and clength > maxlen: | ||
257 | @@ -178,10 +182,10 @@ def parse(fp=None, environ=os.environ, keep_blank_values=0, strict_parsing=0): | ||
258 | qs = "" | ||
259 | environ['QUERY_STRING'] = qs # XXX Shouldn't, really | ||
260 | return urllib.parse.parse_qs(qs, keep_blank_values, strict_parsing, | ||
261 | - encoding=encoding) | ||
262 | + encoding=encoding, separator=separator) | ||
263 | |||
264 | |||
265 | -def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"): | ||
266 | +def parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator='&'): | ||
267 | """Parse multipart input. | ||
268 | |||
269 | Arguments: | ||
270 | @@ -205,7 +209,7 @@ def parse_multipart(fp, pdict, encoding="utf-8", errors="replace"): | ||
271 | except KeyError: | ||
272 | pass | ||
273 | fs = FieldStorage(fp, headers=headers, encoding=encoding, errors=errors, | ||
274 | - environ={'REQUEST_METHOD': 'POST'}) | ||
275 | + environ={'REQUEST_METHOD': 'POST'}, separator=separator) | ||
276 | return {k: fs.getlist(k) for k in fs} | ||
277 | |||
278 | def _parseparam(s): | ||
279 | @@ -315,7 +319,7 @@ class FieldStorage: | ||
280 | def __init__(self, fp=None, headers=None, outerboundary=b'', | ||
281 | environ=os.environ, keep_blank_values=0, strict_parsing=0, | ||
282 | limit=None, encoding='utf-8', errors='replace', | ||
283 | - max_num_fields=None): | ||
284 | + max_num_fields=None, separator='&'): | ||
285 | """Constructor. Read multipart/* until last part. | ||
286 | |||
287 | Arguments, all optional: | ||
288 | @@ -363,6 +367,7 @@ def __init__(self, fp=None, headers=None, outerboundary=b'', | ||
289 | self.keep_blank_values = keep_blank_values | ||
290 | self.strict_parsing = strict_parsing | ||
291 | self.max_num_fields = max_num_fields | ||
292 | + self.separator = separator | ||
293 | if 'REQUEST_METHOD' in environ: | ||
294 | method = environ['REQUEST_METHOD'].upper() | ||
295 | self.qs_on_post = None | ||
296 | @@ -589,7 +594,7 @@ def read_urlencoded(self): | ||
297 | query = urllib.parse.parse_qsl( | ||
298 | qs, self.keep_blank_values, self.strict_parsing, | ||
299 | encoding=self.encoding, errors=self.errors, | ||
300 | - max_num_fields=self.max_num_fields) | ||
301 | + max_num_fields=self.max_num_fields, separator=self.separator) | ||
302 | self.list = [MiniFieldStorage(key, value) for key, value in query] | ||
303 | self.skip_lines() | ||
304 | |||
305 | @@ -605,7 +610,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing): | ||
306 | query = urllib.parse.parse_qsl( | ||
307 | self.qs_on_post, self.keep_blank_values, self.strict_parsing, | ||
308 | encoding=self.encoding, errors=self.errors, | ||
309 | - max_num_fields=self.max_num_fields) | ||
310 | + max_num_fields=self.max_num_fields, separator=self.separator) | ||
311 | self.list.extend(MiniFieldStorage(key, value) for key, value in query) | ||
312 | |||
313 | klass = self.FieldStorageClass or self.__class__ | ||
314 | @@ -649,7 +654,7 @@ def read_multi(self, environ, keep_blank_values, strict_parsing): | ||
315 | else self.limit - self.bytes_read | ||
316 | part = klass(self.fp, headers, ib, environ, keep_blank_values, | ||
317 | strict_parsing, limit, | ||
318 | - self.encoding, self.errors, max_num_fields) | ||
319 | + self.encoding, self.errors, max_num_fields, self.separator) | ||
320 | |||
321 | if max_num_fields is not None: | ||
322 | max_num_fields -= 1 | ||
323 | diff --git a/Lib/test/test_cgi.py b/Lib/test/test_cgi.py | ||
324 | index 101942de947fb..4e1506a6468b9 100644 | ||
325 | --- a/Lib/test/test_cgi.py | ||
326 | +++ b/Lib/test/test_cgi.py | ||
327 | @@ -53,12 +53,9 @@ def do_test(buf, method): | ||
328 | ("", ValueError("bad query field: ''")), | ||
329 | ("&", ValueError("bad query field: ''")), | ||
330 | ("&&", ValueError("bad query field: ''")), | ||
331 | - (";", ValueError("bad query field: ''")), | ||
332 | - (";&;", ValueError("bad query field: ''")), | ||
333 | # Should the next few really be valid? | ||
334 | ("=", {}), | ||
335 | ("=&=", {}), | ||
336 | - ("=;=", {}), | ||
337 | # This rest seem to make sense | ||
338 | ("=a", {'': ['a']}), | ||
339 | ("&=a", ValueError("bad query field: ''")), | ||
340 | @@ -73,8 +70,6 @@ def do_test(buf, method): | ||
341 | ("a=a+b&b=b+c", {'a': ['a b'], 'b': ['b c']}), | ||
342 | ("a=a+b&a=b+a", {'a': ['a b', 'b a']}), | ||
343 | ("x=1&y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), | ||
344 | - ("x=1;y=2.0&z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), | ||
345 | - ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), | ||
346 | ("Hbc5161168c542333633315dee1182227:key_store_seqid=400006&cuyer=r&view=bustomer&order_id=0bb2e248638833d48cb7fed300000f1b&expire=964546263&lobale=en-US&kid=130003.300038&ss=env", | ||
347 | {'Hbc5161168c542333633315dee1182227:key_store_seqid': ['400006'], | ||
348 | 'cuyer': ['r'], | ||
349 | @@ -201,6 +196,30 @@ def test_strict(self): | ||
350 | else: | ||
351 | self.assertEqual(fs.getvalue(key), expect_val[0]) | ||
352 | |||
353 | + def test_separator(self): | ||
354 | + parse_semicolon = [ | ||
355 | + ("x=1;y=2.0", {'x': ['1'], 'y': ['2.0']}), | ||
356 | + ("x=1;y=2.0;z=2-3.%2b0", {'x': ['1'], 'y': ['2.0'], 'z': ['2-3.+0']}), | ||
357 | + (";", ValueError("bad query field: ''")), | ||
358 | + (";;", ValueError("bad query field: ''")), | ||
359 | + ("=;a", ValueError("bad query field: 'a'")), | ||
360 | + (";b=a", ValueError("bad query field: ''")), | ||
361 | + ("b;=a", ValueError("bad query field: 'b'")), | ||
362 | + ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}), | ||
363 | + ("a=a+b;a=b+a", {'a': ['a b', 'b a']}), | ||
364 | + ] | ||
365 | + for orig, expect in parse_semicolon: | ||
366 | + env = {'QUERY_STRING': orig} | ||
367 | + fs = cgi.FieldStorage(separator=';', environ=env) | ||
368 | + if isinstance(expect, dict): | ||
369 | + for key in expect.keys(): | ||
370 | + expect_val = expect[key] | ||
371 | + self.assertIn(key, fs) | ||
372 | + if len(expect_val) > 1: | ||
373 | + self.assertEqual(fs.getvalue(key), expect_val) | ||
374 | + else: | ||
375 | + self.assertEqual(fs.getvalue(key), expect_val[0]) | ||
376 | + | ||
377 | def test_log(self): | ||
378 | cgi.log("Testing") | ||
379 | |||
380 | diff --git a/Lib/test/test_urlparse.py b/Lib/test/test_urlparse.py | ||
381 | index 4ae6ed33858ce..90c8d6922629e 100644 | ||
382 | --- a/Lib/test/test_urlparse.py | ||
383 | +++ b/Lib/test/test_urlparse.py | ||
384 | @@ -32,16 +32,10 @@ | ||
385 | (b"&a=b", [(b'a', b'b')]), | ||
386 | (b"a=a+b&b=b+c", [(b'a', b'a b'), (b'b', b'b c')]), | ||
387 | (b"a=1&a=2", [(b'a', b'1'), (b'a', b'2')]), | ||
388 | - (";", []), | ||
389 | - (";;", []), | ||
390 | - (";a=b", [('a', 'b')]), | ||
391 | - ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]), | ||
392 | - ("a=1;a=2", [('a', '1'), ('a', '2')]), | ||
393 | - (b";", []), | ||
394 | - (b";;", []), | ||
395 | - (b";a=b", [(b'a', b'b')]), | ||
396 | - (b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]), | ||
397 | - (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]), | ||
398 | + (";a=b", [(';a', 'b')]), | ||
399 | + ("a=a+b;b=b+c", [('a', 'a b;b=b c')]), | ||
400 | + (b";a=b", [(b';a', b'b')]), | ||
401 | + (b"a=a+b;b=b+c", [(b'a', b'a b;b=b c')]), | ||
402 | ] | ||
403 | |||
404 | # Each parse_qs testcase is a two-tuple that contains | ||
405 | @@ -68,16 +62,10 @@ | ||
406 | (b"&a=b", {b'a': [b'b']}), | ||
407 | (b"a=a+b&b=b+c", {b'a': [b'a b'], b'b': [b'b c']}), | ||
408 | (b"a=1&a=2", {b'a': [b'1', b'2']}), | ||
409 | - (";", {}), | ||
410 | - (";;", {}), | ||
411 | - (";a=b", {'a': ['b']}), | ||
412 | - ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}), | ||
413 | - ("a=1;a=2", {'a': ['1', '2']}), | ||
414 | - (b";", {}), | ||
415 | - (b";;", {}), | ||
416 | - (b";a=b", {b'a': [b'b']}), | ||
417 | - (b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}), | ||
418 | - (b"a=1;a=2", {b'a': [b'1', b'2']}), | ||
419 | + (";a=b", {';a': ['b']}), | ||
420 | + ("a=a+b;b=b+c", {'a': ['a b;b=b c']}), | ||
421 | + (b";a=b", {b';a': [b'b']}), | ||
422 | + (b"a=a+b;b=b+c", {b'a':[ b'a b;b=b c']}), | ||
423 | ] | ||
424 | |||
425 | class UrlParseTestCase(unittest.TestCase): | ||
426 | @@ -884,10 +872,46 @@ def test_parse_qsl_encoding(self): | ||
427 | def test_parse_qsl_max_num_fields(self): | ||
428 | with self.assertRaises(ValueError): | ||
429 | urllib.parse.parse_qs('&'.join(['a=a']*11), max_num_fields=10) | ||
430 | - with self.assertRaises(ValueError): | ||
431 | - urllib.parse.parse_qs(';'.join(['a=a']*11), max_num_fields=10) | ||
432 | urllib.parse.parse_qs('&'.join(['a=a']*10), max_num_fields=10) | ||
433 | |||
434 | + def test_parse_qs_separator(self): | ||
435 | + parse_qs_semicolon_cases = [ | ||
436 | + (";", {}), | ||
437 | + (";;", {}), | ||
438 | + (";a=b", {'a': ['b']}), | ||
439 | + ("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}), | ||
440 | + ("a=1;a=2", {'a': ['1', '2']}), | ||
441 | + (b";", {}), | ||
442 | + (b";;", {}), | ||
443 | + (b";a=b", {b'a': [b'b']}), | ||
444 | + (b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}), | ||
445 | + (b"a=1;a=2", {b'a': [b'1', b'2']}), | ||
446 | + ] | ||
447 | + for orig, expect in parse_qs_semicolon_cases: | ||
448 | + with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"): | ||
449 | + result = urllib.parse.parse_qs(orig, separator=';') | ||
450 | + self.assertEqual(result, expect, "Error parsing %r" % orig) | ||
451 | + | ||
452 | + | ||
453 | + def test_parse_qsl_separator(self): | ||
454 | + parse_qsl_semicolon_cases = [ | ||
455 | + (";", []), | ||
456 | + (";;", []), | ||
457 | + (";a=b", [('a', 'b')]), | ||
458 | + ("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]), | ||
459 | + ("a=1;a=2", [('a', '1'), ('a', '2')]), | ||
460 | + (b";", []), | ||
461 | + (b";;", []), | ||
462 | + (b";a=b", [(b'a', b'b')]), | ||
463 | + (b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]), | ||
464 | + (b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]), | ||
465 | + ] | ||
466 | + for orig, expect in parse_qsl_semicolon_cases: | ||
467 | + with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"): | ||
468 | + result = urllib.parse.parse_qsl(orig, separator=';') | ||
469 | + self.assertEqual(result, expect, "Error parsing %r" % orig) | ||
470 | + | ||
471 | + | ||
472 | def test_urlencode_sequences(self): | ||
473 | # Other tests incidentally urlencode things; test non-covered cases: | ||
474 | # Sequence and object values. | ||
475 | diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py | ||
476 | index 95be7181133b4..0c1c94f5fc986 100644 | ||
477 | --- a/Lib/urllib/parse.py | ||
478 | +++ b/Lib/urllib/parse.py | ||
479 | @@ -650,7 +650,7 @@ def unquote(string, encoding='utf-8', errors='replace'): | ||
480 | |||
481 | |||
482 | def parse_qs(qs, keep_blank_values=False, strict_parsing=False, | ||
483 | - encoding='utf-8', errors='replace', max_num_fields=None): | ||
484 | + encoding='utf-8', errors='replace', max_num_fields=None, separator='&'): | ||
485 | """Parse a query given as a string argument. | ||
486 | |||
487 | Arguments: | ||
488 | @@ -674,12 +674,15 @@ def parse_qs(qs, keep_blank_values=False, strict_parsing=False, | ||
489 | max_num_fields: int. If set, then throws a ValueError if there | ||
490 | are more than n fields read by parse_qsl(). | ||
491 | |||
492 | + separator: str. The symbol to use for separating the query arguments. | ||
493 | + Defaults to &. | ||
494 | + | ||
495 | Returns a dictionary. | ||
496 | """ | ||
497 | parsed_result = {} | ||
498 | pairs = parse_qsl(qs, keep_blank_values, strict_parsing, | ||
499 | encoding=encoding, errors=errors, | ||
500 | - max_num_fields=max_num_fields) | ||
501 | + max_num_fields=max_num_fields, separator=separator) | ||
502 | for name, value in pairs: | ||
503 | if name in parsed_result: | ||
504 | parsed_result[name].append(value) | ||
505 | @@ -689,7 +692,7 @@ def parse_qs(qs, keep_blank_values=False, strict_parsing=False, | ||
506 | |||
507 | |||
508 | def parse_qsl(qs, keep_blank_values=False, strict_parsing=False, | ||
509 | - encoding='utf-8', errors='replace', max_num_fields=None): | ||
510 | + encoding='utf-8', errors='replace', max_num_fields=None, separator='&'): | ||
511 | """Parse a query given as a string argument. | ||
512 | |||
513 | Arguments: | ||
514 | @@ -712,19 +715,25 @@ def parse_qsl(qs, keep_blank_values=False, strict_parsing=False, | ||
515 | max_num_fields: int. If set, then throws a ValueError | ||
516 | if there are more than n fields read by parse_qsl(). | ||
517 | |||
518 | + separator: str. The symbol to use for separating the query arguments. | ||
519 | + Defaults to &. | ||
520 | + | ||
521 | Returns a list, as G-d intended. | ||
522 | """ | ||
523 | qs, _coerce_result = _coerce_args(qs) | ||
524 | |||
525 | + if not separator or (not isinstance(separator, (str, bytes))): | ||
526 | + raise ValueError("Separator must be of type string or bytes.") | ||
527 | + | ||
528 | # If max_num_fields is defined then check that the number of fields | ||
529 | # is less than max_num_fields. This prevents a memory exhaustion DOS | ||
530 | # attack via post bodies with many fields. | ||
531 | if max_num_fields is not None: | ||
532 | - num_fields = 1 + qs.count('&') + qs.count(';') | ||
533 | + num_fields = 1 + qs.count(separator) | ||
534 | if max_num_fields < num_fields: | ||
535 | raise ValueError('Max number of fields exceeded') | ||
536 | |||
537 | - pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')] | ||
538 | + pairs = [s1 for s1 in qs.split(separator)] | ||
539 | r = [] | ||
540 | for name_value in pairs: | ||
541 | if not name_value and not strict_parsing: | ||
542 | diff --git a/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst b/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst | ||
543 | new file mode 100644 | ||
544 | index 0000000000000..f08489b41494e | ||
545 | --- /dev/null | ||
546 | +++ b/Misc/NEWS.d/next/Security/2021-02-14-15-59-16.bpo-42967.YApqDS.rst | ||
547 | @@ -0,0 +1 @@ | ||
548 | +Fix web cache poisoning vulnerability by defaulting the query args separator to ``&``, and allowing the user to choose a custom separator. | ||
diff --git a/meta/recipes-devtools/python/python3/CVE-2021-3177.patch b/meta/recipes-devtools/python/python3/CVE-2021-3177.patch new file mode 100644 index 0000000000..43d678db46 --- /dev/null +++ b/meta/recipes-devtools/python/python3/CVE-2021-3177.patch | |||
@@ -0,0 +1,191 @@ | |||
1 | From ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f Mon Sep 17 00:00:00 2001 | ||
2 | From: "Miss Islington (bot)" | ||
3 | <31488909+miss-islington@users.noreply.github.com> | ||
4 | Date: Mon, 18 Jan 2021 13:28:52 -0800 | ||
5 | Subject: [PATCH] closes bpo-42938: Replace snprintf with Python unicode | ||
6 | formatting in ctypes param reprs. (GH-24248) | ||
7 | |||
8 | (cherry picked from commit 916610ef90a0d0761f08747f7b0905541f0977c7) | ||
9 | |||
10 | Co-authored-by: Benjamin Peterson <benjamin@python.org> | ||
11 | |||
12 | Co-authored-by: Benjamin Peterson <benjamin@python.org> | ||
13 | |||
14 | CVE: CVE-2021-3177 | ||
15 | Upstream-Status: Backport [https://github.com/python/cpython/commit/ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f] | ||
16 | Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> | ||
17 | --- | ||
18 | Lib/ctypes/test/test_parameters.py | 43 ++++++++++++++++ | ||
19 | .../2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | 2 + | ||
20 | Modules/_ctypes/callproc.c | 51 +++++++------------ | ||
21 | 3 files changed, 64 insertions(+), 32 deletions(-) | ||
22 | create mode 100644 Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | ||
23 | |||
24 | diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py | ||
25 | index e4c25fd880cef..531894fdec838 100644 | ||
26 | --- a/Lib/ctypes/test/test_parameters.py | ||
27 | +++ b/Lib/ctypes/test/test_parameters.py | ||
28 | @@ -201,6 +201,49 @@ def __dict__(self): | ||
29 | with self.assertRaises(ZeroDivisionError): | ||
30 | WorseStruct().__setstate__({}, b'foo') | ||
31 | |||
32 | + def test_parameter_repr(self): | ||
33 | + from ctypes import ( | ||
34 | + c_bool, | ||
35 | + c_char, | ||
36 | + c_wchar, | ||
37 | + c_byte, | ||
38 | + c_ubyte, | ||
39 | + c_short, | ||
40 | + c_ushort, | ||
41 | + c_int, | ||
42 | + c_uint, | ||
43 | + c_long, | ||
44 | + c_ulong, | ||
45 | + c_longlong, | ||
46 | + c_ulonglong, | ||
47 | + c_float, | ||
48 | + c_double, | ||
49 | + c_longdouble, | ||
50 | + c_char_p, | ||
51 | + c_wchar_p, | ||
52 | + c_void_p, | ||
53 | + ) | ||
54 | + self.assertRegex(repr(c_bool.from_param(True)), r"^<cparam '\?' at 0x[A-Fa-f0-9]+>$") | ||
55 | + self.assertEqual(repr(c_char.from_param(97)), "<cparam 'c' ('a')>") | ||
56 | + self.assertRegex(repr(c_wchar.from_param('a')), r"^<cparam 'u' at 0x[A-Fa-f0-9]+>$") | ||
57 | + self.assertEqual(repr(c_byte.from_param(98)), "<cparam 'b' (98)>") | ||
58 | + self.assertEqual(repr(c_ubyte.from_param(98)), "<cparam 'B' (98)>") | ||
59 | + self.assertEqual(repr(c_short.from_param(511)), "<cparam 'h' (511)>") | ||
60 | + self.assertEqual(repr(c_ushort.from_param(511)), "<cparam 'H' (511)>") | ||
61 | + self.assertRegex(repr(c_int.from_param(20000)), r"^<cparam '[li]' \(20000\)>$") | ||
62 | + self.assertRegex(repr(c_uint.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$") | ||
63 | + self.assertRegex(repr(c_long.from_param(20000)), r"^<cparam '[li]' \(20000\)>$") | ||
64 | + self.assertRegex(repr(c_ulong.from_param(20000)), r"^<cparam '[LI]' \(20000\)>$") | ||
65 | + self.assertRegex(repr(c_longlong.from_param(20000)), r"^<cparam '[liq]' \(20000\)>$") | ||
66 | + self.assertRegex(repr(c_ulonglong.from_param(20000)), r"^<cparam '[LIQ]' \(20000\)>$") | ||
67 | + self.assertEqual(repr(c_float.from_param(1.5)), "<cparam 'f' (1.5)>") | ||
68 | + self.assertEqual(repr(c_double.from_param(1.5)), "<cparam 'd' (1.5)>") | ||
69 | + self.assertEqual(repr(c_double.from_param(1e300)), "<cparam 'd' (1e+300)>") | ||
70 | + self.assertRegex(repr(c_longdouble.from_param(1.5)), r"^<cparam ('d' \(1.5\)|'g' at 0x[A-Fa-f0-9]+)>$") | ||
71 | + self.assertRegex(repr(c_char_p.from_param(b'hihi')), "^<cparam 'z' \(0x[A-Fa-f0-9]+\)>$") | ||
72 | + self.assertRegex(repr(c_wchar_p.from_param('hihi')), "^<cparam 'Z' \(0x[A-Fa-f0-9]+\)>$") | ||
73 | + self.assertRegex(repr(c_void_p.from_param(0x12)), r"^<cparam 'P' \(0x0*12\)>$") | ||
74 | + | ||
75 | ################################################################ | ||
76 | |||
77 | if __name__ == '__main__': | ||
78 | diff --git a/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | ||
79 | new file mode 100644 | ||
80 | index 0000000000000..7df65a156feab | ||
81 | --- /dev/null | ||
82 | +++ b/Misc/NEWS.d/next/Security/2021-01-18-09-27-31.bpo-42938.4Zn4Mp.rst | ||
83 | @@ -0,0 +1,2 @@ | ||
84 | +Avoid static buffers when computing the repr of :class:`ctypes.c_double` and | ||
85 | +:class:`ctypes.c_longdouble` values. | ||
86 | diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c | ||
87 | index a9b8675cd951b..de75918d49f37 100644 | ||
88 | --- a/Modules/_ctypes/callproc.c | ||
89 | +++ b/Modules/_ctypes/callproc.c | ||
90 | @@ -484,58 +484,47 @@ is_literal_char(unsigned char c) | ||
91 | static PyObject * | ||
92 | PyCArg_repr(PyCArgObject *self) | ||
93 | { | ||
94 | - char buffer[256]; | ||
95 | switch(self->tag) { | ||
96 | case 'b': | ||
97 | case 'B': | ||
98 | - sprintf(buffer, "<cparam '%c' (%d)>", | ||
99 | + return PyUnicode_FromFormat("<cparam '%c' (%d)>", | ||
100 | self->tag, self->value.b); | ||
101 | - break; | ||
102 | case 'h': | ||
103 | case 'H': | ||
104 | - sprintf(buffer, "<cparam '%c' (%d)>", | ||
105 | + return PyUnicode_FromFormat("<cparam '%c' (%d)>", | ||
106 | self->tag, self->value.h); | ||
107 | - break; | ||
108 | case 'i': | ||
109 | case 'I': | ||
110 | - sprintf(buffer, "<cparam '%c' (%d)>", | ||
111 | + return PyUnicode_FromFormat("<cparam '%c' (%d)>", | ||
112 | self->tag, self->value.i); | ||
113 | - break; | ||
114 | case 'l': | ||
115 | case 'L': | ||
116 | - sprintf(buffer, "<cparam '%c' (%ld)>", | ||
117 | + return PyUnicode_FromFormat("<cparam '%c' (%ld)>", | ||
118 | self->tag, self->value.l); | ||
119 | - break; | ||
120 | |||
121 | case 'q': | ||
122 | case 'Q': | ||
123 | - sprintf(buffer, | ||
124 | -#ifdef MS_WIN32 | ||
125 | - "<cparam '%c' (%I64d)>", | ||
126 | -#else | ||
127 | - "<cparam '%c' (%lld)>", | ||
128 | -#endif | ||
129 | + return PyUnicode_FromFormat("<cparam '%c' (%lld)>", | ||
130 | self->tag, self->value.q); | ||
131 | - break; | ||
132 | case 'd': | ||
133 | - sprintf(buffer, "<cparam '%c' (%f)>", | ||
134 | - self->tag, self->value.d); | ||
135 | - break; | ||
136 | - case 'f': | ||
137 | - sprintf(buffer, "<cparam '%c' (%f)>", | ||
138 | - self->tag, self->value.f); | ||
139 | - break; | ||
140 | - | ||
141 | + case 'f': { | ||
142 | + PyObject *f = PyFloat_FromDouble((self->tag == 'f') ? self->value.f : self->value.d); | ||
143 | + if (f == NULL) { | ||
144 | + return NULL; | ||
145 | + } | ||
146 | + PyObject *result = PyUnicode_FromFormat("<cparam '%c' (%R)>", self->tag, f); | ||
147 | + Py_DECREF(f); | ||
148 | + return result; | ||
149 | + } | ||
150 | case 'c': | ||
151 | if (is_literal_char((unsigned char)self->value.c)) { | ||
152 | - sprintf(buffer, "<cparam '%c' ('%c')>", | ||
153 | + return PyUnicode_FromFormat("<cparam '%c' ('%c')>", | ||
154 | self->tag, self->value.c); | ||
155 | } | ||
156 | else { | ||
157 | - sprintf(buffer, "<cparam '%c' ('\\x%02x')>", | ||
158 | + return PyUnicode_FromFormat("<cparam '%c' ('\\x%02x')>", | ||
159 | self->tag, (unsigned char)self->value.c); | ||
160 | } | ||
161 | - break; | ||
162 | |||
163 | /* Hm, are these 'z' and 'Z' codes useful at all? | ||
164 | Shouldn't they be replaced by the functionality of c_string | ||
165 | @@ -544,22 +533,20 @@ PyCArg_repr(PyCArgObject *self) | ||
166 | case 'z': | ||
167 | case 'Z': | ||
168 | case 'P': | ||
169 | - sprintf(buffer, "<cparam '%c' (%p)>", | ||
170 | + return PyUnicode_FromFormat("<cparam '%c' (%p)>", | ||
171 | self->tag, self->value.p); | ||
172 | break; | ||
173 | |||
174 | default: | ||
175 | if (is_literal_char((unsigned char)self->tag)) { | ||
176 | - sprintf(buffer, "<cparam '%c' at %p>", | ||
177 | + return PyUnicode_FromFormat("<cparam '%c' at %p>", | ||
178 | (unsigned char)self->tag, (void *)self); | ||
179 | } | ||
180 | else { | ||
181 | - sprintf(buffer, "<cparam 0x%02x at %p>", | ||
182 | + return PyUnicode_FromFormat("<cparam 0x%02x at %p>", | ||
183 | (unsigned char)self->tag, (void *)self); | ||
184 | } | ||
185 | - break; | ||
186 | } | ||
187 | - return PyUnicode_FromString(buffer); | ||
188 | } | ||
189 | |||
190 | static PyMemberDef PyCArgType_members[] = { | ||
191 | |||
diff --git a/meta/recipes-devtools/python/python3_3.8.5.bb b/meta/recipes-devtools/python/python3_3.8.5.bb index 3720b364bb..418d35acfe 100644 --- a/meta/recipes-devtools/python/python3_3.8.5.bb +++ b/meta/recipes-devtools/python/python3_3.8.5.bb | |||
@@ -33,6 +33,8 @@ SRC_URI = "http://www.python.org/ftp/python/${PV}/Python-${PV}.tar.xz \ | |||
33 | file://0001-python3-Do-not-hardcode-lib-for-distutils.patch \ | 33 | file://0001-python3-Do-not-hardcode-lib-for-distutils.patch \ |
34 | file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ | 34 | file://0020-configure.ac-setup.py-do-not-add-a-curses-include-pa.patch \ |
35 | file://CVE-2020-27619.patch \ | 35 | file://CVE-2020-27619.patch \ |
36 | file://CVE-2021-3177.patch \ | ||
37 | file://CVE-2021-23336.patch \ | ||
36 | " | 38 | " |
37 | 39 | ||
38 | SRC_URI_append_class-native = " \ | 40 | SRC_URI_append_class-native = " \ |
@@ -50,6 +52,8 @@ UPSTREAM_CHECK_URI = "https://www.python.org/downloads/source/" | |||
50 | 52 | ||
51 | CVE_PRODUCT = "python" | 53 | CVE_PRODUCT = "python" |
52 | 54 | ||
55 | # Upstream consider this expected behaviour | ||
56 | CVE_CHECK_WHITELIST += "CVE-2007-4559" | ||
53 | # This is not exploitable when glibc has CVE-2016-10739 fixed. | 57 | # This is not exploitable when glibc has CVE-2016-10739 fixed. |
54 | CVE_CHECK_WHITELIST += "CVE-2019-18348" | 58 | CVE_CHECK_WHITELIST += "CVE-2019-18348" |
55 | 59 | ||
@@ -166,6 +170,10 @@ do_install_append() { | |||
166 | } | 170 | } |
167 | 171 | ||
168 | do_install_append_class-nativesdk () { | 172 | do_install_append_class-nativesdk () { |
173 | # Make sure we use /usr/bin/env python | ||
174 | for PYTHSCRIPT in `grep -rIl ${bindir}/python ${D}${bindir}`; do | ||
175 | sed -i -e '1s|^#!.*|#!/usr/bin/env python3|' $PYTHSCRIPT | ||
176 | done | ||
169 | create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' | 177 | create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' |
170 | } | 178 | } |
171 | 179 | ||
@@ -304,11 +312,8 @@ do_create_manifest() { | |||
304 | } | 312 | } |
305 | 313 | ||
306 | # bitbake python -c create_manifest | 314 | # bitbake python -c create_manifest |
307 | addtask do_create_manifest | ||
308 | |||
309 | # Make sure we have native python ready when we create a new manifest | 315 | # Make sure we have native python ready when we create a new manifest |
310 | do_create_manifest[depends] += "${PN}:do_prepare_recipe_sysroot" | 316 | addtask do_create_manifest after do_patch do_prepare_recipe_sysroot |
311 | do_create_manifest[depends] += "${PN}:do_patch" | ||
312 | 317 | ||
313 | # manual dependency additions | 318 | # manual dependency additions |
314 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules" | 319 | RRECOMMENDS_${PN}-core_append_class-nativesdk = " nativesdk-python3-modules" |
@@ -361,3 +366,9 @@ RDEPENDS_${PN}-dev = "" | |||
361 | 366 | ||
362 | RDEPENDS_${PN}-tests_append_class-target = " ${MLPREFIX}bash" | 367 | RDEPENDS_${PN}-tests_append_class-target = " ${MLPREFIX}bash" |
363 | RDEPENDS_${PN}-tests_append_class-nativesdk = " ${MLPREFIX}bash" | 368 | RDEPENDS_${PN}-tests_append_class-nativesdk = " ${MLPREFIX}bash" |
369 | |||
370 | # Python's tests contain large numbers of files we don't need in the recipe sysroots | ||
371 | SYSROOT_PREPROCESS_FUNCS += " py3_sysroot_cleanup" | ||
372 | py3_sysroot_cleanup () { | ||
373 | rm -rf ${SYSROOT_DESTDIR}${libdir}/python${PYTHON_MAJMIN}/test | ||
374 | } | ||
diff --git a/meta/recipes-devtools/qemu/qemu.inc b/meta/recipes-devtools/qemu/qemu.inc index 84f600cec0..482ca3d6e5 100644 --- a/meta/recipes-devtools/qemu/qemu.inc +++ b/meta/recipes-devtools/qemu/qemu.inc | |||
@@ -32,6 +32,14 @@ SRC_URI = "https://download.qemu.org/${BPN}-${PV}.tar.xz \ | |||
32 | file://find_datadir.patch \ | 32 | file://find_datadir.patch \ |
33 | file://usb-fix-setup_len-init.patch \ | 33 | file://usb-fix-setup_len-init.patch \ |
34 | file://0001-target-mips-Increase-number-of-TLB-entries-on-the-34.patch \ | 34 | file://0001-target-mips-Increase-number-of-TLB-entries-on-the-34.patch \ |
35 | file://CVE-2020-24352.patch \ | ||
36 | file://CVE-2020-29129-CVE-2020-29130.patch \ | ||
37 | file://CVE-2020-25624.patch \ | ||
38 | file://CVE-2020-25723.patch \ | ||
39 | file://CVE-2020-28916.patch \ | ||
40 | file://CVE-2020-35517.patch \ | ||
41 | file://CVE-2020-29443.patch \ | ||
42 | file://CVE-2021-20203.patch \ | ||
35 | " | 43 | " |
36 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" | 44 | UPSTREAM_CHECK_REGEX = "qemu-(?P<pver>\d+(\.\d+)+)\.tar" |
37 | 45 | ||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch new file mode 100644 index 0000000000..861ff6c3b0 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-24352.patch | |||
@@ -0,0 +1,52 @@ | |||
1 | From ca1f9cbfdce4d63b10d57de80fef89a89d92a540 Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Wed, 21 Oct 2020 16:08:18 +0530 | ||
4 | Subject: [PATCH 1/1] ati: check x y display parameter values | ||
5 | |||
6 | The source and destination x,y display parameters in ati_2d_blt() | ||
7 | may run off the vga limits if either of s->regs.[src|dst]_[xy] is | ||
8 | zero. Check the parameter values to avoid potential crash. | ||
9 | |||
10 | Reported-by: Gaoning Pan <pgn@zju.edu.cn> | ||
11 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
12 | Message-id: 20201021103818.1704030-1-ppandit@redhat.com | ||
13 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
14 | |||
15 | Upstream-Status: Backport [ https://git.qemu.org/?p=qemu.git;a=commitdiff;h=ca1f9cbfdce4d63b10d57de80fef89a89d92a540;hp=2ddafce7f797082ad216657c830afd4546f16e37 ] | ||
16 | CVE: CVE-2020-24352 | ||
17 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
18 | --- | ||
19 | hw/display/ati_2d.c | 10 ++++++---- | ||
20 | 1 file changed, 6 insertions(+), 4 deletions(-) | ||
21 | |||
22 | diff --git a/hw/display/ati_2d.c b/hw/display/ati_2d.c | ||
23 | index 23a8ae0..4dc10ea 100644 | ||
24 | --- a/hw/display/ati_2d.c | ||
25 | +++ b/hw/display/ati_2d.c | ||
26 | @@ -75,8 +75,9 @@ void ati_2d_blt(ATIVGAState *s) | ||
27 | dst_stride *= bpp; | ||
28 | } | ||
29 | uint8_t *end = s->vga.vram_ptr + s->vga.vram_size; | ||
30 | - if (dst_bits >= end || dst_bits + dst_x + (dst_y + s->regs.dst_height) * | ||
31 | - dst_stride >= end) { | ||
32 | + if (dst_x > 0x3fff || dst_y > 0x3fff || dst_bits >= end | ||
33 | + || dst_bits + dst_x | ||
34 | + + (dst_y + s->regs.dst_height) * dst_stride >= end) { | ||
35 | qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); | ||
36 | return; | ||
37 | } | ||
38 | @@ -107,8 +108,9 @@ void ati_2d_blt(ATIVGAState *s) | ||
39 | src_bits += s->regs.crtc_offset & 0x07ffffff; | ||
40 | src_stride *= bpp; | ||
41 | } | ||
42 | - if (src_bits >= end || src_bits + src_x + | ||
43 | - (src_y + s->regs.dst_height) * src_stride >= end) { | ||
44 | + if (src_x > 0x3fff || src_y > 0x3fff || src_bits >= end | ||
45 | + || src_bits + src_x | ||
46 | + + (src_y + s->regs.dst_height) * src_stride >= end) { | ||
47 | qemu_log_mask(LOG_UNIMP, "blt outside vram not implemented\n"); | ||
48 | return; | ||
49 | } | ||
50 | -- | ||
51 | 1.8.3.1 | ||
52 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch new file mode 100644 index 0000000000..7631bab39f --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-25624.patch | |||
@@ -0,0 +1,101 @@ | |||
1 | From 1328fe0c32d5474604105b8105310e944976b058 Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Tue, 15 Sep 2020 23:52:58 +0530 | ||
4 | Subject: [PATCH] hw: usb: hcd-ohci: check len and frame_number variables | ||
5 | |||
6 | While servicing the OHCI transfer descriptors(TD), OHCI host | ||
7 | controller derives variables 'start_addr', 'end_addr', 'len' | ||
8 | etc. from values supplied by the host controller driver. | ||
9 | Host controller driver may supply values such that using | ||
10 | above variables leads to out-of-bounds access issues. | ||
11 | Add checks to avoid them. | ||
12 | |||
13 | AddressSanitizer: stack-buffer-overflow on address 0x7ffd53af76a0 | ||
14 | READ of size 2 at 0x7ffd53af76a0 thread T0 | ||
15 | #0 ohci_service_iso_td ../hw/usb/hcd-ohci.c:734 | ||
16 | #1 ohci_service_ed_list ../hw/usb/hcd-ohci.c:1180 | ||
17 | #2 ohci_process_lists ../hw/usb/hcd-ohci.c:1214 | ||
18 | #3 ohci_frame_boundary ../hw/usb/hcd-ohci.c:1257 | ||
19 | #4 timerlist_run_timers ../util/qemu-timer.c:572 | ||
20 | #5 qemu_clock_run_timers ../util/qemu-timer.c:586 | ||
21 | #6 qemu_clock_run_all_timers ../util/qemu-timer.c:672 | ||
22 | #7 main_loop_wait ../util/main-loop.c:527 | ||
23 | #8 qemu_main_loop ../softmmu/vl.c:1676 | ||
24 | #9 main ../softmmu/main.c:50 | ||
25 | |||
26 | Reported-by: Gaoning Pan <pgn@zju.edu.cn> | ||
27 | Reported-by: Yongkang Jia <j_kangel@163.com> | ||
28 | Reported-by: Yi Ren <yunye.ry@alibaba-inc.com> | ||
29 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
30 | Message-id: 20200915182259.68522-2-ppandit@redhat.com | ||
31 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
32 | |||
33 | Upstream-Status: Backport | ||
34 | CVE: CVE-2020-25624 | ||
35 | [https://git.qemu.org/?p=qemu.git;a=commit;h=1328fe0c32d5474604105b8105310e944976b058] | ||
36 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
37 | --- | ||
38 | hw/usb/hcd-ohci.c | 24 ++++++++++++++++++++++-- | ||
39 | 1 file changed, 22 insertions(+), 2 deletions(-) | ||
40 | |||
41 | diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c | ||
42 | index 1e6e85e..9dc5910 100644 | ||
43 | --- a/hw/usb/hcd-ohci.c | ||
44 | +++ b/hw/usb/hcd-ohci.c | ||
45 | @@ -731,7 +731,11 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
46 | } | ||
47 | |||
48 | start_offset = iso_td.offset[relative_frame_number]; | ||
49 | - next_offset = iso_td.offset[relative_frame_number + 1]; | ||
50 | + if (relative_frame_number < frame_count) { | ||
51 | + next_offset = iso_td.offset[relative_frame_number + 1]; | ||
52 | + } else { | ||
53 | + next_offset = iso_td.be; | ||
54 | + } | ||
55 | |||
56 | if (!(OHCI_BM(start_offset, TD_PSW_CC) & 0xe) || | ||
57 | ((relative_frame_number < frame_count) && | ||
58 | @@ -764,7 +768,12 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
59 | } | ||
60 | } else { | ||
61 | /* Last packet in the ISO TD */ | ||
62 | - end_addr = iso_td.be; | ||
63 | + end_addr = next_offset; | ||
64 | + } | ||
65 | + | ||
66 | + if (start_addr > end_addr) { | ||
67 | + trace_usb_ohci_iso_td_bad_cc_overrun(start_addr, end_addr); | ||
68 | + return 1; | ||
69 | } | ||
70 | |||
71 | if ((start_addr & OHCI_PAGE_MASK) != (end_addr & OHCI_PAGE_MASK)) { | ||
72 | @@ -773,6 +782,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, | ||
73 | } else { | ||
74 | len = end_addr - start_addr + 1; | ||
75 | } | ||
76 | + if (len > sizeof(ohci->usb_buf)) { | ||
77 | + len = sizeof(ohci->usb_buf); | ||
78 | + } | ||
79 | |||
80 | if (len && dir != OHCI_TD_DIR_IN) { | ||
81 | if (ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, len, | ||
82 | @@ -975,8 +987,16 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) | ||
83 | if ((td.cbp & 0xfffff000) != (td.be & 0xfffff000)) { | ||
84 | len = (td.be & 0xfff) + 0x1001 - (td.cbp & 0xfff); | ||
85 | } else { | ||
86 | + if (td.cbp > td.be) { | ||
87 | + trace_usb_ohci_iso_td_bad_cc_overrun(td.cbp, td.be); | ||
88 | + ohci_die(ohci); | ||
89 | + return 1; | ||
90 | + } | ||
91 | len = (td.be - td.cbp) + 1; | ||
92 | } | ||
93 | + if (len > sizeof(ohci->usb_buf)) { | ||
94 | + len = sizeof(ohci->usb_buf); | ||
95 | + } | ||
96 | |||
97 | pktlen = len; | ||
98 | if (len && dir != OHCI_TD_DIR_IN) { | ||
99 | -- | ||
100 | 2.17.1 | ||
101 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch new file mode 100644 index 0000000000..90b3a2f41c --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-25723.patch | |||
@@ -0,0 +1,51 @@ | |||
1 | From 2fdb42d840400d58f2e706ecca82c142b97bcbd6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Li Qiang <liq3ea@163.com> | ||
3 | Date: Wed, 12 Aug 2020 09:17:27 -0700 | ||
4 | Subject: [PATCH] hw: ehci: check return value of 'usb_packet_map' | ||
5 | |||
6 | If 'usb_packet_map' fails, we should stop to process the usb | ||
7 | request. | ||
8 | |||
9 | Signed-off-by: Li Qiang <liq3ea@163.com> | ||
10 | Message-Id: <20200812161727.29412-1-liq3ea@163.com> | ||
11 | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> | ||
12 | |||
13 | Upstream-Status: Backport | ||
14 | CVE: CVE-2020-25723 | ||
15 | [https://git.qemu.org/?p=qemu.git;a=commit;h=2fdb42d840400d58f2e706ecca82c142b97bcbd6] | ||
16 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
17 | --- | ||
18 | hw/usb/hcd-ehci.c | 10 ++++++++-- | ||
19 | 1 file changed, 8 insertions(+), 2 deletions(-) | ||
20 | |||
21 | diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c | ||
22 | index 1495e8f..1fbb02a 100644 | ||
23 | --- a/hw/usb/hcd-ehci.c | ||
24 | +++ b/hw/usb/hcd-ehci.c | ||
25 | @@ -1373,7 +1373,10 @@ static int ehci_execute(EHCIPacket *p, const char *action) | ||
26 | spd = (p->pid == USB_TOKEN_IN && NLPTR_TBIT(p->qtd.altnext) == 0); | ||
27 | usb_packet_setup(&p->packet, p->pid, ep, 0, p->qtdaddr, spd, | ||
28 | (p->qtd.token & QTD_TOKEN_IOC) != 0); | ||
29 | - usb_packet_map(&p->packet, &p->sgl); | ||
30 | + if (usb_packet_map(&p->packet, &p->sgl)) { | ||
31 | + qemu_sglist_destroy(&p->sgl); | ||
32 | + return -1; | ||
33 | + } | ||
34 | p->async = EHCI_ASYNC_INITIALIZED; | ||
35 | } | ||
36 | |||
37 | @@ -1452,7 +1455,10 @@ static int ehci_process_itd(EHCIState *ehci, | ||
38 | if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) { | ||
39 | usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false, | ||
40 | (itd->transact[i] & ITD_XACT_IOC) != 0); | ||
41 | - usb_packet_map(&ehci->ipacket, &ehci->isgl); | ||
42 | + if (usb_packet_map(&ehci->ipacket, &ehci->isgl)) { | ||
43 | + qemu_sglist_destroy(&ehci->isgl); | ||
44 | + return -1; | ||
45 | + } | ||
46 | usb_handle_packet(dev, &ehci->ipacket); | ||
47 | usb_packet_unmap(&ehci->ipacket, &ehci->isgl); | ||
48 | } else { | ||
49 | -- | ||
50 | 2.17.1 | ||
51 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch new file mode 100644 index 0000000000..5212196837 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-28916.patch | |||
@@ -0,0 +1,49 @@ | |||
1 | From c2cb511634012344e3d0fe49a037a33b12d8a98a Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Wed, 11 Nov 2020 18:36:36 +0530 | ||
4 | Subject: [PATCH] hw/net/e1000e: advance desc_offset in case of null | ||
5 | descriptor | ||
6 | |||
7 | While receiving packets via e1000e_write_packet_to_guest() routine, | ||
8 | 'desc_offset' is advanced only when RX descriptor is processed. And | ||
9 | RX descriptor is not processed if it has NULL buffer address. | ||
10 | This may lead to an infinite loop condition. Increament 'desc_offset' | ||
11 | to process next descriptor in the ring to avoid infinite loop. | ||
12 | |||
13 | Reported-by: Cheol-woo Myung <330cjfdn@gmail.com> | ||
14 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
15 | Signed-off-by: Jason Wang <jasowang@redhat.com> | ||
16 | |||
17 | Upstream-Status: Backport | ||
18 | CVE: CVE-2020-28916 | ||
19 | [https://git.qemu.org/?p=qemu.git;a=commit;h=c2cb511634012344e3d0fe49a037a33b12d8a98a] | ||
20 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
21 | --- | ||
22 | hw/net/e1000e_core.c | 8 ++++---- | ||
23 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
24 | |||
25 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c | ||
26 | index bcd186c..d3e3cdc 100644 | ||
27 | --- a/hw/net/e1000e_core.c | ||
28 | +++ b/hw/net/e1000e_core.c | ||
29 | @@ -1596,13 +1596,13 @@ e1000e_write_packet_to_guest(E1000ECore *core, struct NetRxPkt *pkt, | ||
30 | (const char *) &fcs_pad, e1000x_fcs_len(core->mac)); | ||
31 | } | ||
32 | } | ||
33 | - desc_offset += desc_size; | ||
34 | - if (desc_offset >= total_size) { | ||
35 | - is_last = true; | ||
36 | - } | ||
37 | } else { /* as per intel docs; skip descriptors with null buf addr */ | ||
38 | trace_e1000e_rx_null_descriptor(); | ||
39 | } | ||
40 | + desc_offset += desc_size; | ||
41 | + if (desc_offset >= total_size) { | ||
42 | + is_last = true; | ||
43 | + } | ||
44 | |||
45 | e1000e_write_rx_descr(core, desc, is_last ? core->rx_pkt : NULL, | ||
46 | rss_info, do_ps ? ps_hdr_len : 0, &bastate.written); | ||
47 | -- | ||
48 | 2.17.1 | ||
49 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch new file mode 100644 index 0000000000..e5829f6dad --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-29129-CVE-2020-29130.patch | |||
@@ -0,0 +1,64 @@ | |||
1 | From 2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f Mon Sep 17 00:00:00 2001 | ||
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
3 | Date: Thu, 26 Nov 2020 19:27:06 +0530 | ||
4 | Subject: [PATCH] slirp: check pkt_len before reading protocol header | ||
5 | MIME-Version: 1.0 | ||
6 | Content-Type: text/plain; charset=utf8 | ||
7 | Content-Transfer-Encoding: 8bit | ||
8 | |||
9 | While processing ARP/NCSI packets in 'arp_input' or 'ncsi_input' | ||
10 | routines, ensure that pkt_len is large enough to accommodate the | ||
11 | respective protocol headers, lest it should do an OOB access. | ||
12 | Add check to avoid it. | ||
13 | |||
14 | CVE-2020-29129 CVE-2020-29130 | ||
15 | QEMU: slirp: out-of-bounds access while processing ARP/NCSI packets | ||
16 | -> https://www.openwall.com/lists/oss-security/2020/11/27/1 | ||
17 | |||
18 | Reported-by: Qiuhao Li <Qiuhao.Li@outlook.com> | ||
19 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
20 | Message-Id: <20201126135706.273950-1-ppandit@redhat.com> | ||
21 | Reviewed-by: Marc-Andrà Lureau <marcandre.lureau@redhat.com> | ||
22 | |||
23 | Upstream-Status: Backport | ||
24 | CVE: CVE-2020-29129 CVE-2020-29130 | ||
25 | [https://git.qemu.org/?p=libslirp.git;a=commit;h=2e1dcbc0c2af64fcb17009eaf2ceedd81be2b27f] | ||
26 | Signed-off-by: Li Wang <li.wang@windriver.com> | ||
27 | --- | ||
28 | slirp/src/ncsi.c | 4 ++++ | ||
29 | slirp/src/slirp.c | 4 ++++ | ||
30 | 2 files changed, 8 insertions(+) | ||
31 | |||
32 | diff --git a/slirp/src/ncsi.c b/slirp/src/ncsi.c | ||
33 | index 3c1dfef..75dcc08 100644 | ||
34 | --- a/slirp/src/ncsi.c | ||
35 | +++ b/slirp/src/ncsi.c | ||
36 | @@ -148,6 +148,10 @@ void ncsi_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) | ||
37 | uint32_t checksum; | ||
38 | uint32_t *pchecksum; | ||
39 | |||
40 | + if (pkt_len < ETH_HLEN + sizeof(struct ncsi_pkt_hdr)) { | ||
41 | + return; /* packet too short */ | ||
42 | + } | ||
43 | + | ||
44 | memset(ncsi_reply, 0, sizeof(ncsi_reply)); | ||
45 | |||
46 | memset(reh->h_dest, 0xff, ETH_ALEN); | ||
47 | diff --git a/slirp/src/slirp.c b/slirp/src/slirp.c | ||
48 | index dba7c98..9be58e2 100644 | ||
49 | --- a/slirp/src/slirp.c | ||
50 | +++ b/slirp/src/slirp.c | ||
51 | @@ -756,6 +756,10 @@ static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) | ||
52 | return; | ||
53 | } | ||
54 | |||
55 | + if (pkt_len < ETH_HLEN + sizeof(struct slirp_arphdr)) { | ||
56 | + return; /* packet too short */ | ||
57 | + } | ||
58 | + | ||
59 | ar_op = ntohs(ah->ar_op); | ||
60 | switch (ar_op) { | ||
61 | case ARPOP_REQUEST: | ||
62 | -- | ||
63 | 2.17.1 | ||
64 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch new file mode 100644 index 0000000000..5a3b99bb23 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-29443.patch | |||
@@ -0,0 +1,46 @@ | |||
1 | |||
2 | m 813212288970c39b1800f63e83ac6e96588095c6 Mon Sep 17 00:00:00 2001 | ||
3 | From: Paolo Bonzini <pbonzini@redhat.com> | ||
4 | Date: Tue, 1 Dec 2020 13:09:26 +0100 | ||
5 | Subject: [PATCH] ide: atapi: assert that the buffer pointer is in range | ||
6 | |||
7 | A case was reported where s->io_buffer_index can be out of range. | ||
8 | The report skimped on the details but it seems to be triggered | ||
9 | by s->lba == -1 on the READ/READ CD paths (e.g. by sending an | ||
10 | ATAPI command with LBA = 0xFFFFFFFF). For now paper over it | ||
11 | with assertions. The first one ensures that there is no overflow | ||
12 | when incrementing s->io_buffer_index, the second checks for the | ||
13 | buffer overrun. | ||
14 | |||
15 | Note that the buffer overrun is only a read, so I am not sure | ||
16 | if the assertion failure is actually less harmful than the overrun. | ||
17 | |||
18 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | ||
19 | Message-id: 20201201120926.56559-1-pbonzini@redhat.com | ||
20 | Reviewed-by: Kevin Wolf <kwolf@redhat.com> | ||
21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
22 | |||
23 | Upstream-Status: Backport [https://git.qemu.org/?p=qemu.git;a=patch;h=813212288970c39b1800f63e83ac6e96588095c6] | ||
24 | CVE: CVE-2020-29443 | ||
25 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
26 | |||
27 | --- | ||
28 | hw/ide/atapi.c | 2 ++ | ||
29 | 1 file changed, 2 insertions(+) | ||
30 | |||
31 | diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c | ||
32 | index 14a2b0b..e791578 100644 | ||
33 | --- a/hw/ide/atapi.c | ||
34 | +++ b/hw/ide/atapi.c | ||
35 | @@ -276,6 +276,8 @@ void ide_atapi_cmd_reply_end(IDEState *s) | ||
36 | s->packet_transfer_size -= size; | ||
37 | s->elementary_transfer_size -= size; | ||
38 | s->io_buffer_index += size; | ||
39 | + assert(size <= s->io_buffer_total_len); | ||
40 | + assert(s->io_buffer_index <= s->io_buffer_total_len); | ||
41 | |||
42 | /* Some adapters process PIO data right away. In that case, we need | ||
43 | * to avoid mutual recursion between ide_transfer_start | ||
44 | -- | ||
45 | 1.8.3.1 | ||
46 | |||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch b/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch new file mode 100644 index 0000000000..f818eb3bf5 --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2020-35517.patch | |||
@@ -0,0 +1,126 @@ | |||
1 | From ebf101955ce8f8d72fba103b5151115a4335de2c Mon Sep 17 00:00:00 2001 | ||
2 | From: Stefan Hajnoczi <stefanha@redhat.com> | ||
3 | Date: Tue, 6 Oct 2020 10:58:26 +0100 | ||
4 | Subject: [PATCH] virtiofsd: avoid /proc/self/fd tempdir | ||
5 | |||
6 | In order to prevent /proc/self/fd escapes a temporary directory is | ||
7 | created where /proc/self/fd is bind-mounted. This doesn't work on | ||
8 | read-only file systems. | ||
9 | |||
10 | Avoid the temporary directory by bind-mounting /proc/self/fd over /proc. | ||
11 | This does not affect other processes since we remounted / with MS_REC | | ||
12 | MS_SLAVE. /proc must exist and virtiofsd does not use it so it's safe to | ||
13 | do this. | ||
14 | |||
15 | Path traversal can be tested with the following function: | ||
16 | |||
17 | static void test_proc_fd_escape(struct lo_data *lo) | ||
18 | { | ||
19 | int fd; | ||
20 | int level = 0; | ||
21 | ino_t last_ino = 0; | ||
22 | |||
23 | fd = lo->proc_self_fd; | ||
24 | for (;;) { | ||
25 | struct stat st; | ||
26 | |||
27 | if (fstat(fd, &st) != 0) { | ||
28 | perror("fstat"); | ||
29 | return; | ||
30 | } | ||
31 | if (last_ino && st.st_ino == last_ino) { | ||
32 | fprintf(stderr, "inode number unchanged, stopping\n"); | ||
33 | return; | ||
34 | } | ||
35 | last_ino = st.st_ino; | ||
36 | |||
37 | fprintf(stderr, "Level %d dev %lu ino %lu\n", level, | ||
38 | (unsigned long)st.st_dev, | ||
39 | (unsigned long)last_ino); | ||
40 | fd = openat(fd, "..", O_PATH | O_DIRECTORY | O_NOFOLLOW); | ||
41 | level++; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | Before and after this patch only Level 0 is displayed. Without | ||
46 | /proc/self/fd bind-mount protection it is possible to traverse parent | ||
47 | directories. | ||
48 | |||
49 | Fixes: 397ae982f4df4 ("virtiofsd: jail lo->proc_self_fd") | ||
50 | Cc: Miklos Szeredi <mszeredi@redhat.com> | ||
51 | Cc: Jens Freimann <jfreimann@redhat.com> | ||
52 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
53 | Message-Id: <20201006095826.59813-1-stefanha@redhat.com> | ||
54 | Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
55 | Tested-by: Jens Freimann <jfreimann@redhat.com> | ||
56 | Reviewed-by: Jens Freimann <jfreimann@redhat.com> | ||
57 | Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> | ||
58 | |||
59 | |||
60 | Upstream-Status: Backport | ||
61 | [https://github.com/qemu/qemu/commit/ebf101955ce8f8d72fba103b5151115a4335de2c] | ||
62 | CVE: CVE-2020-35517 | ||
63 | Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com> | ||
64 | |||
65 | --- | ||
66 | tools/virtiofsd/passthrough_ll.c | 34 +++++++++++--------------------- | ||
67 | 1 file changed, 11 insertions(+), 23 deletions(-) | ||
68 | |||
69 | diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c | ||
70 | index 477e6ee0b53..ff53df44510 100644 | ||
71 | --- a/tools/virtiofsd/passthrough_ll.c | ||
72 | +++ b/tools/virtiofsd/passthrough_ll.c | ||
73 | @@ -2393,8 +2393,6 @@ static void setup_wait_parent_capabilities(void) | ||
74 | static void setup_namespaces(struct lo_data *lo, struct fuse_session *se) | ||
75 | { | ||
76 | pid_t child; | ||
77 | - char template[] = "virtiofsd-XXXXXX"; | ||
78 | - char *tmpdir; | ||
79 | |||
80 | /* | ||
81 | * Create a new pid namespace for *child* processes. We'll have to | ||
82 | @@ -2458,33 +2456,23 @@ static void setup_namespaces(struct lo_data *lo, struct fuse_session *se) | ||
83 | exit(1); | ||
84 | } | ||
85 | |||
86 | - tmpdir = mkdtemp(template); | ||
87 | - if (!tmpdir) { | ||
88 | - fuse_log(FUSE_LOG_ERR, "tmpdir(%s): %m\n", template); | ||
89 | - exit(1); | ||
90 | - } | ||
91 | - | ||
92 | - if (mount("/proc/self/fd", tmpdir, NULL, MS_BIND, NULL) < 0) { | ||
93 | - fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, %s, MS_BIND): %m\n", | ||
94 | - tmpdir); | ||
95 | + /* | ||
96 | + * We only need /proc/self/fd. Prevent ".." from accessing parent | ||
97 | + * directories of /proc/self/fd by bind-mounting it over /proc. Since / was | ||
98 | + * previously remounted with MS_REC | MS_SLAVE this mount change only | ||
99 | + * affects our process. | ||
100 | + */ | ||
101 | + if (mount("/proc/self/fd", "/proc", NULL, MS_BIND, NULL) < 0) { | ||
102 | + fuse_log(FUSE_LOG_ERR, "mount(/proc/self/fd, MS_BIND): %m\n"); | ||
103 | exit(1); | ||
104 | } | ||
105 | |||
106 | - /* Now we can get our /proc/self/fd directory file descriptor */ | ||
107 | - lo->proc_self_fd = open(tmpdir, O_PATH); | ||
108 | + /* Get the /proc (actually /proc/self/fd, see above) file descriptor */ | ||
109 | + lo->proc_self_fd = open("/proc", O_PATH); | ||
110 | if (lo->proc_self_fd == -1) { | ||
111 | - fuse_log(FUSE_LOG_ERR, "open(%s, O_PATH): %m\n", tmpdir); | ||
112 | + fuse_log(FUSE_LOG_ERR, "open(/proc, O_PATH): %m\n"); | ||
113 | exit(1); | ||
114 | } | ||
115 | - | ||
116 | - if (umount2(tmpdir, MNT_DETACH) < 0) { | ||
117 | - fuse_log(FUSE_LOG_ERR, "umount2(%s, MNT_DETACH): %m\n", tmpdir); | ||
118 | - exit(1); | ||
119 | - } | ||
120 | - | ||
121 | - if (rmdir(tmpdir) < 0) { | ||
122 | - fuse_log(FUSE_LOG_ERR, "rmdir(%s): %m\n", tmpdir); | ||
123 | - } | ||
124 | } | ||
125 | |||
126 | /* | ||
diff --git a/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch b/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch new file mode 100644 index 0000000000..31440af0bd --- /dev/null +++ b/meta/recipes-devtools/qemu/qemu/CVE-2021-20203.patch | |||
@@ -0,0 +1,74 @@ | |||
1 | From: Prasad J Pandit <pjp@fedoraproject.org> | ||
2 | |||
3 | While activating device in vmxnet3_acticate_device(), it does not | ||
4 | validate guest supplied configuration values against predefined | ||
5 | minimum - maximum limits. This may lead to integer overflow or | ||
6 | OOB access issues. Add checks to avoid it. | ||
7 | |||
8 | Fixes: CVE-2021-20203 | ||
9 | Buglink: https://bugs.launchpad.net/qemu/+bug/1913873 | ||
10 | Reported-by: Gaoning Pan <pgn@zju.edu.cn> | ||
11 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | ||
12 | |||
13 | Upstream-Status: Acepted [https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg07935.html] | ||
14 | CVE: CVE-2021-20203 | ||
15 | Signed-off-by: Minjae Kim <flowergom@gmail.com> | ||
16 | --- | ||
17 | hw/net/vmxnet3.c | 13 +++++++++++++ | ||
18 | 1 file changed, 13 insertions(+) | ||
19 | |||
20 | diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c | ||
21 | index eff299f629..4a910ca971 100644 | ||
22 | --- a/hw/net/vmxnet3.c | ||
23 | +++ b/hw/net/vmxnet3.c | ||
24 | @@ -1420,6 +1420,7 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
25 | vmxnet3_setup_rx_filtering(s); | ||
26 | /* Cache fields from shared memory */ | ||
27 | s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu); | ||
28 | + assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu < VMXNET3_MAX_MTU); | ||
29 | VMW_CFPRN("MTU is %u", s->mtu); | ||
30 | |||
31 | s->max_rx_frags = | ||
32 | @@ -1473,6 +1474,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
33 | /* Read rings memory locations for TX queues */ | ||
34 | pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.txRingBasePA); | ||
35 | size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.txRingSize); | ||
36 | + if (size > VMXNET3_TX_RING_MAX_SIZE) { | ||
37 | + size = VMXNET3_TX_RING_MAX_SIZE; | ||
38 | + } | ||
39 | |||
40 | vmxnet3_ring_init(d, &s->txq_descr[i].tx_ring, pa, size, | ||
41 | sizeof(struct Vmxnet3_TxDesc), false); | ||
42 | @@ -1483,6 +1487,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
43 | /* TXC ring */ | ||
44 | pa = VMXNET3_READ_TX_QUEUE_DESCR64(d, qdescr_pa, conf.compRingBasePA); | ||
45 | size = VMXNET3_READ_TX_QUEUE_DESCR32(d, qdescr_pa, conf.compRingSize); | ||
46 | + if (size > VMXNET3_TC_RING_MAX_SIZE) { | ||
47 | + size = VMXNET3_TC_RING_MAX_SIZE; | ||
48 | + } | ||
49 | vmxnet3_ring_init(d, &s->txq_descr[i].comp_ring, pa, size, | ||
50 | sizeof(struct Vmxnet3_TxCompDesc), true); | ||
51 | VMXNET3_RING_DUMP(VMW_CFPRN, "TXC", i, &s->txq_descr[i].comp_ring); | ||
52 | @@ -1524,6 +1531,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
53 | /* RX rings */ | ||
54 | pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.rxRingBasePA[j]); | ||
55 | size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.rxRingSize[j]); | ||
56 | + if (size > VMXNET3_RX_RING_MAX_SIZE) { | ||
57 | + size = VMXNET3_RX_RING_MAX_SIZE; | ||
58 | + } | ||
59 | vmxnet3_ring_init(d, &s->rxq_descr[i].rx_ring[j], pa, size, | ||
60 | sizeof(struct Vmxnet3_RxDesc), false); | ||
61 | VMW_CFPRN("RX queue %d:%d: Base: %" PRIx64 ", Size: %d", | ||
62 | @@ -1533,6 +1543,9 @@ static void vmxnet3_activate_device(VMXNET3State *s) | ||
63 | /* RXC ring */ | ||
64 | pa = VMXNET3_READ_RX_QUEUE_DESCR64(d, qd_pa, conf.compRingBasePA); | ||
65 | size = VMXNET3_READ_RX_QUEUE_DESCR32(d, qd_pa, conf.compRingSize); | ||
66 | + if (size > VMXNET3_RC_RING_MAX_SIZE) { | ||
67 | + size = VMXNET3_RC_RING_MAX_SIZE; | ||
68 | + } | ||
69 | vmxnet3_ring_init(d, &s->rxq_descr[i].comp_ring, pa, size, | ||
70 | sizeof(struct Vmxnet3_RxCompDesc), true); | ||
71 | VMW_CFPRN("RXC queue %d: Base: %" PRIx64 ", Size: %d", i, pa, size); | ||
72 | -- | ||
73 | 2.29.2 | ||
74 | |||
diff --git a/meta/recipes-devtools/quilt/quilt.inc b/meta/recipes-devtools/quilt/quilt.inc index d6d06c049c..d7ecda7aaa 100644 --- a/meta/recipes-devtools/quilt/quilt.inc +++ b/meta/recipes-devtools/quilt/quilt.inc | |||
@@ -30,7 +30,7 @@ EXTRA_OECONF = "--with-perl='${USRBINPATH}/env perl' --with-patch=patch" | |||
30 | EXTRA_OECONF_append_class-native = " --disable-nls" | 30 | EXTRA_OECONF_append_class-native = " --disable-nls" |
31 | EXTRA_AUTORECONF += "--exclude=aclocal" | 31 | EXTRA_AUTORECONF += "--exclude=aclocal" |
32 | 32 | ||
33 | CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash" | 33 | CACHED_CONFIGUREVARS += "ac_cv_path_BASH=/bin/bash ac_cv_path_COLUMN=column" |
34 | 34 | ||
35 | # Make sure we don't have "-w" in shebang lines: it breaks using | 35 | # Make sure we don't have "-w" in shebang lines: it breaks using |
36 | # "/usr/bin/env perl" as parser | 36 | # "/usr/bin/env perl" as parser |
diff --git a/meta/recipes-devtools/rsync/files/0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch b/meta/recipes-devtools/rsync/files/0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch new file mode 100644 index 0000000000..2d51ddf965 --- /dev/null +++ b/meta/recipes-devtools/rsync/files/0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From fbe85634d88e82fbb439ae2a5d1aca8b8c309bea Mon Sep 17 00:00:00 2001 | ||
2 | From: Matt McCutchen <matt@mattmccutchen.net> | ||
3 | Date: Wed, 26 Aug 2020 12:16:08 -0400 | ||
4 | Subject: [PATCH] rsync-ssl: Verify the hostname in the certificate when using | ||
5 | openssl. | ||
6 | |||
7 | CVE: CVE-2020-14387 | ||
8 | |||
9 | Upstream-Status: Backport [https://git.samba.org/?p=rsync.git;a=commit;h=c3f7414] | ||
10 | |||
11 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | ||
12 | --- | ||
13 | rsync-ssl | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/rsync-ssl b/rsync-ssl | ||
17 | index 8101975..46701af 100755 | ||
18 | --- a/rsync-ssl | ||
19 | +++ b/rsync-ssl | ||
20 | @@ -129,7 +129,7 @@ function rsync_ssl_helper { | ||
21 | fi | ||
22 | |||
23 | if [[ $RSYNC_SSL_TYPE == openssl ]]; then | ||
24 | - exec $RSYNC_SSL_OPENSSL s_client $caopt $certopt -quiet -verify_quiet -servername $hostname -connect $hostname:$port | ||
25 | + exec $RSYNC_SSL_OPENSSL s_client $caopt $certopt -quiet -verify_quiet -servername $hostname -verify_hostname $hostname -connect $hostname:$port | ||
26 | elif [[ $RSYNC_SSL_TYPE == gnutls ]]; then | ||
27 | exec $RSYNC_SSL_GNUTLS --logfile=/dev/null $gnutls_cert_opt $gnutls_opts $hostname:$port | ||
28 | else | ||
29 | -- | ||
30 | 2.17.1 | ||
31 | |||
diff --git a/meta/recipes-devtools/rsync/files/determism.patch b/meta/recipes-devtools/rsync/files/determism.patch new file mode 100644 index 0000000000..53a4ca7505 --- /dev/null +++ b/meta/recipes-devtools/rsync/files/determism.patch | |||
@@ -0,0 +1,28 @@ | |||
1 | The Makefile calls awk on a "*.c" glob. The results of this glob are sorted | ||
2 | but the order depends on the locale settings, particularly whether | ||
3 | "util.c" and "util2.c" sort before or after each other. In en_US.UTF-8 | ||
4 | they sort one way, in C, they sort the other. The sorting order changes | ||
5 | the output binaries. The behaviour also changes dependning on whether | ||
6 | SHELL (/bin/sh) is dash or bash. | ||
7 | |||
8 | Specify a C locale setting to be deterministic. | ||
9 | |||
10 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Index: rsync-3.2.3/Makefile.in | ||
14 | =================================================================== | ||
15 | --- rsync-3.2.3.orig/Makefile.in | ||
16 | +++ rsync-3.2.3/Makefile.in | ||
17 | @@ -26,6 +26,11 @@ MKDIR_P=@MKDIR_P@ | ||
18 | VPATH=$(srcdir) | ||
19 | SHELL=/bin/sh | ||
20 | |||
21 | +# We use globbing in commands, need to be deterministic | ||
22 | +unexport LC_ALL | ||
23 | +LC_COLLATE=C | ||
24 | +export LC_COLLATE | ||
25 | + | ||
26 | .SUFFIXES: | ||
27 | .SUFFIXES: .c .o | ||
28 | |||
diff --git a/meta/recipes-devtools/rsync/rsync_3.2.3.bb b/meta/recipes-devtools/rsync/rsync_3.2.3.bb index 375efa0dea..df4fbbd0d2 100644 --- a/meta/recipes-devtools/rsync/rsync_3.2.3.bb +++ b/meta/recipes-devtools/rsync/rsync_3.2.3.bb | |||
@@ -12,6 +12,8 @@ DEPENDS = "popt" | |||
12 | SRC_URI = "https://download.samba.org/pub/${BPN}/src/${BP}.tar.gz \ | 12 | SRC_URI = "https://download.samba.org/pub/${BPN}/src/${BP}.tar.gz \ |
13 | file://rsyncd.conf \ | 13 | file://rsyncd.conf \ |
14 | file://makefile-no-rebuild.patch \ | 14 | file://makefile-no-rebuild.patch \ |
15 | file://determism.patch \ | ||
16 | file://0001-rsync-ssl-Verify-the-hostname-in-the-certificate-whe.patch \ | ||
15 | " | 17 | " |
16 | 18 | ||
17 | SRC_URI[sha256sum] = "becc3c504ceea499f4167a260040ccf4d9f2ef9499ad5683c179a697146ce50e" | 19 | SRC_URI[sha256sum] = "becc3c504ceea499f4167a260040ccf4d9f2ef9499ad5683c179a697146ce50e" |
@@ -38,7 +40,7 @@ PACKAGECONFIG[zstd] = "--enable-zstd,--disable-zstd,zstd" | |||
38 | CACHED_CONFIGUREVARS += "rsync_cv_can_hardlink_special=yes rsync_cv_can_hardlink_symlink=yes" | 40 | CACHED_CONFIGUREVARS += "rsync_cv_can_hardlink_special=yes rsync_cv_can_hardlink_symlink=yes" |
39 | 41 | ||
40 | EXTRA_OEMAKE = 'STRIP=""' | 42 | EXTRA_OEMAKE = 'STRIP=""' |
41 | EXTRA_OECONF = "--disable-simd --disable-md2man --disable-asm" | 43 | EXTRA_OECONF = "--disable-simd --disable-md2man --disable-asm --with-nobody-group=nogroup" |
42 | 44 | ||
43 | # rsync 3.0 uses configure.sh instead of configure, and | 45 | # rsync 3.0 uses configure.sh instead of configure, and |
44 | # makefile checks the existence of configure.sh | 46 | # makefile checks the existence of configure.sh |
diff --git a/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch b/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch new file mode 100644 index 0000000000..826daf2cda --- /dev/null +++ b/meta/recipes-devtools/ruby/ruby/0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch | |||
@@ -0,0 +1,32 @@ | |||
1 | From 2368d07660a93a2c41d63f3ab6054ca4daeef820 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Tue, 17 Nov 2020 18:31:40 +0000 | ||
4 | Subject: [PATCH] template/Makefile.in: do not write host cross-cc items into | ||
5 | target config | ||
6 | |||
7 | This helps reproducibility. | ||
8 | |||
9 | Upstream-Status: Inapproppriate [oe-core specific] | ||
10 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
11 | --- | ||
12 | template/Makefile.in | 4 ++-- | ||
13 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/template/Makefile.in b/template/Makefile.in | ||
16 | index 10dc826..940ee07 100644 | ||
17 | --- a/template/Makefile.in | ||
18 | +++ b/template/Makefile.in | ||
19 | @@ -657,11 +657,11 @@ mjit_config.h: | ||
20 | echo '#endif'; \ | ||
21 | quote MJIT_MIN_HEADER_NAME "$(MJIT_MIN_HEADER_NAME)"; \ | ||
22 | sep=,; \ | ||
23 | - quote "MJIT_CC_COMMON " $(MJIT_CC); \ | ||
24 | + quote "MJIT_CC_COMMON " ; \ | ||
25 | quote "MJIT_CFLAGS MJIT_ARCHFLAG" $(MJIT_CFLAGS); \ | ||
26 | quote "MJIT_OPTFLAGS " $(MJIT_OPTFLAGS); \ | ||
27 | quote "MJIT_DEBUGFLAGS " $(MJIT_DEBUGFLAGS); \ | ||
28 | - quote "MJIT_LDSHARED " $(MJIT_LDSHARED); \ | ||
29 | + quote "MJIT_LDSHARED " ; \ | ||
30 | quote "MJIT_DLDFLAGS MJIT_ARCHFLAG" $(MJIT_DLDFLAGS); \ | ||
31 | quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \ | ||
32 | quote 'PRELOADENV "@PRELOADENV@"'; \ | ||
diff --git a/meta/recipes-devtools/ruby/ruby_2.7.1.bb b/meta/recipes-devtools/ruby/ruby_2.7.1.bb index f87686f6f7..a6c65e887b 100644 --- a/meta/recipes-devtools/ruby/ruby_2.7.1.bb +++ b/meta/recipes-devtools/ruby/ruby_2.7.1.bb | |||
@@ -7,6 +7,7 @@ SRC_URI += " \ | |||
7 | file://run-ptest \ | 7 | file://run-ptest \ |
8 | file://0001-Modify-shebang-of-libexec-y2racc-and-libexec-racc2y.patch \ | 8 | file://0001-Modify-shebang-of-libexec-y2racc-and-libexec-racc2y.patch \ |
9 | file://CVE-2020-25613.patch \ | 9 | file://CVE-2020-25613.patch \ |
10 | file://0001-template-Makefile.in-do-not-write-host-cross-cc-item.patch \ | ||
10 | " | 11 | " |
11 | 12 | ||
12 | SRC_URI[md5sum] = "debb9c325bf65021214451660f46e909" | 13 | SRC_URI[md5sum] = "debb9c325bf65021214451660f46e909" |
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts index f84a7e18c8..95dccb9cae 100755 --- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts +++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | |||
@@ -72,12 +72,12 @@ exec_postinst_scriptlets() { | |||
72 | else | 72 | else |
73 | echo "ERROR: postinst $i failed." | 73 | echo "ERROR: postinst $i failed." |
74 | [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log | 74 | [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log |
75 | remove_pi_dir=0 | 75 | remove_rcsd_link=0 |
76 | fi | 76 | fi |
77 | done | 77 | done |
78 | } | 78 | } |
79 | 79 | ||
80 | remove_pi_dir=1 | 80 | remove_rcsd_link=1 |
81 | if $pm_installed; then | 81 | if $pm_installed; then |
82 | case $pm in | 82 | case $pm in |
83 | "ipk") | 83 | "ipk") |
@@ -92,9 +92,7 @@ else | |||
92 | exec_postinst_scriptlets | 92 | exec_postinst_scriptlets |
93 | fi | 93 | fi |
94 | 94 | ||
95 | # since all postinstalls executed successfully, remove the postinstalls directory | 95 | # since all postinstalls executed successfully, remove the rcS.d link |
96 | # and the rcS.d link | 96 | if [ $remove_rcsd_link = 1 ]; then |
97 | if [ $remove_pi_dir = 1 ]; then | ||
98 | rm -rf $pi_dir | ||
99 | remove_rcsd_link | 97 | remove_rcsd_link |
100 | fi | 98 | fi |
diff --git a/meta/recipes-devtools/strace/strace/run-ptest b/meta/recipes-devtools/strace/strace/run-ptest index 4660207220..3a51fb0be9 100755 --- a/meta/recipes-devtools/strace/strace/run-ptest +++ b/meta/recipes-devtools/strace/strace/run-ptest | |||
@@ -1,5 +1,5 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | export TIMEOUT_DURATION=120 | 2 | export TIMEOUT_DURATION=240 |
3 | chown nobody tests | 3 | chown nobody tests |
4 | chown nobody tests/* | 4 | chown nobody tests/* |
5 | chown nobody ../ptest | 5 | chown nobody ../ptest |
diff --git a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb index ed14fe66b1..c1b05691b8 100644 --- a/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb +++ b/meta/recipes-devtools/tcf-agent/tcf-agent_git.bb | |||
@@ -48,6 +48,7 @@ CFLAGS_append_libc-musl = " ${LCL_STOP_SERVICES}" | |||
48 | CFLAGS_append_powerpc64 = " ${LCL_STOP_SERVICES}" | 48 | CFLAGS_append_powerpc64 = " ${LCL_STOP_SERVICES}" |
49 | CFLAGS_append_powerpc64le = " ${LCL_STOP_SERVICES}" | 49 | CFLAGS_append_powerpc64le = " ${LCL_STOP_SERVICES}" |
50 | CFLAGS_append_riscv64 = " ${LCL_STOP_SERVICES}" | 50 | CFLAGS_append_riscv64 = " ${LCL_STOP_SERVICES}" |
51 | CFLAGS_append_riscv32 = " ${LCL_STOP_SERVICES}" | ||
51 | 52 | ||
52 | do_install() { | 53 | do_install() { |
53 | oe_runmake install INSTALLROOT=${D} | 54 | oe_runmake install INSTALLROOT=${D} |
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch b/meta/recipes-devtools/valgrind/valgrind/0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch new file mode 100644 index 0000000000..0bd8273cd8 --- /dev/null +++ b/meta/recipes-devtools/valgrind/valgrind/0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | From d8c19e0bb9ca2fd48f223e1fdeffcafeb0aa1745 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yi Fan Yu <yifan.yu@windriver.com> | ||
3 | Date: Wed, 17 Feb 2021 14:53:44 -0500 | ||
4 | Subject: [PATCH] gdbserver_tests: Disable nlcontrolc.vgtest for x86-64 | ||
5 | |||
6 | Test hangs after glibc 2.33 uprev | ||
7 | |||
8 | Using gdb to modify the timeout argument no longer | ||
9 | affects how long `select` wait. | ||
10 | |||
11 | https://bugs.kde.org/show_bug.cgi?id=432870 | ||
12 | Upstream-Status: Pending | ||
13 | Waiting for upstream to take action. | ||
14 | |||
15 | Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com> | ||
16 | --- | ||
17 | gdbserver_tests/nlcontrolc.vgtest | 3 ++- | ||
18 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/gdbserver_tests/nlcontrolc.vgtest b/gdbserver_tests/nlcontrolc.vgtest | ||
21 | index bb5308403..96d2b52bb 100644 | ||
22 | --- a/gdbserver_tests/nlcontrolc.vgtest | ||
23 | +++ b/gdbserver_tests/nlcontrolc.vgtest | ||
24 | @@ -13,7 +13,8 @@ args: 1000000000 1000000000 1000000000 BSBSBSBS 1 | ||
25 | vgopts: --tool=none --vgdb=yes --vgdb-error=0 --vgdb-prefix=./vgdb-prefix-nlcontrolc | ||
26 | stderr_filter: filter_stderr | ||
27 | # Bug 338633 nlcontrol hangs on arm64 currently. | ||
28 | -prereq: test -e gdb -a -f vgdb.invoker && ! ../tests/arch_test arm64 && ! ../tests/os_test solaris | ||
29 | +# Bug 432870 nlcontrolc hangs on x86-64 starting with glibc 2.33 | ||
30 | +prereq: test -e gdb -a -f vgdb.invoker && ! ../tests/arch_test arm64 && ! ../tests/os_test solaris && ! ../tests/arch_test amd64 | ||
31 | progB: gdb | ||
32 | argsB: --quiet -l 60 --nx ./sleepers | ||
33 | stdinB: nlcontrolc.stdinB.gdb | ||
34 | -- | ||
35 | 2.29.2 | ||
36 | |||
diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch b/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch new file mode 100644 index 0000000000..f66df3d2d2 --- /dev/null +++ b/meta/recipes-devtools/valgrind/valgrind/0001-helgrind-Intercept-libc-functions.patch | |||
@@ -0,0 +1,54 @@ | |||
1 | From cdec010444df5a4328e90d07a2024fdeefcc74b5 Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Floyd <paulf@free.fr> | ||
3 | Date: Wed, 18 Nov 2020 12:49:20 -0400 | ||
4 | Subject: [PATCH] helgrind: Intercept libc functions | ||
5 | |||
6 | PTH_FUNC definition needs to be modified in order to | ||
7 | intercept posix thread functions in both libc and | ||
8 | libpthread. In order to handle this in helgrind, weak alias | ||
9 | the pthread functions in glibc. | ||
10 | |||
11 | Upstream-Status: Submitted | ||
12 | |||
13 | Signed-off-by: Paul Floyd <paulf@free.fr> | ||
14 | Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com> | ||
15 | --- | ||
16 | helgrind/hg_intercepts.c | 12 ++++++++++++ | ||
17 | 1 file changed, 12 insertions(+) | ||
18 | |||
19 | diff --git a/helgrind/hg_intercepts.c b/helgrind/hg_intercepts.c | ||
20 | index a10c3a4a3..316140ca6 100644 | ||
21 | --- a/helgrind/hg_intercepts.c | ||
22 | +++ b/helgrind/hg_intercepts.c | ||
23 | @@ -77,6 +77,11 @@ | ||
24 | /*--- ---*/ | ||
25 | /*----------------------------------------------------------------*/ | ||
26 | |||
27 | +#define hg_expand(tok) #tok | ||
28 | +#define hg_str(tok) hg_expand(tok) | ||
29 | +# define hg_weak_alias(name, aliasname) \ | ||
30 | + extern __typeof (name) aliasname __attribute__ ((weak, alias(hg_str(name)))) | ||
31 | + | ||
32 | #if defined(VGO_solaris) | ||
33 | /* On Solaris, libpthread is just a filter library on top of libc. | ||
34 | * Threading and synchronization functions in runtime linker are not | ||
35 | @@ -91,9 +96,16 @@ | ||
36 | #define CREQ_PTHREAD_T Word | ||
37 | #define SEM_ERROR ret | ||
38 | #else | ||
39 | +#ifdef MUSL_LIBC | ||
40 | +#define PTH_FUNC(ret_ty, f, args...) \ | ||
41 | + ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \ | ||
42 | + ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args) | ||
43 | +#else | ||
44 | #define PTH_FUNC(ret_ty, f, args...) \ | ||
45 | ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args); \ | ||
46 | + hg_weak_alias(I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f), I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBC_SONAME,f)); \ | ||
47 | ret_ty I_WRAP_SONAME_FNNAME_ZZ(VG_Z_LIBPTHREAD_SONAME,f)(args) | ||
48 | +#endif | ||
49 | #define CREQ_PTHREAD_T pthread_t | ||
50 | #define SEM_ERROR errno | ||
51 | #endif /* VGO_solaris */ | ||
52 | -- | ||
53 | 2.17.1 | ||
54 | |||
diff --git a/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch b/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch index 7985308e41..0c399ef52c 100644 --- a/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch +++ b/meta/recipes-devtools/valgrind/valgrind/0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch | |||
@@ -19,6 +19,11 @@ Upstream-Status: Pending | |||
19 | Signed-off-by: Dave Lerner <dave.lerner@windriver.com> | 19 | Signed-off-by: Dave Lerner <dave.lerner@windriver.com> |
20 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> | 20 | Signed-off-by: Tudor Florea <tudor.florea@enea.com> |
21 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | 21 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
22 | |||
23 | Increase time limit to 90 s. | ||
24 | (double of the expected time of drd/tests/std_list on qemuarm64) | ||
25 | |||
26 | Signed-off-by: Yi Fan Yu <yifan.yu@windriver.com> | ||
22 | --- | 27 | --- |
23 | tests/vg_regtest.in | 75 +++++++++++++++++++++++++++++++++++++++-------------- | 28 | tests/vg_regtest.in | 75 +++++++++++++++++++++++++++++++++++++++-------------- |
24 | 1 file changed, 55 insertions(+), 20 deletions(-) | 29 | 1 file changed, 55 insertions(+), 20 deletions(-) |
@@ -66,7 +71,7 @@ index a441f42..cb05b52 100755 | |||
66 | # Since most of the program time is spent in system() calls, need this to | 71 | # Since most of the program time is spent in system() calls, need this to |
67 | # propagate a Ctrl-C enabling us to quit. | 72 | # propagate a Ctrl-C enabling us to quit. |
68 | -sub mysystem($) | 73 | -sub mysystem($) |
69 | +# Enforce 30 seconds limit for the test. | 74 | +# Enforce 90 seconds limit for the test. |
70 | +# This resume execution of the remaining tests if valgrind hangs. | 75 | +# This resume execution of the remaining tests if valgrind hangs. |
71 | +sub mysystem($) | 76 | +sub mysystem($) |
72 | { | 77 | { |
@@ -76,7 +81,7 @@ index a441f42..cb05b52 100755 | |||
76 | + my $exit_code=0; | 81 | + my $exit_code=0; |
77 | + eval { | 82 | + eval { |
78 | + local $SIG{'ALRM'} = sub { die "timed out\n" }; | 83 | + local $SIG{'ALRM'} = sub { die "timed out\n" }; |
79 | + alarm(30); | 84 | + alarm(90); |
80 | + $exit_code = system($_[0]); | 85 | + $exit_code = system($_[0]); |
81 | + alarm (0); | 86 | + alarm (0); |
82 | + ($exit_code == 2) and die "SIGINT\n"; # 2 is SIGINT | 87 | + ($exit_code == 2) and die "SIGINT\n"; # 2 is SIGINT |
diff --git a/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 b/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 index a3a0c6e50f..93bfd45a4e 100644 --- a/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 +++ b/meta/recipes-devtools/valgrind/valgrind/remove-for-aarch64 | |||
@@ -31,8 +31,6 @@ drd/tests/annotate_static | |||
31 | drd/tests/annotate_trace_memory | 31 | drd/tests/annotate_trace_memory |
32 | drd/tests/annotate_trace_memory_xml | 32 | drd/tests/annotate_trace_memory_xml |
33 | drd/tests/atomic_var | 33 | drd/tests/atomic_var |
34 | drd/tests/bar_bad | ||
35 | drd/tests/bar_bad_xml | ||
36 | drd/tests/bar_trivial | 34 | drd/tests/bar_trivial |
37 | drd/tests/bug-235681 | 35 | drd/tests/bug-235681 |
38 | drd/tests/bug322621 | 36 | drd/tests/bug322621 |
diff --git a/meta/recipes-devtools/valgrind/valgrind/remove-for-all b/meta/recipes-devtools/valgrind/valgrind/remove-for-all new file mode 100644 index 0000000000..d6a85c4735 --- /dev/null +++ b/meta/recipes-devtools/valgrind/valgrind/remove-for-all | |||
@@ -0,0 +1,2 @@ | |||
1 | drd/tests/bar_bad | ||
2 | drd/tests/bar_bad_xml | ||
diff --git a/meta/recipes-devtools/valgrind/valgrind/run-ptest b/meta/recipes-devtools/valgrind/valgrind/run-ptest index 97b0a85dbf..7217dfca5d 100755 --- a/meta/recipes-devtools/valgrind/valgrind/run-ptest +++ b/meta/recipes-devtools/valgrind/valgrind/run-ptest | |||
@@ -17,6 +17,12 @@ EXP_TOOLS="exp-bbv exp-dhat exp-sgcheck" | |||
17 | GDB_BIN=@bindir@/gdb | 17 | GDB_BIN=@bindir@/gdb |
18 | cd ${VALGRIND_LIB}/ptest && ./gdbserver_tests/make_local_links ${GDB_BIN} | 18 | cd ${VALGRIND_LIB}/ptest && ./gdbserver_tests/make_local_links ${GDB_BIN} |
19 | 19 | ||
20 | echo "Hide valgrind tests that are non-deterministic" | ||
21 | echo "Reported at https://bugs.kde.org/show_bug.cgi?id=430321" | ||
22 | for i in `cat remove-for-all`; do | ||
23 | mv $i.vgtest $i.IGNORE; | ||
24 | done | ||
25 | |||
20 | arch=`arch` | 26 | arch=`arch` |
21 | if [ "$arch" = "aarch64" ]; then | 27 | if [ "$arch" = "aarch64" ]; then |
22 | echo "Aarch64: Hide valgrind tests that result in defunct process and then out of memory" | 28 | echo "Aarch64: Hide valgrind tests that result in defunct process and then out of memory" |
@@ -44,6 +50,10 @@ if [ "$arch" = "aarch64" ]; then | |||
44 | done | 50 | done |
45 | fi | 51 | fi |
46 | 52 | ||
53 | echo "Restore valgrind tests that are non-deterministc" | ||
54 | for i in `cat remove-for-all`; do | ||
55 | mv $i.IGNORE $i.vgtest; | ||
56 | done | ||
47 | 57 | ||
48 | passed=`grep PASS: ${LOG}|wc -l` | 58 | passed=`grep PASS: ${LOG}|wc -l` |
49 | failed=`grep FAIL: ${LOG}|wc -l` | 59 | failed=`grep FAIL: ${LOG}|wc -l` |
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb index bcba55f327..fc070dec78 100644 --- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb +++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb | |||
@@ -16,6 +16,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \ | |||
16 | file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \ | 16 | file://Added-support-for-PPC-instructions-mfatbu-mfatbl.patch \ |
17 | file://run-ptest \ | 17 | file://run-ptest \ |
18 | file://remove-for-aarch64 \ | 18 | file://remove-for-aarch64 \ |
19 | file://remove-for-all \ | ||
19 | file://0004-Fix-out-of-tree-builds.patch \ | 20 | file://0004-Fix-out-of-tree-builds.patch \ |
20 | file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ | 21 | file://0005-Modify-vg_test-wrapper-to-support-PTEST-formats.patch \ |
21 | file://0001-Remove-tests-that-fail-to-build-on-some-PPC32-config.patch \ | 22 | file://0001-Remove-tests-that-fail-to-build-on-some-PPC32-config.patch \ |
@@ -42,6 +43,8 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \ | |||
42 | file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ | 43 | file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \ |
43 | file://0001-drd-Port-to-Fedora-33.patch \ | 44 | file://0001-drd-Port-to-Fedora-33.patch \ |
44 | file://0001-drd-musl-fix.patch \ | 45 | file://0001-drd-musl-fix.patch \ |
46 | file://0001-helgrind-Intercept-libc-functions.patch \ | ||
47 | file://0001-gdbserver_tests-Disable-nlcontrolc.vgtest-for-x86-64.patch \ | ||
45 | " | 48 | " |
46 | SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589" | 49 | SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589" |
47 | SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca" | 50 | SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca" |
@@ -185,6 +188,7 @@ do_install_ptest() { | |||
185 | # The scripts reference config.h so add it to the top ptest dir. | 188 | # The scripts reference config.h so add it to the top ptest dir. |
186 | cp ${B}/config.h ${D}${PTEST_PATH} | 189 | cp ${B}/config.h ${D}${PTEST_PATH} |
187 | install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} | 190 | install -D ${WORKDIR}/remove-for-aarch64 ${D}${PTEST_PATH} |
191 | install -D ${WORKDIR}/remove-for-all ${D}${PTEST_PATH} | ||
188 | 192 | ||
189 | # Add an executable need by none/tests/bigcode | 193 | # Add an executable need by none/tests/bigcode |
190 | mkdir ${D}${PTEST_PATH}/perf | 194 | mkdir ${D}${PTEST_PATH}/perf |
diff --git a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb index 7d27c43c83..5ed2709e31 100644 --- a/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb +++ b/meta/recipes-devtools/xmlto/xmlto_0.0.28.bb | |||
@@ -29,7 +29,7 @@ RDEPENDS_${PN}_append_class-target = " \ | |||
29 | libxslt-bin \ | 29 | libxslt-bin \ |
30 | coreutils \ | 30 | coreutils \ |
31 | " | 31 | " |
32 | CACHED_CONFIGUREVARS += "ac_cv_path_TAIL=tail" | 32 | CACHED_CONFIGUREVARS += "ac_cv_path_TAIL=tail ac_cv_path_GREP=grep" |
33 | 33 | ||
34 | BBCLASSEXTEND = "native" | 34 | BBCLASSEXTEND = "native" |
35 | 35 | ||