summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-12-26 12:09:54 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-12-27 22:52:58 +0000
commita50f80aef0bad5cea0d7d0f64a6dd0bdad1c6fd4 (patch)
tree39ba827ebbd7809e7ee6956162edd9470873f0fb /meta
parentc2e0d4d6b29833aad91c94cae7d3b04bd7a9a11e (diff)
downloadpoky-a50f80aef0bad5cea0d7d0f64a6dd0bdad1c6fd4.tar.gz
binutils: Upgrade to latest on 2.31 release branch
* Append minor version to PV so recipe checker is happy * Drop upstreamed patches * Remove changelog from CVE patches, they dont apply and are in patch log anyway (From OE-Core rev: 550085bc092d773c8c481e238d0d3210466166dc) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/binutils/binutils-2.31.inc8
-rw-r--r--meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch59
-rw-r--r--meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch201
-rw-r--r--meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch38
-rw-r--r--meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch46
-rw-r--r--meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch40
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch37
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch24
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch87
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch20
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch22
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch25
-rw-r--r--meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch8
13 files changed, 33 insertions, 582 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.31.inc b/meta/recipes-devtools/binutils/binutils-2.31.inc
index c3c15fb416..b8b2d97884 100644
--- a/meta/recipes-devtools/binutils/binutils-2.31.inc
+++ b/meta/recipes-devtools/binutils/binutils-2.31.inc
@@ -15,10 +15,11 @@ def binutils_branch_version(d):
15 return pvsplit[0] + "_" + pvsplit[1] 15 return pvsplit[0] + "_" + pvsplit[1]
16 16
17BINUPV = "${@binutils_branch_version(d)}" 17BINUPV = "${@binutils_branch_version(d)}"
18PV .= ".1"
18 19
19UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)" 20UPSTREAM_CHECK_GITTAGREGEX = "binutils-(?P<pver>\d+_(\d_?)*)"
20 21
21SRCREV ?= "4568e49ff799192fea4f66063fe13e2b871ec75a" 22SRCREV ?= "c909e7afdc4710851a53e86ebed8cea3879b26e5"
22BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=binutils-${BINUPV}-branch;protocol=git" 23BINUTILS_GIT_URI ?= "git://sourceware.org/git/binutils-gdb.git;branch=binutils-${BINUPV}-branch;protocol=git"
23SRC_URI = "\ 24SRC_URI = "\
24 ${BINUTILS_GIT_URI} \ 25 ${BINUTILS_GIT_URI} \
@@ -36,11 +37,6 @@ SRC_URI = "\
36 file://0014-Detect-64-bit-MIPS-targets.patch \ 37 file://0014-Detect-64-bit-MIPS-targets.patch \
37 file://0015-sync-with-OE-libtool-changes.patch \ 38 file://0015-sync-with-OE-libtool-changes.patch \
38 file://0016-add-i386pep-emulation-for-x86_64.patch \ 39 file://0016-add-i386pep-emulation-for-x86_64.patch \
39 file://0017-improve-check-for-input-file-matching-output-file.patch \
40 file://0018-Refactored-location-where-GOT-information-is-collect.patch \
41 file://0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch \
42 file://0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch \
43 file://0021-PLT-information-was-still-being-generated-when-symbo.patch \
44 file://clang-bfd-fix.patch \ 40 file://clang-bfd-fix.patch \
45 file://CVE-2018-17358.patch \ 41 file://CVE-2018-17358.patch \
46 file://CVE-2018-17360.patch \ 42 file://CVE-2018-17360.patch \
diff --git a/meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch b/meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch
deleted file mode 100644
index 265e52633b..0000000000
--- a/meta/recipes-devtools/binutils/binutils/0017-improve-check-for-input-file-matching-output-file.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From 2a50366ded329bfb39d387253450c9d5302c3503 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Tue, 14 Aug 2018 12:22:35 +0100
4Subject: [PATCH] as.c: Improve check for input file matching output file.
5
6When the assembler reports that the input and output are the same, report the
7file names involved, in order to help debugging. Also do not equate two files
8are the same if the have the same inode value but reside on different file
9systems.
10
11Upstream-Status: Backport
12
13Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
14---
15 gas/as.c | 27 ++++++++++++++++++++-------
16 2 files changed, 20 insertions(+), 7 deletions(-)
17
18diff --git a/gas/as.c b/gas/as.c
19index b2a908a..3105d06 100644
20--- a/gas/as.c
21+++ b/gas/as.c
22@@ -1259,14 +1259,27 @@ main (int argc, char ** argv)
23 {
24 struct stat sib;
25
26- if (stat (argv[i], &sib) == 0)
27+ /* Check that the input file and output file are different. */
28+ if (stat (argv[i], &sib) == 0
29+ && sib.st_ino == sob.st_ino
30+ /* POSIX emulating systems may support stat() but if the
31+ underlying file system does not support a file serial number
32+ of some kind then they will return 0 for the inode. So
33+ two files with an inode of 0 may not actually be the same.
34+ On real POSIX systems no ordinary file will ever have an
35+ inode of 0. */
36+ && sib.st_ino != 0
37+ /* Different files may have the same inode number if they
38+ reside on different devices, so check the st_dev field as
39+ well. */
40+ && sib.st_dev == sob.st_dev)
41 {
42- if (sib.st_ino == sob.st_ino && sib.st_ino != 0)
43- {
44- /* Don't let as_fatal remove the output file! */
45- out_file_name = NULL;
46- as_fatal (_("The input and output files must be distinct"));
47- }
48+ const char *saved_out_file_name = out_file_name;
49+
50+ /* Don't let as_fatal remove the output file! */
51+ out_file_name = NULL;
52+ as_fatal (_("The input '%s' and output '%s' files are the same"),
53+ argv[i], saved_out_file_name);
54 }
55 }
56 }
57--
582.7.4
59
diff --git a/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch b/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch
deleted file mode 100644
index d41339a9a6..0000000000
--- a/meta/recipes-devtools/binutils/binutils/0018-Refactored-location-where-GOT-information-is-collect.patch
+++ /dev/null
@@ -1,201 +0,0 @@
1From d930affa2d475d1cc6792f1e6d56bef3d6c617db Mon Sep 17 00:00:00 2001
2From: Cupertino Miranda <cmiranda@synopsys.com>
3Date: Fri, 2 Mar 2018 17:16:21 +0100
4Subject: [PATCH] Refactored location where GOT information is collected.
5
6Change location where GOT information is collected for ARC target, avoiding
7posible use conflicts of the previous .got field in the symbols hash_entry.
8
9bfd/
102018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
11
12 * arc-got.h (get_got_entry_list_for_symbol): Changed.
13 * ef32-arc.c (struct elf_arc_link_hash_entry): Moved and changed.
14 (elf_arc_link_hash_newfunc): Changed.
15 (arc_elf_link_hash_table_create): Removed old initializations.
16 (elf_arc_relocate_section, elf_arc_finish_dynamic_symbol): Changed.
17
18Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
19Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
20[Romain: rebase on top of 2.31]
21Signed-off-by: Romain Naour <romain.naour@gmail.com>
22
23Upstream-Status: Pending
24---
25 bfd/arc-got.h | 6 +++--
26 bfd/elf32-arc.c | 77 +++++++++++++++++++++++++++++++--------------------------
27 2 files changed, 46 insertions(+), 37 deletions(-)
28
29diff --git a/bfd/arc-got.h b/bfd/arc-got.h
30index a86061bcb38..81ce88fe21a 100644
31--- a/bfd/arc-got.h
32+++ b/bfd/arc-got.h
33@@ -156,9 +156,11 @@ get_got_entry_list_for_symbol (bfd *abfd,
34 unsigned long r_symndx,
35 struct elf_link_hash_entry *h)
36 {
37- if (h != NULL)
38+ struct elf_arc_link_hash_entry *h1 =
39+ ((struct elf_arc_link_hash_entry *) h);
40+ if (h1 != NULL)
41 {
42- return &h->got.glist;
43+ return &h1->got_ents;
44 }
45 else
46 {
47diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
48index a48ef0ca15f..ab84de43815 100644
49--- a/bfd/elf32-arc.c
50+++ b/bfd/elf32-arc.c
51@@ -160,6 +160,18 @@ struct arc_relocation_data
52 const char * symbol_name;
53 };
54
55+/* ARC ELF linker hash entry. */
56+struct elf_arc_link_hash_entry
57+{
58+ struct elf_link_hash_entry root;
59+
60+ /* Track dynamic relocs copied for this symbol. */
61+ struct elf_dyn_relocs *dyn_relocs;
62+
63+ struct got_entry *got_ents;
64+};
65+
66+
67 /* Should be included at this location due to static declarations
68 defined before this point. */
69 #include "arc-got.h"
70@@ -281,15 +293,6 @@ struct arc_reloc_map
71 unsigned char elf_reloc_val;
72 };
73
74-/* ARC ELF linker hash entry. */
75-struct elf_arc_link_hash_entry
76-{
77- struct elf_link_hash_entry root;
78-
79- /* Track dynamic relocs copied for this symbol. */
80- struct elf_dyn_relocs *dyn_relocs;
81-};
82-
83 /* ARC ELF linker hash table. */
84 struct elf_arc_link_hash_table
85 {
86@@ -301,28 +304,28 @@ elf_arc_link_hash_newfunc (struct bfd_hash_entry *entry,
87 struct bfd_hash_table *table,
88 const char *string)
89 {
90+ struct elf_arc_link_hash_entry * ret =
91+ (struct elf_arc_link_hash_entry *) entry;
92+
93 /* Allocate the structure if it has not already been allocated by a
94 subclass. */
95- if (entry == NULL)
96- {
97- entry = (struct bfd_hash_entry *)
98- bfd_hash_allocate (table,
99- sizeof (struct elf_arc_link_hash_entry));
100- if (entry == NULL)
101- return entry;
102- }
103+ if (ret == NULL)
104+ ret = (struct elf_arc_link_hash_entry *)
105+ bfd_hash_allocate (table, sizeof (struct elf_arc_link_hash_entry));
106+ if (ret == NULL)
107+ return (struct bfd_hash_entry *) ret;
108
109 /* Call the allocation method of the superclass. */
110- entry = _bfd_elf_link_hash_newfunc (entry, table, string);
111- if (entry != NULL)
112+ ret = ((struct elf_arc_link_hash_entry *)
113+ _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
114+ table, string));
115+ if (ret != NULL)
116 {
117- struct elf_arc_link_hash_entry *eh;
118-
119- eh = (struct elf_arc_link_hash_entry *) entry;
120- eh->dyn_relocs = NULL;
121+ ret->dyn_relocs = NULL;
122+ ret->got_ents = NULL;
123 }
124
125- return entry;
126+ return (struct bfd_hash_entry *) ret;
127 }
128
129 /* Destroy an ARC ELF linker hash table. */
130@@ -352,11 +355,6 @@ arc_elf_link_hash_table_create (bfd *abfd)
131 return NULL;
132 }
133
134- ret->elf.init_got_refcount.refcount = 0;
135- ret->elf.init_got_refcount.glist = NULL;
136- ret->elf.init_got_offset.offset = 0;
137- ret->elf.init_got_offset.glist = NULL;
138-
139 ret->elf.root.hash_table_free = elf_arc_link_hash_table_free;
140
141 return &ret->elf.root;
142@@ -1615,10 +1613,14 @@ elf_arc_relocate_section (bfd * output_bfd,
143 while (h->root.type == bfd_link_hash_indirect
144 || h->root.type == bfd_link_hash_warning)
145 {
146- struct elf_link_hash_entry *h_old = h;
147+ struct elf_arc_link_hash_entry *ah_old =
148+ (struct elf_arc_link_hash_entry *) h;
149 h = (struct elf_link_hash_entry *) h->root.u.i.link;
150- if (h->got.glist == 0 && h_old->got.glist != h->got.glist)
151- h->got.glist = h_old->got.glist;
152+ struct elf_arc_link_hash_entry *ah =
153+ (struct elf_arc_link_hash_entry *) h;
154+
155+ if (ah->got_ents == 0 && ah_old->got_ents != ah->got_ents)
156+ ah->got_ents = ah_old->got_ents;
157 }
158
159 /* TODO: Need to validate what was the intention. */
160@@ -1636,6 +1638,8 @@ elf_arc_relocate_section (bfd * output_bfd,
161
162 if (is_reloc_for_GOT (howto) && !bfd_link_pic (info))
163 {
164+ struct elf_arc_link_hash_entry *ah =
165+ (struct elf_arc_link_hash_entry *) h;
166 /* TODO: Change it to use arc_do_relocation with
167 ARC_32 reloc. Try to use ADD_RELA macro. */
168 bfd_vma relocation =
169@@ -1645,8 +1649,8 @@ elf_arc_relocate_section (bfd * output_bfd,
170 + reloc_data.sym_section->output_section->vma)
171 : 0);
172
173- BFD_ASSERT (h->got.glist);
174- bfd_vma got_offset = h->got.glist->offset;
175+ BFD_ASSERT (ah->got_ents);
176+ bfd_vma got_offset = ah->got_ents->offset;
177 bfd_put_32 (output_bfd, relocation,
178 htab->sgot->contents + got_offset);
179 }
180@@ -1958,6 +1962,7 @@ elf_arc_check_relocs (bfd * abfd,
181 else /* Global one. */
182 h = sym_hashes[r_symndx - symtab_hdr->sh_info];
183
184+
185 switch (r_type)
186 {
187 case R_ARC_32:
188@@ -2404,7 +2409,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
189 create respective dynamic relocs. */
190 /* TODO: Make function to get list and not access the list directly. */
191 /* TODO: Move function to relocate_section create this relocs eagerly. */
192- create_got_dynrelocs_for_got_info (&h->got.glist,
193+ struct elf_arc_link_hash_entry *ah =
194+ (struct elf_arc_link_hash_entry *) h;
195+ create_got_dynrelocs_for_got_info (&ah->got_ents,
196 output_bfd,
197 info,
198 h);
199--
2002.14.4
201
diff --git a/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch b/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch
deleted file mode 100644
index 6a58ee06ac..0000000000
--- a/meta/recipes-devtools/binutils/binutils/0019-Improved-robustness.-Return-FALSE-in-case-of-NULL-po.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From 955176bd999fe80c5b937ab8786665079e35c387 Mon Sep 17 00:00:00 2001
2From: Cupertino Miranda <cmiranda@synopsys.com>
3Date: Fri, 2 Mar 2018 17:33:48 +0100
4Subject: [PATCH] Improved robustness. Return FALSE in case of NULL pointer.
5
6bfd/
72018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
8
9 * elf32-arc.c (elf_arc_finish_dynamic_symbol) Return FALSE in case
10 arc_htab is NULL.
11
12Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
13Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
14[Romain: rebase on top of 2.31]
15Signed-off-by: Romain Naour <romain.naour@gmail.com>
16
17Upstream-Status: Pending
18---
19 bfd/elf32-arc.c | 3 +++
20 1 file changed, 3 insertions(+)
21
22diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
23index ab84de43815..33fc72cff6e 100644
24--- a/bfd/elf32-arc.c
25+++ b/bfd/elf32-arc.c
26@@ -2420,6 +2420,9 @@ elf_arc_finish_dynamic_symbol (bfd * output_bfd,
27 {
28 struct elf_arc_link_hash_table *arc_htab = elf_arc_hash_table (info);
29
30+ if(arc_htab == NULL)
31+ return FALSE;
32+
33 if (h->dynindx == -1
34 || (h->root.type != bfd_link_hash_defined
35 && h->root.type != bfd_link_hash_defweak)
36--
372.14.4
38
diff --git a/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch b/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch
deleted file mode 100644
index 01e42c03bb..0000000000
--- a/meta/recipes-devtools/binutils/binutils/0020-Make-sure-global-symbol-is-not-an-indirect-or-warnin.patch
+++ /dev/null
@@ -1,46 +0,0 @@
1From 9d09ce14b4eef2b56f24660fd69a44acd45128b2 Mon Sep 17 00:00:00 2001
2From: Cupertino Miranda <cmiranda@synopsys.com>
3Date: Fri, 2 Mar 2018 17:38:14 +0100
4Subject: [PATCH] Make sure global symbol is not an indirect or warning.
5
6Problem identified in the context of glibc with latest upstream binutils.
7Dynamic symbol space was being reserved but, no actual information for the
8symbol was being set. Data for the symbol was kept initialized with -1.
9No easy test case was possible to be created.
10
11bfd/
122018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
13
14 * elf32-arc.c (elf_arc_check_relocs): Changed.
15
16Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
17Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
18[Romain: rebase on top of 2.31]
19Signed-off-by: Romain Naour <romain.naour@gmail.com>
20
21Upstream-Status: Pending
22---
23 bfd/elf32-arc.c | 7 ++++++-
24 1 file changed, 6 insertions(+), 1 deletion(-)
25
26diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
27index 33fc72cff6e..9b72c5b4f4f 100644
28--- a/bfd/elf32-arc.c
29+++ b/bfd/elf32-arc.c
30@@ -1960,7 +1960,12 @@ elf_arc_check_relocs (bfd * abfd,
31 if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol. */
32 h = NULL;
33 else /* Global one. */
34- h = sym_hashes[r_symndx - symtab_hdr->sh_info];
35+ {
36+ h = sym_hashes[r_symndx - symtab_hdr->sh_info];
37+ while (h->root.type == bfd_link_hash_indirect
38+ || h->root.type == bfd_link_hash_warning)
39+ h = (struct elf_link_hash_entry *) h->root.u.i.link;
40+ }
41
42
43 switch (r_type)
44--
452.14.4
46
diff --git a/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch b/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch
deleted file mode 100644
index 9e942399c0..0000000000
--- a/meta/recipes-devtools/binutils/binutils/0021-PLT-information-was-still-being-generated-when-symbo.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From e4861c68067cb2166b4c2bb9c052abeb6ad9aaa1 Mon Sep 17 00:00:00 2001
2From: Cupertino Miranda <cmiranda@synopsys.com>
3Date: Fri, 2 Mar 2018 17:44:29 +0100
4Subject: [PATCH] PLT information was still being generated when symbol was
5 forced_local.
6
7A change upstream reveiled this issue, triggering an assert when linking glibc.
8
9bfd/
102018-03-01 Cupertino Miranda <cmiranda@synopsys.com>
11
12 * elf32-arc.c (elf_arc_check_relocs): Changed.
13
14Signed-off-by: Cupertino Miranda <cmiranda@synopsys.com>
15Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
16[Romain: rebase on top of 2.31]
17Signed-off-by: Romain Naour <romain.naour@gmail.com>
18
19Upstream-Status: Pending
20---
21 bfd/elf32-arc.c | 3 ++-
22 1 file changed, 2 insertions(+), 1 deletion(-)
23
24diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
25index 9b72c5b4f4f..b40b463d34d 100644
26--- a/bfd/elf32-arc.c
27+++ b/bfd/elf32-arc.c
28@@ -2041,7 +2041,8 @@ elf_arc_check_relocs (bfd * abfd,
29 if (h == NULL)
30 continue;
31 else
32- h->needs_plt = 1;
33+ if(h->forced_local == 0)
34+ h->needs_plt = 1;
35 }
36
37 /* Add info to the symbol got_entry_list. */
38--
392.14.4
40
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch b/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch
index 813509160f..d5a1ea1dc4 100644
--- a/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2018-17358.patch
@@ -21,25 +21,6 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
21 bfd/syms.c | 22 ++++++++++++++++------ 21 bfd/syms.c | 22 ++++++++++++++++------
22 3 files changed, 33 insertions(+), 7 deletions(-) 22 3 files changed, 33 insertions(+), 7 deletions(-)
23 23
24diff --git a/bfd/ChangeLog b/bfd/ChangeLog
25index 04c0c2a..fef5479 100644
26--- a/bfd/ChangeLog
27+++ b/bfd/ChangeLog
28@@ -1,3 +1,12 @@
29+2018-09-20 Alan Modra <amodra@gmail.com>
30+
31+ PR 23686
32+ * dwarf2.c (read_section): Error when attempting to malloc
33+ "(bfd_size_type) -1".
34+ * syms.c (_bfd_stab_section_find_nearest_line): Bounds check
35+ function_name. Bounds check reloc address. Formatting. Ensure
36+ .stabstr zero terminated.
37+
38 2018-08-12 H.J. Lu <hongjiu.lu@intel.com>
39
40 PR ld/23428
41diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
42index 3b28855..77a7368 100644
43--- a/bfd/dwarf2.c 24--- a/bfd/dwarf2.c
44+++ b/bfd/dwarf2.c 25+++ b/bfd/dwarf2.c
45@@ -527,6 +527,7 @@ read_section (bfd * abfd, 26@@ -527,6 +527,7 @@ read_section (bfd * abfd,
@@ -65,11 +46,9 @@ index 3b28855..77a7368 100644
65 if (contents == NULL) 46 if (contents == NULL)
66 return FALSE; 47 return FALSE;
67 if (syms 48 if (syms
68diff --git a/bfd/syms.c b/bfd/syms.c
69index 187071f..e09640a 100644
70--- a/bfd/syms.c 49--- a/bfd/syms.c
71+++ b/bfd/syms.c 50+++ b/bfd/syms.c
72@@ -1035,6 +1035,10 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, 51@@ -1035,6 +1035,10 @@ _bfd_stab_section_find_nearest_line (bfd
73 0, strsize)) 52 0, strsize))
74 return FALSE; 53 return FALSE;
75 54
@@ -80,7 +59,7 @@ index 187071f..e09640a 100644
80 /* If this is a relocatable object file, we have to relocate 59 /* If this is a relocatable object file, we have to relocate
81 the entries in .stab. This should always be simple 32 bit 60 the entries in .stab. This should always be simple 32 bit
82 relocations against symbols defined in this object file, so 61 relocations against symbols defined in this object file, so
83@@ -1073,7 +1077,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, 62@@ -1073,7 +1077,8 @@ _bfd_stab_section_find_nearest_line (bfd
84 || r->howto->bitsize != 32 63 || r->howto->bitsize != 32
85 || r->howto->pc_relative 64 || r->howto->pc_relative
86 || r->howto->bitpos != 0 65 || r->howto->bitpos != 0
@@ -90,7 +69,7 @@ index 187071f..e09640a 100644
90 { 69 {
91 _bfd_error_handler 70 _bfd_error_handler
92 (_("unsupported .stab relocation")); 71 (_("unsupported .stab relocation"));
93@@ -1195,7 +1200,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, 72@@ -1195,7 +1200,8 @@ _bfd_stab_section_find_nearest_line (bfd
94 { 73 {
95 nul_fun = stab; 74 nul_fun = stab;
96 nul_str = str; 75 nul_str = str;
@@ -100,7 +79,7 @@ index 187071f..e09640a 100644
100 file_name = NULL; 79 file_name = NULL;
101 if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize 80 if (stab + STABSIZE + TYPEOFF < info->stabs + stabsize
102 && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO) 81 && *(stab + STABSIZE + TYPEOFF) == (bfd_byte) N_SO)
103@@ -1206,7 +1212,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, 82@@ -1206,7 +1212,8 @@ _bfd_stab_section_find_nearest_line (bfd
104 directory_name = file_name; 83 directory_name = file_name;
105 file_name = ((char *) str 84 file_name = ((char *) str
106 + bfd_get_32 (abfd, stab + STRDXOFF)); 85 + bfd_get_32 (abfd, stab + STRDXOFF));
@@ -110,7 +89,7 @@ index 187071f..e09640a 100644
110 file_name = NULL; 89 file_name = NULL;
111 } 90 }
112 } 91 }
113@@ -1217,7 +1224,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, 92@@ -1217,7 +1224,8 @@ _bfd_stab_section_find_nearest_line (bfd
114 file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); 93 file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
115 /* PR 17512: file: 0c680a1f. */ 94 /* PR 17512: file: 0c680a1f. */
116 /* PR 17512: file: 5da8aec4. */ 95 /* PR 17512: file: 5da8aec4. */
@@ -120,7 +99,7 @@ index 187071f..e09640a 100644
120 file_name = NULL; 99 file_name = NULL;
121 break; 100 break;
122 101
123@@ -1226,7 +1234,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, 102@@ -1226,7 +1234,8 @@ _bfd_stab_section_find_nearest_line (bfd
124 function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); 103 function_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
125 if (function_name == (char *) str) 104 if (function_name == (char *) str)
126 continue; 105 continue;
@@ -130,7 +109,7 @@ index 187071f..e09640a 100644
130 function_name = NULL; 109 function_name = NULL;
131 110
132 nul_fun = NULL; 111 nul_fun = NULL;
133@@ -1335,7 +1344,8 @@ _bfd_stab_section_find_nearest_line (bfd *abfd, 112@@ -1335,7 +1344,8 @@ _bfd_stab_section_find_nearest_line (bfd
134 if (val <= offset) 113 if (val <= offset)
135 { 114 {
136 file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF); 115 file_name = (char *) str + bfd_get_32 (abfd, stab + STRDXOFF);
@@ -140,5 +119,3 @@ index 187071f..e09640a 100644
140 file_name = NULL; 119 file_name = NULL;
141 *pline = 0; 120 *pline = 0;
142 } 121 }
143--
1442.9.3
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch b/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch
index cef10a7546..45c637967b 100644
--- a/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2018-17360.patch
@@ -15,27 +15,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
15 bfd/peXXigen.c | 11 ++++++----- 15 bfd/peXXigen.c | 11 ++++++-----
16 2 files changed, 12 insertions(+), 5 deletions(-) 16 2 files changed, 12 insertions(+), 5 deletions(-)
17 17
18diff --git a/bfd/ChangeLog b/bfd/ChangeLog
19index fef5479..81b9e56 100644
20--- a/bfd/ChangeLog
21+++ b/bfd/ChangeLog
22@@ -1,5 +1,11 @@
23 2018-09-20 Alan Modra <amodra@gmail.com>
24
25+ PR 23685
26+ * peXXigen.c (pe_print_edata): Correct export address table
27+ overflow checks. Check dataoff against section size too.
28+
29+2018-09-20 Alan Modra <amodra@gmail.com>
30+
31 PR 23686
32 * dwarf2.c (read_section): Error when attempting to malloc
33 "(bfd_size_type) -1".
34diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
35index 598f2ca..1645ef4 100644
36--- a/bfd/peXXigen.c 18--- a/bfd/peXXigen.c
37+++ b/bfd/peXXigen.c 19+++ b/bfd/peXXigen.c
38@@ -1661,7 +1661,8 @@ pe_print_edata (bfd * abfd, void * vfile) 20@@ -1661,7 +1661,8 @@ pe_print_edata (bfd * abfd, void * vfile
39 21
40 dataoff = addr - section->vma; 22 dataoff = addr - section->vma;
41 datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size; 23 datasize = extra->DataDirectory[PE_EXPORT_TABLE].Size;
@@ -45,7 +27,7 @@ index 598f2ca..1645ef4 100644
45 { 27 {
46 fprintf (file, 28 fprintf (file,
47 _("\nThere is an export table in %s, but it does not fit into that section\n"), 29 _("\nThere is an export table in %s, but it does not fit into that section\n"),
48@@ -1778,11 +1779,11 @@ pe_print_edata (bfd * abfd, void * vfile) 30@@ -1778,11 +1779,11 @@ pe_print_edata (bfd * abfd, void * vfile
49 edt.base); 31 edt.base);
50 32
51 /* PR 17512: Handle corrupt PE binaries. */ 33 /* PR 17512: Handle corrupt PE binaries. */
@@ -61,5 +43,3 @@ index 598f2ca..1645ef4 100644
61 fprintf (file, _("\tInvalid Export Address Table rva (0x%lx) or entry count (0x%lx)\n"), 43 fprintf (file, _("\tInvalid Export Address Table rva (0x%lx) or entry count (0x%lx)\n"),
62 (long) edt.eat_addr, 44 (long) edt.eat_addr,
63 (long) edt.num_functions); 45 (long) edt.num_functions);
64--
652.9.3
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch b/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch
index b240a3f994..010e6b5d53 100644
--- a/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2018-18309.patch
@@ -49,39 +49,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
49 bfd/reloc.c | 19 +++++++++++++------ 49 bfd/reloc.c | 19 +++++++++++++------
50 14 files changed, 50 insertions(+), 23 deletions(-) 50 14 files changed, 50 insertions(+), 23 deletions(-)
51 51
52diff --git a/bfd/ChangeLog b/bfd/ChangeLog
53index 68c1ff665b..e9696ee314 100644
54--- a/bfd/ChangeLog
55+++ b/bfd/ChangeLog
56@@ -1,3 +1,23 @@
57+2018-10-13 Alan Modra <amodra@gmail.com>
58+
59+ PR 23770
60+ PR 23425
61+ * reloc.c (_bfd_clear_contents): Replace "location" param with
62+ "buf" and "off". Bounds check "off". Return status.
63+ * cofflink.c (_bfd_coff_generic_relocate_section): Update
64+ _bfd_clear_contents call.
65+ * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Likewise.
66+ * elf32-arc.c (elf_arc_relocate_section): Likewise.
67+ * elf32-i386.c (elf_i386_relocate_section): Likewise.
68+ * elf32-metag.c (metag_final_link_relocate): Likewise.
69+ * elf32-nds32.c (nds32_elf_get_relocated_section_contents): Likewise.
70+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
71+ * elf32-visium.c (visium_elf_relocate_section): Likewise.
72+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
73+ * elf64-x86-64.c *(elf_x86_64_relocate_section): Likewise.
74+ * libbfd-in.h (_bfd_clear_contents): Update prototype.
75+ * libbfd.h: Regenerate.
76+
77 2018-09-20 Alan Modra <amodra@gmail.com>
78
79 PR 23685
80diff --git a/bfd/cofflink.c b/bfd/cofflink.c
81index 2f73f72e31..b7ea69b7f9 100644
82--- a/bfd/cofflink.c 52--- a/bfd/cofflink.c
83+++ b/bfd/cofflink.c 53+++ b/bfd/cofflink.c
84@@ -3080,7 +3080,7 @@ _bfd_coff_generic_relocate_section (bfd *output_bfd, 54@@ -3080,7 +3080,7 @@ _bfd_coff_generic_relocate_section (bfd
85 if (sec != NULL && discarded_section (sec)) 55 if (sec != NULL && discarded_section (sec))
86 { 56 {
87 _bfd_clear_contents (howto, input_bfd, input_section, 57 _bfd_clear_contents (howto, input_bfd, input_section,
@@ -90,11 +60,9 @@ index 2f73f72e31..b7ea69b7f9 100644
90 continue; 60 continue;
91 } 61 }
92 62
93diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
94index cf256f70e0..3374f411f9 100644
95--- a/bfd/elf-bfd.h 63--- a/bfd/elf-bfd.h
96+++ b/bfd/elf-bfd.h 64+++ b/bfd/elf-bfd.h
97@@ -2811,7 +2811,7 @@ extern asection _bfd_elf_large_com_section; 65@@ -2811,7 +2811,7 @@ extern asection _bfd_elf_large_com_secti
98 { \ 66 { \
99 int i_; \ 67 int i_; \
100 _bfd_clear_contents (howto, input_bfd, input_section, \ 68 _bfd_clear_contents (howto, input_bfd, input_section, \
@@ -103,11 +71,9 @@ index cf256f70e0..3374f411f9 100644
103 \ 71 \
104 if (bfd_link_relocatable (info) \ 72 if (bfd_link_relocatable (info) \
105 && (input_section->flags & SEC_DEBUGGING)) \ 73 && (input_section->flags & SEC_DEBUGGING)) \
106diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
107index 7a1b3042ae..30f47a5b22 100644
108--- a/bfd/elf32-arc.c 74--- a/bfd/elf32-arc.c
109+++ b/bfd/elf32-arc.c 75+++ b/bfd/elf32-arc.c
110@@ -1549,7 +1549,7 @@ elf_arc_relocate_section (bfd * output_bfd, 76@@ -1552,7 +1552,7 @@ elf_arc_relocate_section (bfd * outp
111 if (sec != NULL && discarded_section (sec)) 77 if (sec != NULL && discarded_section (sec))
112 { 78 {
113 _bfd_clear_contents (howto, input_bfd, input_section, 79 _bfd_clear_contents (howto, input_bfd, input_section,
@@ -116,11 +82,9 @@ index 7a1b3042ae..30f47a5b22 100644
116 rel->r_info = 0; 82 rel->r_info = 0;
117 rel->r_addend = 0; 83 rel->r_addend = 0;
118 84
119diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
120index 49797dcbfa..177471777d 100644
121--- a/bfd/elf32-i386.c 85--- a/bfd/elf32-i386.c
122+++ b/bfd/elf32-i386.c 86+++ b/bfd/elf32-i386.c
123@@ -2197,7 +2197,7 @@ elf_i386_relocate_section (bfd *output_bfd, 87@@ -2197,7 +2197,7 @@ elf_i386_relocate_section (bfd *output_b
124 if (sec != NULL && discarded_section (sec)) 88 if (sec != NULL && discarded_section (sec))
125 { 89 {
126 _bfd_clear_contents (howto, input_bfd, input_section, 90 _bfd_clear_contents (howto, input_bfd, input_section,
@@ -129,11 +93,9 @@ index 49797dcbfa..177471777d 100644
129 wrel->r_offset = rel->r_offset; 93 wrel->r_offset = rel->r_offset;
130 wrel->r_info = 0; 94 wrel->r_info = 0;
131 wrel->r_addend = 0; 95 wrel->r_addend = 0;
132diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
133index efe95bddff..7f96246e5d 100644
134--- a/bfd/elf32-metag.c 96--- a/bfd/elf32-metag.c
135+++ b/bfd/elf32-metag.c 97+++ b/bfd/elf32-metag.c
136@@ -1396,7 +1396,7 @@ metag_final_link_relocate (reloc_howto_type *howto, 98@@ -1396,7 +1396,7 @@ metag_final_link_relocate (reloc_howto_t
137 rel, relend, howto, contents) \ 99 rel, relend, howto, contents) \
138 { \ 100 { \
139 _bfd_clear_contents (howto, input_bfd, input_section, \ 101 _bfd_clear_contents (howto, input_bfd, input_section, \
@@ -142,11 +104,9 @@ index efe95bddff..7f96246e5d 100644
142 \ 104 \
143 if (bfd_link_relocatable (info) \ 105 if (bfd_link_relocatable (info) \
144 && (input_section->flags & SEC_DEBUGGING)) \ 106 && (input_section->flags & SEC_DEBUGGING)) \
145diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
146index 0d86e5b865..184cf320f7 100644
147--- a/bfd/elf32-nds32.c 107--- a/bfd/elf32-nds32.c
148+++ b/bfd/elf32-nds32.c 108+++ b/bfd/elf32-nds32.c
149@@ -12582,14 +12582,14 @@ nds32_elf_get_relocated_section_contents (bfd *abfd, 109@@ -12582,14 +12582,14 @@ nds32_elf_get_relocated_section_contents
150 symbol = *(*parent)->sym_ptr_ptr; 110 symbol = *(*parent)->sym_ptr_ptr;
151 if (symbol->section && discarded_section (symbol->section)) 111 if (symbol->section && discarded_section (symbol->section))
152 { 112 {
@@ -165,11 +125,9 @@ index 0d86e5b865..184cf320f7 100644
165 (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; 125 (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
166 (*parent)->addend = 0; 126 (*parent)->addend = 0;
167 (*parent)->howto = &none_howto; 127 (*parent)->howto = &none_howto;
168diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
169index 61f70de12e..c31e26efd7 100644
170--- a/bfd/elf32-ppc.c 128--- a/bfd/elf32-ppc.c
171+++ b/bfd/elf32-ppc.c 129+++ b/bfd/elf32-ppc.c
172@@ -8232,7 +8232,7 @@ ppc_elf_relocate_section (bfd *output_bfd, 130@@ -8232,7 +8232,7 @@ ppc_elf_relocate_section (bfd *output_bf
173 howto = ppc_elf_howto_table[r_type]; 131 howto = ppc_elf_howto_table[r_type];
174 132
175 _bfd_clear_contents (howto, input_bfd, input_section, 133 _bfd_clear_contents (howto, input_bfd, input_section,
@@ -178,11 +136,9 @@ index 61f70de12e..c31e26efd7 100644
178 wrel->r_offset = rel->r_offset; 136 wrel->r_offset = rel->r_offset;
179 wrel->r_info = 0; 137 wrel->r_info = 0;
180 wrel->r_addend = 0; 138 wrel->r_addend = 0;
181diff --git a/bfd/elf32-visium.c b/bfd/elf32-visium.c
182index e8f1c4c9e4..961366cd87 100644
183--- a/bfd/elf32-visium.c 139--- a/bfd/elf32-visium.c
184+++ b/bfd/elf32-visium.c 140+++ b/bfd/elf32-visium.c
185@@ -621,7 +621,7 @@ visium_elf_relocate_section (bfd *output_bfd, 141@@ -621,7 +621,7 @@ visium_elf_relocate_section (bfd *output
186 or sections discarded by a linker script, we just want the 142 or sections discarded by a linker script, we just want the
187 section contents zeroed. Avoid any special processing. */ 143 section contents zeroed. Avoid any special processing. */
188 _bfd_clear_contents (howto, input_bfd, input_section, 144 _bfd_clear_contents (howto, input_bfd, input_section,
@@ -191,11 +147,9 @@ index e8f1c4c9e4..961366cd87 100644
191 147
192 rel->r_info = 0; 148 rel->r_info = 0;
193 rel->r_addend = 0; 149 rel->r_addend = 0;
194diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
195index eadde17615..7c3534ac65 100644
196--- a/bfd/elf64-ppc.c 150--- a/bfd/elf64-ppc.c
197+++ b/bfd/elf64-ppc.c 151+++ b/bfd/elf64-ppc.c
198@@ -14073,7 +14073,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, 152@@ -14074,7 +14074,7 @@ ppc64_elf_relocate_section (bfd *output_
199 { 153 {
200 _bfd_clear_contents (ppc64_elf_howto_table[r_type], 154 _bfd_clear_contents (ppc64_elf_howto_table[r_type],
201 input_bfd, input_section, 155 input_bfd, input_section,
@@ -204,11 +158,9 @@ index eadde17615..7c3534ac65 100644
204 wrel->r_offset = rel->r_offset; 158 wrel->r_offset = rel->r_offset;
205 wrel->r_info = 0; 159 wrel->r_info = 0;
206 wrel->r_addend = 0; 160 wrel->r_addend = 0;
207diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
208index c3a6c31ed2..4dcab43478 100644
209--- a/bfd/elf64-x86-64.c 161--- a/bfd/elf64-x86-64.c
210+++ b/bfd/elf64-x86-64.c 162+++ b/bfd/elf64-x86-64.c
211@@ -2490,7 +2490,7 @@ elf_x86_64_relocate_section (bfd *output_bfd, 163@@ -2490,7 +2490,7 @@ elf_x86_64_relocate_section (bfd *output
212 if (sec != NULL && discarded_section (sec)) 164 if (sec != NULL && discarded_section (sec))
213 { 165 {
214 _bfd_clear_contents (howto, input_bfd, input_section, 166 _bfd_clear_contents (howto, input_bfd, input_section,
@@ -217,11 +169,9 @@ index c3a6c31ed2..4dcab43478 100644
217 wrel->r_offset = rel->r_offset; 169 wrel->r_offset = rel->r_offset;
218 wrel->r_info = 0; 170 wrel->r_info = 0;
219 wrel->r_addend = 0; 171 wrel->r_addend = 0;
220diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
221index e53b255dad..f6d9565f03 100644
222--- a/bfd/libbfd-in.h 172--- a/bfd/libbfd-in.h
223+++ b/bfd/libbfd-in.h 173+++ b/bfd/libbfd-in.h
224@@ -696,8 +696,8 @@ extern bfd_reloc_status_type _bfd_relocate_contents 174@@ -696,8 +696,8 @@ extern bfd_reloc_status_type _bfd_reloca
225 (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN; 175 (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN;
226 176
227 /* Clear a given location using a given howto. */ 177 /* Clear a given location using a given howto. */
@@ -232,11 +182,9 @@ index e53b255dad..f6d9565f03 100644
232 182
233 /* Link stabs in sections in the first pass. */ 183 /* Link stabs in sections in the first pass. */
234 184
235diff --git a/bfd/libbfd.h b/bfd/libbfd.h
236index a8851c8026..1189e63358 100644
237--- a/bfd/libbfd.h 185--- a/bfd/libbfd.h
238+++ b/bfd/libbfd.h 186+++ b/bfd/libbfd.h
239@@ -701,8 +701,8 @@ extern bfd_reloc_status_type _bfd_relocate_contents 187@@ -701,8 +701,8 @@ extern bfd_reloc_status_type _bfd_reloca
240 (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN; 188 (reloc_howto_type *, bfd *, bfd_vma, bfd_byte *) ATTRIBUTE_HIDDEN;
241 189
242 /* Clear a given location using a given howto. */ 190 /* Clear a given location using a given howto. */
@@ -247,11 +195,9 @@ index a8851c8026..1189e63358 100644
247 195
248 /* Link stabs in sections in the first pass. */ 196 /* Link stabs in sections in the first pass. */
249 197
250diff --git a/bfd/reloc.c b/bfd/reloc.c
251index 8dbb8896d3..1686780669 100644
252--- a/bfd/reloc.c 198--- a/bfd/reloc.c
253+++ b/bfd/reloc.c 199+++ b/bfd/reloc.c
254@@ -1613,16 +1613,22 @@ _bfd_relocate_contents (reloc_howto_type *howto, 200@@ -1613,16 +1613,22 @@ _bfd_relocate_contents (reloc_howto_type
255 relocations against discarded symbols, to make ignorable debug or unwind 201 relocations against discarded symbols, to make ignorable debug or unwind
256 information more obvious. */ 202 information more obvious. */
257 203
@@ -276,7 +222,7 @@ index 8dbb8896d3..1686780669 100644
276 size = bfd_get_reloc_size (howto); 222 size = bfd_get_reloc_size (howto);
277 switch (size) 223 switch (size)
278 { 224 {
279@@ -1687,6 +1693,7 @@ _bfd_clear_contents (reloc_howto_type *howto, 225@@ -1681,6 +1687,7 @@ _bfd_clear_contents (reloc_howto_type *h
280 #endif 226 #endif
281 break; 227 break;
282 } 228 }
@@ -284,7 +230,7 @@ index 8dbb8896d3..1686780669 100644
284 } 230 }
285 231
286 /* 232 /*
287@@ -8275,14 +8282,14 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, 233@@ -8268,14 +8275,14 @@ bfd_generic_get_relocated_section_conten
288 234
289 if (symbol->section && discarded_section (symbol->section)) 235 if (symbol->section && discarded_section (symbol->section))
290 { 236 {
@@ -303,6 +249,3 @@ index 8dbb8896d3..1686780669 100644
303 (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; 249 (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
304 (*parent)->addend = 0; 250 (*parent)->addend = 0;
305 (*parent)->howto = &none_howto; 251 (*parent)->howto = &none_howto;
306--
3072.13.3
308
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch b/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch
index d6c7067715..a117f95df1 100644
--- a/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2018-18605.patch
@@ -15,25 +15,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
15 bfd/merge.c | 3 +++ 15 bfd/merge.c | 3 +++
16 2 files changed, 9 insertions(+) 16 2 files changed, 9 insertions(+)
17 17
18diff --git a/bfd/ChangeLog b/bfd/ChangeLog
19index 31ff3d6..da423b1 100644
20--- a/bfd/ChangeLog
21+++ b/bfd/ChangeLog
22@@ -1,3 +1,9 @@
23+2018-10-23 Alan Modra <amodra@gmail.com>
24+
25+ PR 23804
26+ * merge.c (_bfd_add_merge_section): Don't attempt to merge
27+ sections where size is not a multiple of entsize.
28+
29 2018-10-13 Alan Modra <amodra@gmail.com>
30
31 PR 23770
32diff --git a/bfd/merge.c b/bfd/merge.c
33index 7904552..5e3bba0 100644
34--- a/bfd/merge.c 18--- a/bfd/merge.c
35+++ b/bfd/merge.c 19+++ b/bfd/merge.c
36@@ -376,6 +376,9 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec, 20@@ -376,6 +376,9 @@ _bfd_add_merge_section (bfd *abfd, void
37 || sec->entsize == 0) 21 || sec->entsize == 0)
38 return TRUE; 22 return TRUE;
39 23
@@ -43,5 +27,3 @@ index 7904552..5e3bba0 100644
43 if ((sec->flags & SEC_RELOC) != 0) 27 if ((sec->flags & SEC_RELOC) != 0)
44 { 28 {
45 /* We aren't prepared to handle relocations in merged sections. */ 29 /* We aren't prepared to handle relocations in merged sections. */
46--
472.9.3
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch b/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch
index 35cf328a14..325c339b88 100644
--- a/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2018-18606.patch
@@ -15,24 +15,6 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
15 bfd/merge.c | 15 +++++++++++---- 15 bfd/merge.c | 15 +++++++++++----
16 2 files changed, 17 insertions(+), 4 deletions(-) 16 2 files changed, 17 insertions(+), 4 deletions(-)
17 17
18diff --git a/bfd/ChangeLog b/bfd/ChangeLog
19index 1f3fc1c..c5f7ec7 100644
20--- a/bfd/ChangeLog
21+++ b/bfd/ChangeLog
22@@ -1,5 +1,11 @@
23 2018-10-23 Alan Modra <amodra@gmail.com>
24
25+ PR 23806
26+ * merge.c (_bfd_add_merge_section): Don't attempt to merge
27+ sections with ridiculously large alignments.
28+
29+2018-10-23 Alan Modra <amodra@gmail.com>
30+
31 PR 23804
32 * merge.c (_bfd_add_merge_section): Don't attempt to merge
33 sections where size is not a multiple of entsize.
34diff --git a/bfd/merge.c b/bfd/merge.c
35index 5e3bba0..7de0c88 100644
36--- a/bfd/merge.c 18--- a/bfd/merge.c
37+++ b/bfd/merge.c 19+++ b/bfd/merge.c
38@@ -24,6 +24,7 @@ 20@@ -24,6 +24,7 @@
@@ -43,7 +25,7 @@ index 5e3bba0..7de0c88 100644
43 #include "bfd.h" 25 #include "bfd.h"
44 #include "elf-bfd.h" 26 #include "elf-bfd.h"
45 #include "libbfd.h" 27 #include "libbfd.h"
46@@ -385,12 +386,18 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec, 28@@ -385,12 +386,18 @@ _bfd_add_merge_section (bfd *abfd, void
47 return TRUE; 29 return TRUE;
48 } 30 }
49 31
@@ -66,5 +48,3 @@ index 5e3bba0..7de0c88 100644
66 { 48 {
67 /* Sanity check. If string character size is smaller than 49 /* Sanity check. If string character size is smaller than
68 alignment, then we require character size to be a power 50 alignment, then we require character size to be a power
69--
702.9.3
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch b/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch
index 38225d171e..902a90dbc3 100644
--- a/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2018-18607.patch
@@ -16,28 +16,9 @@ Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
16 bfd/elflink.c | 20 ++++++++++++++------ 16 bfd/elflink.c | 20 ++++++++++++++------
17 2 files changed, 21 insertions(+), 6 deletions(-) 17 2 files changed, 21 insertions(+), 6 deletions(-)
18 18
19diff --git a/bfd/ChangeLog b/bfd/ChangeLog
20index da423b1..1f3fc1c 100644
21--- a/bfd/ChangeLog
22+++ b/bfd/ChangeLog
23@@ -1,5 +1,12 @@
24 2018-10-23 Alan Modra <amodra@gmail.com>
25
26+ PR 23805
27+ * elflink.c (elf_link_input_bfd): Don't segfault on finding
28+ STT_TLS symbols without any TLS sections. Instead, change the
29+ symbol type to STT_NOTYPE.
30+
31+2018-10-23 Alan Modra <amodra@gmail.com>
32+
33 PR 23806
34 * merge.c (_bfd_add_merge_section): Don't attempt to merge
35 sections with ridiculously large alignments.
36diff --git a/bfd/elflink.c b/bfd/elflink.c
37index c3876cb..87440db 100644
38--- a/bfd/elflink.c 19--- a/bfd/elflink.c
39+++ b/bfd/elflink.c 20+++ b/bfd/elflink.c
40@@ -10489,8 +10489,11 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) 21@@ -10496,8 +10496,11 @@ elf_link_input_bfd (struct elf_final_lin
41 if (ELF_ST_TYPE (osym.st_info) == STT_TLS) 22 if (ELF_ST_TYPE (osym.st_info) == STT_TLS)
42 { 23 {
43 /* STT_TLS symbols are relative to PT_TLS segment base. */ 24 /* STT_TLS symbols are relative to PT_TLS segment base. */
@@ -51,7 +32,7 @@ index c3876cb..87440db 100644
51 } 32 }
52 } 33 }
53 34
54@@ -11046,12 +11049,17 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) 35@@ -11053,12 +11056,17 @@ elf_link_input_bfd (struct elf_final_lin
55 sym.st_value += osec->vma; 36 sym.st_value += osec->vma;
56 if (ELF_ST_TYPE (sym.st_info) == STT_TLS) 37 if (ELF_ST_TYPE (sym.st_info) == STT_TLS)
57 { 38 {
@@ -73,5 +54,3 @@ index c3876cb..87440db 100644
73 } 54 }
74 } 55 }
75 56
76--
772.9.3
diff --git a/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch b/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch
index caf78488df..29c0d48fed 100644
--- a/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch
+++ b/meta/recipes-devtools/binutils/binutils/clang-bfd-fix.patch
@@ -17,11 +17,9 @@ Upstream-Status: Backport [Fixes differently]
17 17
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19 19
20Index: git/bfd/reloc.c 20--- a/bfd/reloc.c
21=================================================================== 21+++ b/bfd/reloc.c
22--- git.orig/bfd/reloc.c 22@@ -1629,7 +1629,7 @@ _bfd_clear_contents (reloc_howto_type *h
23+++ git/bfd/reloc.c
24@@ -1635,7 +1635,7 @@ _bfd_clear_contents (reloc_howto_type *h
25 default: 23 default:
26 abort (); 24 abort ();
27 case 0: 25 case 0: