summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2018-11-02 17:52:50 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-07 23:08:54 +0000
commit4f6bb406d0834ae7e6b376fa18958c6089635ae9 (patch)
treea2bbf5c86f9f3f6f4d2363403b4e1367b39ac82f /meta/recipes-devtools
parent68b68dc28a08acf90ca5646be501e8dd2a87bc3a (diff)
downloadpoky-4f6bb406d0834ae7e6b376fa18958c6089635ae9.tar.gz
elfutils: 0.173 -> 0.174
- Drop backport fixes CVE-2018-16062.patch 0001-libdw-Check-end-of-attributes-list-consistently.patch 0002-libelf-Return-error-if-elf_compress_gnu-is-used-on-S.patch - Rebase 0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch (From OE-Core rev: 777c1f8b6e20643964c304400e2d746dc2926524) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/elfutils/elfutils_0.174.bb (renamed from meta/recipes-devtools/elfutils/elfutils_0.173.bb)7
-rw-r--r--meta/recipes-devtools/elfutils/files/0001-libdw-Check-end-of-attributes-list-consistently.patch84
-rw-r--r--meta/recipes-devtools/elfutils/files/0002-libelf-Return-error-if-elf_compress_gnu-is-used-on-S.patch59
-rw-r--r--meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch808
-rw-r--r--meta/recipes-devtools/elfutils/files/CVE-2018-16062.patch79
5 files changed, 22 insertions, 1015 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.173.bb b/meta/recipes-devtools/elfutils/elfutils_0.174.bb
index 00dab65607..88add7b4cc 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.173.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.174.bb
@@ -28,14 +28,11 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
28 file://debian/ignore_strmerge.diff \ 28 file://debian/ignore_strmerge.diff \
29 file://debian/0001-fix-gcc7-ftbfs.patch \ 29 file://debian/0001-fix-gcc7-ftbfs.patch \
30 file://debian/0001-disable_werror.patch \ 30 file://debian/0001-disable_werror.patch \
31 file://CVE-2018-16062.patch \
32 file://0001-libdw-Check-end-of-attributes-list-consistently.patch \
33 file://0002-libelf-Return-error-if-elf_compress_gnu-is-used-on-S.patch \
34 " 31 "
35SRC_URI_append_libc-musl = " file://0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch" 32SRC_URI_append_libc-musl = " file://0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch"
36 33
37SRC_URI[md5sum] = "35decb1ebfb90d565e4c411bee4185cc" 34SRC_URI[md5sum] = "48bec24c0c8b2c16820326956dff9378"
38SRC_URI[sha256sum] = "b76d8c133f68dad46250f5c223482c8299d454a69430d9aa5c19123345a000ff" 35SRC_URI[sha256sum] = "cdf27e70076e10a29539d89e367101d516bc4aa11b0d7777fe52139e3fcad08a"
39 36
40inherit autotools gettext 37inherit autotools gettext
41 38
diff --git a/meta/recipes-devtools/elfutils/files/0001-libdw-Check-end-of-attributes-list-consistently.patch b/meta/recipes-devtools/elfutils/files/0001-libdw-Check-end-of-attributes-list-consistently.patch
deleted file mode 100644
index fb7f8b1780..0000000000
--- a/meta/recipes-devtools/elfutils/files/0001-libdw-Check-end-of-attributes-list-consistently.patch
+++ /dev/null
@@ -1,84 +0,0 @@
1From 146456c537de5ac7c80608f88babbba026cca03b Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Sat, 18 Aug 2018 19:51:27 +0200
4Subject: [PATCH 1/2] libdw: Check end of attributes list consistently.
5
6dwarf_child (__libdw_find_attr), dwarf_getabbrevattr[_data] and
7dwarf_getattrs all assume the end of the attribute list is when
8both the name (code) and form of the attribute are zero.
9
10dwarf_getabbrev (__libdw_getabbrev) and dwarf_hasattr assume the
11end of the attribute list is when either the name (code) or the
12form of the attribute is zero.
13
14The DWARF spec says: "The series of attribute specifications ends
15with an entry containing 0 for the name and 0 for the form." So
16the first check is correct.
17
18Make sure dwarf_getabbrev and dwarf_hasattr use the same check.
19This is important since all other functions expect dwarf_getabbrev
20(__libdw_getabbrev) to have done a data sanity check of the attribute.
21So if the ending condition is different it could cause a crash.
22
23https://sourceware.org/bugzilla/show_bug.cgi?id=23529
24
25Signed-off-by: Mark Wielaard <mark@klomp.org>
26
27Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=6983e59b727458a6c64d9659c85f08218bc4fcda]
28CVE: CVE-2018-16403
29
30Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
31---
32 libdw/ChangeLog | 7 +++++++
33 libdw/dwarf_getabbrev.c | 2 +-
34 libdw/dwarf_hasattr.c | 4 ++--
35 3 files changed, 10 insertions(+), 3 deletions(-)
36
37diff --git a/libdw/ChangeLog b/libdw/ChangeLog
38index 9e43ea9..f3cf5d3 100644
39--- a/libdw/ChangeLog
40+++ b/libdw/ChangeLog
41@@ -1,5 +1,12 @@
42 2018-08-18 Mark Wielaard <mark@klomp.org>
43
44+ * dwarf_getabbrev.c (__libdw_getabbrev): Continue until both name
45+ and form are zero.
46+ * dwarf_hasattr.c (dwarf_hasattr): Stop when both name and form
47+ are zero.
48+
49+2018-08-18 Mark Wielaard <mark@klomp.org>
50+
51 * dwarf_getaranges.c (dwarf_getaranges.c): Make sure there is enough
52 data to read the address and segment size.
53
54diff --git a/libdw/dwarf_getabbrev.c b/libdw/dwarf_getabbrev.c
55index 988d12c..6a7e981 100644
56--- a/libdw/dwarf_getabbrev.c
57+++ b/libdw/dwarf_getabbrev.c
58@@ -140,7 +140,7 @@ __libdw_getabbrev (Dwarf *dbg, struct Dwarf_CU *cu, Dwarf_Off offset,
59 get_sleb128 (formval, abbrevp, end);
60 }
61 }
62- while (attrname != 0 && attrform != 0);
63+ while (attrname != 0 || attrform != 0);
64
65 /* Return the length to the caller if she asked for it. */
66 if (lengthp != NULL)
67diff --git a/libdw/dwarf_hasattr.c b/libdw/dwarf_hasattr.c
68index 90053b1..eca0839 100644
69--- a/libdw/dwarf_hasattr.c
70+++ b/libdw/dwarf_hasattr.c
71@@ -60,8 +60,8 @@ dwarf_hasattr (Dwarf_Die *die, unsigned int search_name)
72 unsigned int attr_form;
73 get_uleb128_unchecked (attr_form, attrp);
74
75- /* We can stop if we found the attribute with value zero. */
76- if (attr_name == 0 || attr_form == 0)
77+ /* We can stop if we found the end of the attribute list. */
78+ if (attr_name == 0 && attr_form == 0)
79 return 0;
80
81 if (attr_name == search_name)
82--
832.7.4
84
diff --git a/meta/recipes-devtools/elfutils/files/0002-libelf-Return-error-if-elf_compress_gnu-is-used-on-S.patch b/meta/recipes-devtools/elfutils/files/0002-libelf-Return-error-if-elf_compress_gnu-is-used-on-S.patch
deleted file mode 100644
index 2465924acf..0000000000
--- a/meta/recipes-devtools/elfutils/files/0002-libelf-Return-error-if-elf_compress_gnu-is-used-on-S.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From d08572f7c9692c335afdb6f8dde48d77731209c3 Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Fri, 28 Sep 2018 10:45:56 +0800
4Subject: [PATCH 2/2] libelf: Return error if elf_compress_gnu is used on
5 SHF_COMPRESSED section.
6
7Compressing a section that is already compressed is fine, but useless.
8But it isn't possible to gnu compress (or decompress) a SHF_COMPRESSED
9section since there is no state kept that would tell if the section was
10first GNU compressed or first gabi compressed. Calling elf_compress_gnu
11on a section and then calling elf_compress on it to decompress it twice
12could cause a crash (the other way around is fine). Just disallow it.
13
14https://sourceware.org/bugzilla/show_bug.cgi?id=23528
15
16Signed-off-by: Mark Wielaard <mark@klomp.org>
17
18Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commit;h=56b18521fb8d46d40fc090c0de9d11a08bc982fa]
19CVE: CVE-2018-16402
20Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
21---
22 libelf/elf_compress_gnu.c | 4 +++-
23 libelf/libelf.h | 5 +++++
24 2 files changed, 8 insertions(+), 1 deletion(-)
25
26diff --git a/libelf/elf_compress_gnu.c b/libelf/elf_compress_gnu.c
27index c35dc39..dfa7c57 100644
28--- a/libelf/elf_compress_gnu.c
29+++ b/libelf/elf_compress_gnu.c
30@@ -80,7 +80,9 @@ elf_compress_gnu (Elf_Scn *scn, int inflate, unsigned int flags)
31 sh_addralign = shdr->sh_addralign;
32 }
33
34- if ((sh_flags & SHF_ALLOC) != 0)
35+ /* Allocated sections, or sections that are already are compressed
36+ cannot (also) be GNU compressed. */
37+ if ((sh_flags & SHF_ALLOC) != 0 || (sh_flags & SHF_COMPRESSED))
38 {
39 __libelf_seterrno (ELF_E_INVALID_SECTION_FLAGS);
40 return -1;
41diff --git a/libelf/libelf.h b/libelf/libelf.h
42index 547c0f5..fa568f7 100644
43--- a/libelf/libelf.h
44+++ b/libelf/libelf.h
45@@ -366,6 +366,11 @@ extern Elf64_Chdr *elf64_getchdr (Elf_Scn *__scn);
46 It is an error to request compression for a section that already
47 has SHF_COMPRESSED set, or (for elf_compress) to request
48 decompression for an section that doesn't have SHF_COMPRESSED set.
49+ If a section has SHF_COMPRESSED set then calling elf_compress_gnu
50+ will result in an error. The section has to be decompressed first
51+ using elf_compress. Calling elf_compress on a section compressed
52+ with elf_compress_gnu is fine, but probably useless.
53+
54 It is always an error to call these functions on SHT_NOBITS
55 sections or if the section has the SHF_ALLOC flag set.
56 elf_compress_gnu will not check whether the section name starts
57--
582.7.4
59
diff --git a/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch b/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
index e88f2c069c..0f01a3218e 100644
--- a/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
+++ b/meta/recipes-devtools/elfutils/files/0008-build-Provide-alternatives-for-glibc-assumptions-hel.patch
@@ -7,78 +7,23 @@ Subject: [PATCH] build: Provide alternatives for glibc assumptions helps
7Upstream-Status: Pending 7Upstream-Status: Pending
8Signed-off-by: Khem Raj <raj.khem@gmail.com> 8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9 9
10Rebase to 0.172 10Rebase to 0.174
11 11
12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> 12Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
13--- 13---
14 Makefile.am | 2 +- 14 Makefile.am | 2 +-
15 lib/color.c | 3 ++-
16 lib/fixedsizehash.h | 1 - 15 lib/fixedsizehash.h | 1 -
17 lib/system.h | 10 ++++++++++ 16 lib/system.h | 12 +++++++++++-
18 lib/xmalloc.c | 2 +-
19 libasm/asm_end.c | 2 +-
20 libasm/asm_newscn.c | 2 +-
21 libcpu/i386_gendis.c | 2 +-
22 libcpu/i386_lex.c | 2 +-
23 libcpu/i386_parse.c | 2 +-
24 libdw/Makefile.am | 3 ++- 17 libdw/Makefile.am | 3 ++-
25 libdw/libdw_alloc.c | 2 +-
26 libdwfl/dwfl_build_id_find_elf.c | 1 + 18 libdwfl/dwfl_build_id_find_elf.c | 1 +
27 libdwfl/dwfl_error.c | 4 +++- 19 libdwfl/dwfl_error.c | 4 +++-
28 libdwfl/dwfl_module_getdwarf.c | 1 + 20 libdwfl/dwfl_module_getdwarf.c | 1 +
29 libdwfl/libdwfl_crc32_file.c | 9 +++++++++ 21 libdwfl/libdwfl_crc32_file.c | 9 +++++++++
30 libdwfl/linux-kernel-modules.c | 1 + 22 libdwfl/linux-kernel-modules.c | 1 +
31 libebl/eblopenbackend.c | 2 +-
32 libelf/elf.h | 8 ++++++-- 23 libelf/elf.h | 8 ++++++--
33 libelf/libelf.h | 1 + 24 libelf/libelf.h | 1 +
34 libelf/libelfP.h | 1 + 25 libelf/libelfP.h | 1 +
35 src/addr2line.c | 2 +- 26 12 files changed, 37 insertions(+), 7 deletions(-)
36 src/ar.c | 2 +-
37 src/arlib.c | 2 +-
38 src/arlib2.c | 2 +-
39 src/elfcmp.c | 2 +-
40 src/elflint.c | 2 +-
41 src/findtextrel.c | 2 +-
42 src/nm.c | 2 +-
43 src/objdump.c | 2 +-
44 src/ranlib.c | 2 +-
45 src/readelf.c | 2 +-
46 src/size.c | 2 +-
47 src/stack.c | 2 +-
48 src/strings.c | 2 +-
49 src/strip.c | 2 +-
50 src/unstrip.c | 2 +-
51 tests/addrscopes.c | 2 +-
52 tests/allregs.c | 2 +-
53 tests/backtrace-data.c | 2 +-
54 tests/backtrace-dwarf.c | 2 +-
55 tests/backtrace.c | 2 +-
56 tests/buildid.c | 2 +-
57 tests/debugaltlink.c | 2 +-
58 tests/debuglink.c | 2 +-
59 tests/deleted.c | 2 +-
60 tests/dwfl-addr-sect.c | 2 +-
61 tests/dwfl-bug-addr-overflow.c | 2 +-
62 tests/dwfl-bug-fd-leak.c | 2 +-
63 tests/dwfl-bug-getmodules.c | 2 +-
64 tests/dwfl-report-elf-align.c | 2 +-
65 tests/dwfllines.c | 2 +-
66 tests/dwflmodtest.c | 2 +-
67 tests/dwflsyms.c | 2 +-
68 tests/early-offscn.c | 2 +-
69 tests/ecp.c | 2 +-
70 tests/find-prologues.c | 2 +-
71 tests/funcretval.c | 2 +-
72 tests/funcscopes.c | 2 +-
73 tests/getsrc_die.c | 2 +-
74 tests/line2addr.c | 2 +-
75 tests/low_high_pc.c | 2 +-
76 tests/rdwrmmap.c | 2 +-
77 tests/saridx.c | 2 +-
78 tests/sectiondump.c | 2 +-
79 tests/varlocs.c | 2 +-
80 tests/vdsosyms.c | 2 +-
81 67 files changed, 92 insertions(+), 61 deletions(-)
82 27
83diff --git a/Makefile.am b/Makefile.am 28diff --git a/Makefile.am b/Makefile.am
84index 2ff444e..41f77df 100644 29index 2ff444e..41f77df 100644
@@ -93,26 +38,6 @@ index 2ff444e..41f77df 100644
93 38
94 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \ 39 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
95 COPYING COPYING-GPLV2 COPYING-LGPLV3 40 COPYING COPYING-GPLV2 COPYING-LGPLV3
96diff --git a/lib/color.c b/lib/color.c
97index f62389d..a2a84b4 100644
98--- a/lib/color.c
99+++ b/lib/color.c
100@@ -32,13 +32,14 @@
101 #endif
102
103 #include <argp.h>
104-#include <error.h>
105+#include <err.h>
106 #include <libintl.h>
107 #include <stdlib.h>
108 #include <string.h>
109 #include <unistd.h>
110 #include "libeu.h"
111 #include "color.h"
112+#include "system.h"
113
114 /* Prototype for option handler. */
115 static error_t parse_opt (int key, char *arg, struct argp_state *state);
116diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h 41diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
117index dac2a5f..43016fc 100644 42index dac2a5f..43016fc 100644
118--- a/lib/fixedsizehash.h 43--- a/lib/fixedsizehash.h
@@ -126,10 +51,19 @@ index dac2a5f..43016fc 100644
126 #include <system.h> 51 #include <system.h>
127 52
128diff --git a/lib/system.h b/lib/system.h 53diff --git a/lib/system.h b/lib/system.h
129index 9203335..1a60131 100644 54index 292082b..308a762 100644
130--- a/lib/system.h 55--- a/lib/system.h
131+++ b/lib/system.h 56+++ b/lib/system.h
132@@ -50,6 +50,16 @@ 57@@ -30,7 +30,7 @@
58 #define LIB_SYSTEM_H 1
59
60 #include <errno.h>
61-#include <error.h>
62+#include <err.h>
63 #include <stddef.h>
64 #include <stdint.h>
65 #include <sys/param.h>
66@@ -51,6 +51,16 @@
133 #else 67 #else
134 # error "Unknown byte order" 68 # error "Unknown byte order"
135 #endif 69 #endif
@@ -146,89 +80,11 @@ index 9203335..1a60131 100644
146 80
147 #ifndef MAX 81 #ifndef MAX
148 #define MAX(m, n) ((m) < (n) ? (n) : (m)) 82 #define MAX(m, n) ((m) < (n) ? (n) : (m))
149diff --git a/lib/xmalloc.c b/lib/xmalloc.c
150index 0cde384..217b054 100644
151--- a/lib/xmalloc.c
152+++ b/lib/xmalloc.c
153@@ -30,7 +30,7 @@
154 # include <config.h>
155 #endif
156
157-#include <error.h>
158+#include <err.h>
159 #include <libintl.h>
160 #include <stddef.h>
161 #include <stdlib.h>
162diff --git a/libasm/asm_end.c b/libasm/asm_end.c
163index ced24f5..4ad918c 100644
164--- a/libasm/asm_end.c
165+++ b/libasm/asm_end.c
166@@ -32,7 +32,7 @@
167 #endif
168
169 #include <assert.h>
170-#include <error.h>
171+#include <err.h>
172 #include <libintl.h>
173 #include <stdio.h>
174 #include <stdlib.h>
175diff --git a/libasm/asm_newscn.c b/libasm/asm_newscn.c
176index ddbb25d..74a598d 100644
177--- a/libasm/asm_newscn.c
178+++ b/libasm/asm_newscn.c
179@@ -32,7 +32,7 @@
180 #endif
181
182 #include <assert.h>
183-#include <error.h>
184+#include <err.h>
185 #include <libintl.h>
186 #include <stdlib.h>
187 #include <string.h>
188diff --git a/libcpu/i386_gendis.c b/libcpu/i386_gendis.c
189index aae5eae..6d76016 100644
190--- a/libcpu/i386_gendis.c
191+++ b/libcpu/i386_gendis.c
192@@ -31,7 +31,7 @@
193 # include <config.h>
194 #endif
195
196-#include <error.h>
197+#include <err.h>
198 #include <errno.h>
199 #include <stdio.h>
200 #include <stdlib.h>
201diff --git a/libcpu/i386_lex.c b/libcpu/i386_lex.c
202index facdf71..f13842f 100644
203--- a/libcpu/i386_lex.c
204+++ b/libcpu/i386_lex.c
205@@ -571,7 +571,7 @@ char *i386_text;
206 #endif
207
208 #include <ctype.h>
209-#include <error.h>
210+#include <err.h>
211 #include <libintl.h>
212
213 #include <libeu.h>
214diff --git a/libcpu/i386_parse.c b/libcpu/i386_parse.c
215index 3c5058a..bf402d6 100644
216--- a/libcpu/i386_parse.c
217+++ b/libcpu/i386_parse.c
218@@ -107,7 +107,7 @@
219 #include <assert.h>
220 #include <ctype.h>
221 #include <errno.h>
222-#include <error.h>
223+#include <err.h>
224 #include <inttypes.h>
225 #include <libintl.h>
226 #include <math.h>
227diff --git a/libdw/Makefile.am b/libdw/Makefile.am 83diff --git a/libdw/Makefile.am b/libdw/Makefile.am
228index 41df4f3..e6b275f 100644 84index 7a3d532..7ac1241 100644
229--- a/libdw/Makefile.am 85--- a/libdw/Makefile.am
230+++ b/libdw/Makefile.am 86+++ b/libdw/Makefile.am
231@@ -107,7 +107,8 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os) 87@@ -108,7 +108,8 @@ am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
232 libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \ 88 libdw_so_LIBS = libdw_pic.a ../libdwelf/libdwelf_pic.a \
233 ../libdwfl/libdwfl_pic.a ../libebl/libebl.a 89 ../libdwfl/libdwfl_pic.a ../libebl/libebl.a
234 libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so 90 libdw_so_DEPS = ../lib/libeu.a ../libelf/libelf.so
@@ -238,19 +94,6 @@ index 41df4f3..e6b275f 100644
238 libdw_so_SOURCES = 94 libdw_so_SOURCES =
239 libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS) 95 libdw.so$(EXEEXT): $(srcdir)/libdw.map $(libdw_so_LIBS) $(libdw_so_DEPS)
240 # The rpath is necessary for libebl because its $ORIGIN use will 96 # The rpath is necessary for libebl because its $ORIGIN use will
241diff --git a/libdw/libdw_alloc.c b/libdw/libdw_alloc.c
242index d6af23a..deb724c 100644
243--- a/libdw/libdw_alloc.c
244+++ b/libdw/libdw_alloc.c
245@@ -31,7 +31,7 @@
246 # include <config.h>
247 #endif
248
249-#include <error.h>
250+#include <err.h>
251 #include <errno.h>
252 #include <stdlib.h>
253 #include "libdwP.h"
254diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c 97diff --git a/libdwfl/dwfl_build_id_find_elf.c b/libdwfl/dwfl_build_id_find_elf.c
255index cc6c3f6..b06ab59 100644 98index cc6c3f6..b06ab59 100644
256--- a/libdwfl/dwfl_build_id_find_elf.c 99--- a/libdwfl/dwfl_build_id_find_elf.c
@@ -329,21 +172,8 @@ index 9d0fef2..9fc09b8 100644
329 #include <inttypes.h> 172 #include <inttypes.h>
330 #include <errno.h> 173 #include <errno.h>
331 #include <stdio.h> 174 #include <stdio.h>
332diff --git a/libebl/eblopenbackend.c b/libebl/eblopenbackend.c
333index 8b063f4..9bdeead 100644
334--- a/libebl/eblopenbackend.c
335+++ b/libebl/eblopenbackend.c
336@@ -32,7 +32,7 @@
337
338 #include <assert.h>
339 #include <dlfcn.h>
340-#include <error.h>
341+#include <err.h>
342 #include <libelfP.h>
343 #include <dwarf.h>
344 #include <stdlib.h>
345diff --git a/libelf/elf.h b/libelf/elf.h 175diff --git a/libelf/elf.h b/libelf/elf.h
346index f774898..be277d0 100644 176index 5dc632b..14da1b7 100644
347--- a/libelf/elf.h 177--- a/libelf/elf.h
348+++ b/libelf/elf.h 178+++ b/libelf/elf.h
349@@ -21,7 +21,9 @@ 179@@ -21,7 +21,9 @@
@@ -357,7 +187,7 @@ index f774898..be277d0 100644
357 187
358 /* Standard ELF types. */ 188 /* Standard ELF types. */
359 189
360@@ -3912,6 +3914,8 @@ enum 190@@ -3937,6 +3939,8 @@ enum
361 #define R_METAG_TLS_LE_HI16 60 191 #define R_METAG_TLS_LE_HI16 60
362 #define R_METAG_TLS_LE_LO16 61 192 #define R_METAG_TLS_LE_LO16 61
363 193
@@ -368,7 +198,7 @@ index f774898..be277d0 100644
368 198
369 #endif /* elf.h */ 199 #endif /* elf.h */
370diff --git a/libelf/libelf.h b/libelf/libelf.h 200diff --git a/libelf/libelf.h b/libelf/libelf.h
371index 547c0f5..dd78799 100644 201index d11358c..4cf9272 100644
372--- a/libelf/libelf.h 202--- a/libelf/libelf.h
373+++ b/libelf/libelf.h 203+++ b/libelf/libelf.h
374@@ -29,6 +29,7 @@ 204@@ -29,6 +29,7 @@
@@ -380,7 +210,7 @@ index 547c0f5..dd78799 100644
380 #include <sys/types.h> 210 #include <sys/types.h>
381 211
382diff --git a/libelf/libelfP.h b/libelf/libelfP.h 212diff --git a/libelf/libelfP.h b/libelf/libelfP.h
383index ca805ac..47f25c2 100644 213index ed216c8..415e6f6 100644
384--- a/libelf/libelfP.h 214--- a/libelf/libelfP.h
385+++ b/libelf/libelfP.h 215+++ b/libelf/libelfP.h
386@@ -32,6 +32,7 @@ 216@@ -32,6 +32,7 @@
@@ -391,604 +221,6 @@ index ca805ac..47f25c2 100644
391 221
392 #include <errno.h> 222 #include <errno.h>
393 #include <stdbool.h> 223 #include <stdbool.h>
394diff --git a/src/addr2line.c b/src/addr2line.c
395index 5acafa0..a4920b3 100644
396--- a/src/addr2line.c
397+++ b/src/addr2line.c
398@@ -23,7 +23,7 @@
399 #include <argp.h>
400 #include <assert.h>
401 #include <errno.h>
402-#include <error.h>
403+#include <err.h>
404 #include <fcntl.h>
405 #include <inttypes.h>
406 #include <libdwfl.h>
407diff --git a/src/ar.c b/src/ar.c
408index 818115b..2166f1b 100644
409--- a/src/ar.c
410+++ b/src/ar.c
411@@ -22,7 +22,7 @@
412
413 #include <argp.h>
414 #include <assert.h>
415-#include <error.h>
416+#include <err.h>
417 #include <fcntl.h>
418 #include <gelf.h>
419 #include <libintl.h>
420diff --git a/src/arlib.c b/src/arlib.c
421index e0839aa..1143658 100644
422--- a/src/arlib.c
423+++ b/src/arlib.c
424@@ -21,7 +21,7 @@
425 #endif
426
427 #include <assert.h>
428-#include <error.h>
429+#include <err.h>
430 #include <gelf.h>
431 #include <inttypes.h>
432 #include <libintl.h>
433diff --git a/src/arlib2.c b/src/arlib2.c
434index 553fc57..46443d0 100644
435--- a/src/arlib2.c
436+++ b/src/arlib2.c
437@@ -20,7 +20,7 @@
438 # include <config.h>
439 #endif
440
441-#include <error.h>
442+#include <err.h>
443 #include <libintl.h>
444 #include <limits.h>
445 #include <string.h>
446diff --git a/src/elfcmp.c b/src/elfcmp.c
447index 5046420..cff183f 100644
448--- a/src/elfcmp.c
449+++ b/src/elfcmp.c
450@@ -23,7 +23,7 @@
451 #include <argp.h>
452 #include <assert.h>
453 #include <errno.h>
454-#include <error.h>
455+#include <err.h>
456 #include <fcntl.h>
457 #include <locale.h>
458 #include <libintl.h>
459diff --git a/src/elflint.c b/src/elflint.c
460index 0a26d97..e45fb39 100644
461--- a/src/elflint.c
462+++ b/src/elflint.c
463@@ -24,7 +24,7 @@
464 #include <assert.h>
465 #include <byteswap.h>
466 #include <endian.h>
467-#include <error.h>
468+#include <err.h>
469 #include <fcntl.h>
470 #include <gelf.h>
471 #include <inttypes.h>
472diff --git a/src/findtextrel.c b/src/findtextrel.c
473index 8f1e239..71463af 100644
474--- a/src/findtextrel.c
475+++ b/src/findtextrel.c
476@@ -23,7 +23,7 @@
477 #include <argp.h>
478 #include <assert.h>
479 #include <errno.h>
480-#include <error.h>
481+#include <err.h>
482 #include <fcntl.h>
483 #include <gelf.h>
484 #include <libdw.h>
485diff --git a/src/nm.c b/src/nm.c
486index 969c6d3..3113c04 100644
487--- a/src/nm.c
488+++ b/src/nm.c
489@@ -26,7 +26,7 @@
490 #include <ctype.h>
491 #include <dwarf.h>
492 #include <errno.h>
493-#include <error.h>
494+#include <err.h>
495 #include <fcntl.h>
496 #include <gelf.h>
497 #include <inttypes.h>
498diff --git a/src/objdump.c b/src/objdump.c
499index 0dd9a6a..9c8bf14 100644
500--- a/src/objdump.c
501+++ b/src/objdump.c
502@@ -21,7 +21,7 @@
503 #endif
504
505 #include <argp.h>
506-#include <error.h>
507+#include <err.h>
508 #include <fcntl.h>
509 #include <inttypes.h>
510 #include <libintl.h>
511diff --git a/src/ranlib.c b/src/ranlib.c
512index cc0ee23..ae851e4 100644
513--- a/src/ranlib.c
514+++ b/src/ranlib.c
515@@ -24,7 +24,7 @@
516 #include <argp.h>
517 #include <assert.h>
518 #include <errno.h>
519-#include <error.h>
520+#include <err.h>
521 #include <fcntl.h>
522 #include <gelf.h>
523 #include <libintl.h>
524diff --git a/src/readelf.c b/src/readelf.c
525index f185897..6623e93 100644
526--- a/src/readelf.c
527+++ b/src/readelf.c
528@@ -24,7 +24,7 @@
529 #include <ctype.h>
530 #include <dwarf.h>
531 #include <errno.h>
532-#include <error.h>
533+#include <err.h>
534 #include <fcntl.h>
535 #include <gelf.h>
536 #include <inttypes.h>
537diff --git a/src/size.c b/src/size.c
538index ad8dbcb..fd83be0 100644
539--- a/src/size.c
540+++ b/src/size.c
541@@ -21,7 +21,7 @@
542 #endif
543
544 #include <argp.h>
545-#include <error.h>
546+#include <err.h>
547 #include <fcntl.h>
548 #include <gelf.h>
549 #include <inttypes.h>
550diff --git a/src/stack.c b/src/stack.c
551index 52ae3a8..0fda285 100644
552--- a/src/stack.c
553+++ b/src/stack.c
554@@ -18,7 +18,7 @@
555 #include <config.h>
556 #include <assert.h>
557 #include <argp.h>
558-#include <error.h>
559+#include <err.h>
560 #include <stdlib.h>
561 #include <inttypes.h>
562 #include <stdio.h>
563diff --git a/src/strings.c b/src/strings.c
564index 03d0f13..5c311cb 100644
565--- a/src/strings.c
566+++ b/src/strings.c
567@@ -25,7 +25,7 @@
568 #include <ctype.h>
569 #include <endian.h>
570 #include <errno.h>
571-#include <error.h>
572+#include <err.h>
573 #include <fcntl.h>
574 #include <gelf.h>
575 #include <inttypes.h>
576diff --git a/src/strip.c b/src/strip.c
577index 773ed54..ff05f46 100644
578--- a/src/strip.c
579+++ b/src/strip.c
580@@ -24,7 +24,7 @@
581 #include <assert.h>
582 #include <byteswap.h>
583 #include <endian.h>
584-#include <error.h>
585+#include <err.h>
586 #include <fcntl.h>
587 #include <fnmatch.h>
588 #include <gelf.h>
589diff --git a/src/unstrip.c b/src/unstrip.c
590index f368e69..5ca83d0 100644
591--- a/src/unstrip.c
592+++ b/src/unstrip.c
593@@ -31,7 +31,7 @@
594 #include <argp.h>
595 #include <assert.h>
596 #include <errno.h>
597-#include <error.h>
598+#include <err.h>
599 #include <fcntl.h>
600 #include <fnmatch.h>
601 #include <libintl.h>
602diff --git a/tests/addrscopes.c b/tests/addrscopes.c
603index 791569f..54f4311 100644
604--- a/tests/addrscopes.c
605+++ b/tests/addrscopes.c
606@@ -25,7 +25,7 @@
607 #include <stdio_ext.h>
608 #include <locale.h>
609 #include <stdlib.h>
610-#include <error.h>
611+#include <err.h>
612 #include <string.h>
613
614
615diff --git a/tests/allregs.c b/tests/allregs.c
616index 286f7e3..c9de089 100644
617--- a/tests/allregs.c
618+++ b/tests/allregs.c
619@@ -21,7 +21,7 @@
620 #include <stdio.h>
621 #include <stdlib.h>
622 #include <string.h>
623-#include <error.h>
624+#include <err.h>
625 #include <locale.h>
626 #include <argp.h>
627 #include <assert.h>
628diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
629index a387d8f..955c27d 100644
630--- a/tests/backtrace-data.c
631+++ b/tests/backtrace-data.c
632@@ -27,7 +27,7 @@
633 #include <dirent.h>
634 #include <stdlib.h>
635 #include <errno.h>
636-#include <error.h>
637+#include <err.h>
638 #include <unistd.h>
639 #include <dwarf.h>
640 #if defined(__x86_64__) && defined(__linux__)
641diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
642index 7ff826c..246650b 100644
643--- a/tests/backtrace-dwarf.c
644+++ b/tests/backtrace-dwarf.c
645@@ -21,7 +21,7 @@
646 #include <stdio_ext.h>
647 #include <locale.h>
648 #include <errno.h>
649-#include <error.h>
650+#include <err.h>
651 #include <unistd.h>
652 #include <sys/types.h>
653 #include ELFUTILS_HEADER(dwfl)
654diff --git a/tests/backtrace.c b/tests/backtrace.c
655index f5dd761..a93a8f0 100644
656--- a/tests/backtrace.c
657+++ b/tests/backtrace.c
658@@ -24,7 +24,7 @@
659 #include <dirent.h>
660 #include <stdlib.h>
661 #include <errno.h>
662-#include <error.h>
663+#include <err.h>
664 #include <unistd.h>
665 #include <dwarf.h>
666 #ifdef __linux__
667diff --git a/tests/buildid.c b/tests/buildid.c
668index 87c1877..2953e6b 100644
669--- a/tests/buildid.c
670+++ b/tests/buildid.c
671@@ -23,7 +23,7 @@
672 #include ELFUTILS_HEADER(elf)
673 #include ELFUTILS_HEADER(dwelf)
674 #include <stdio.h>
675-#include <error.h>
676+#include <err.h>
677 #include <string.h>
678 #include <stdlib.h>
679 #include <sys/types.h>
680diff --git a/tests/debugaltlink.c b/tests/debugaltlink.c
681index 6d97d50..ee7e559 100644
682--- a/tests/debugaltlink.c
683+++ b/tests/debugaltlink.c
684@@ -23,7 +23,7 @@
685 #include ELFUTILS_HEADER(dw)
686 #include ELFUTILS_HEADER(dwelf)
687 #include <stdio.h>
688-#include <error.h>
689+#include <err.h>
690 #include <string.h>
691 #include <stdlib.h>
692 #include <sys/types.h>
693diff --git a/tests/debuglink.c b/tests/debuglink.c
694index 935d102..741cb81 100644
695--- a/tests/debuglink.c
696+++ b/tests/debuglink.c
697@@ -21,7 +21,7 @@
698 #include <errno.h>
699 #include ELFUTILS_HEADER(dwelf)
700 #include <stdio.h>
701-#include <error.h>
702+#include <err.h>
703 #include <string.h>
704 #include <stdlib.h>
705 #include <sys/types.h>
706diff --git a/tests/deleted.c b/tests/deleted.c
707index 6be35bc..0190711 100644
708--- a/tests/deleted.c
709+++ b/tests/deleted.c
710@@ -21,7 +21,7 @@
711 #include <unistd.h>
712 #include <assert.h>
713 #include <stdio.h>
714-#include <error.h>
715+#include <err.h>
716 #include <errno.h>
717 #ifdef __linux__
718 #include <sys/prctl.h>
719diff --git a/tests/dwfl-addr-sect.c b/tests/dwfl-addr-sect.c
720index 21e470a..1ea1e3b 100644
721--- a/tests/dwfl-addr-sect.c
722+++ b/tests/dwfl-addr-sect.c
723@@ -23,7 +23,7 @@
724 #include <stdio_ext.h>
725 #include <stdlib.h>
726 #include <string.h>
727-#include <error.h>
728+#include <err.h>
729 #include <locale.h>
730 #include <argp.h>
731 #include ELFUTILS_HEADER(dwfl)
732diff --git a/tests/dwfl-bug-addr-overflow.c b/tests/dwfl-bug-addr-overflow.c
733index aa8030e..02c8bef 100644
734--- a/tests/dwfl-bug-addr-overflow.c
735+++ b/tests/dwfl-bug-addr-overflow.c
736@@ -20,7 +20,7 @@
737 #include <inttypes.h>
738 #include <stdio.h>
739 #include <stdio_ext.h>
740-#include <error.h>
741+#include <err.h>
742 #include <locale.h>
743 #include ELFUTILS_HEADER(dwfl)
744
745diff --git a/tests/dwfl-bug-fd-leak.c b/tests/dwfl-bug-fd-leak.c
746index 689cdd7..5973da3 100644
747--- a/tests/dwfl-bug-fd-leak.c
748+++ b/tests/dwfl-bug-fd-leak.c
749@@ -24,7 +24,7 @@
750 #include <dirent.h>
751 #include <stdlib.h>
752 #include <errno.h>
753-#include <error.h>
754+#include <err.h>
755 #include <unistd.h>
756 #include <dwarf.h>
757
758diff --git a/tests/dwfl-bug-getmodules.c b/tests/dwfl-bug-getmodules.c
759index 1ee989f..fd62e65 100644
760--- a/tests/dwfl-bug-getmodules.c
761+++ b/tests/dwfl-bug-getmodules.c
762@@ -18,7 +18,7 @@
763 #include <config.h>
764 #include ELFUTILS_HEADER(dwfl)
765
766-#include <error.h>
767+#include <err.h>
768
769 static const Dwfl_Callbacks callbacks =
770 {
771diff --git a/tests/dwfl-report-elf-align.c b/tests/dwfl-report-elf-align.c
772index a4e97d3..f471587 100644
773--- a/tests/dwfl-report-elf-align.c
774+++ b/tests/dwfl-report-elf-align.c
775@@ -20,7 +20,7 @@
776 #include <inttypes.h>
777 #include <stdio.h>
778 #include <stdio_ext.h>
779-#include <error.h>
780+#include <err.h>
781 #include <locale.h>
782 #include <string.h>
783 #include <stdlib.h>
784diff --git a/tests/dwfllines.c b/tests/dwfllines.c
785index 90379dd..cbdf6c4 100644
786--- a/tests/dwfllines.c
787+++ b/tests/dwfllines.c
788@@ -27,7 +27,7 @@
789 #include <stdio.h>
790 #include <stdlib.h>
791 #include <string.h>
792-#include <error.h>
793+#include <err.h>
794
795 int
796 main (int argc, char *argv[])
797diff --git a/tests/dwflmodtest.c b/tests/dwflmodtest.c
798index 0027f96..e68d3bc 100644
799--- a/tests/dwflmodtest.c
800+++ b/tests/dwflmodtest.c
801@@ -23,7 +23,7 @@
802 #include <stdio_ext.h>
803 #include <stdlib.h>
804 #include <string.h>
805-#include <error.h>
806+#include <err.h>
807 #include <locale.h>
808 #include <argp.h>
809 #include ELFUTILS_HEADER(dwfl)
810diff --git a/tests/dwflsyms.c b/tests/dwflsyms.c
811index 49ac334..cf07830 100644
812--- a/tests/dwflsyms.c
813+++ b/tests/dwflsyms.c
814@@ -25,7 +25,7 @@
815 #include <stdio.h>
816 #include <stdio_ext.h>
817 #include <stdlib.h>
818-#include <error.h>
819+#include <err.h>
820 #include <string.h>
821
822 static const char *
823diff --git a/tests/early-offscn.c b/tests/early-offscn.c
824index 924cb9e..6f60d5a 100644
825--- a/tests/early-offscn.c
826+++ b/tests/early-offscn.c
827@@ -19,7 +19,7 @@
828 #endif
829
830 #include <errno.h>
831-#include <error.h>
832+#include <err.h>
833 #include <fcntl.h>
834 #include <gelf.h>
835 #include <stdio.h>
836diff --git a/tests/ecp.c b/tests/ecp.c
837index 38a6859..743cea5 100644
838--- a/tests/ecp.c
839+++ b/tests/ecp.c
840@@ -20,7 +20,7 @@
841 #endif
842
843 #include <errno.h>
844-#include <error.h>
845+#include <err.h>
846 #include <fcntl.h>
847 #include <gelf.h>
848 #include <stdlib.h>
849diff --git a/tests/find-prologues.c b/tests/find-prologues.c
850index ba8ae37..76f5f04 100644
851--- a/tests/find-prologues.c
852+++ b/tests/find-prologues.c
853@@ -25,7 +25,7 @@
854 #include <stdio_ext.h>
855 #include <locale.h>
856 #include <stdlib.h>
857-#include <error.h>
858+#include <err.h>
859 #include <string.h>
860 #include <fnmatch.h>
861
862diff --git a/tests/funcretval.c b/tests/funcretval.c
863index 8d19d11..c8aaa93 100644
864--- a/tests/funcretval.c
865+++ b/tests/funcretval.c
866@@ -25,7 +25,7 @@
867 #include <stdio_ext.h>
868 #include <locale.h>
869 #include <stdlib.h>
870-#include <error.h>
871+#include <err.h>
872 #include <string.h>
873 #include <fnmatch.h>
874
875diff --git a/tests/funcscopes.c b/tests/funcscopes.c
876index 9c90185..dbccb89 100644
877--- a/tests/funcscopes.c
878+++ b/tests/funcscopes.c
879@@ -25,7 +25,7 @@
880 #include <stdio_ext.h>
881 #include <locale.h>
882 #include <stdlib.h>
883-#include <error.h>
884+#include <err.h>
885 #include <string.h>
886 #include <fnmatch.h>
887
888diff --git a/tests/getsrc_die.c b/tests/getsrc_die.c
889index 055aede..9c394dd 100644
890--- a/tests/getsrc_die.c
891+++ b/tests/getsrc_die.c
892@@ -19,7 +19,7 @@
893 #endif
894
895 #include <errno.h>
896-#include <error.h>
897+#include <err.h>
898 #include <fcntl.h>
899 #include <inttypes.h>
900 #include <libelf.h>
901diff --git a/tests/line2addr.c b/tests/line2addr.c
902index e0d65d3..9bf0023 100644
903--- a/tests/line2addr.c
904+++ b/tests/line2addr.c
905@@ -26,7 +26,7 @@
906 #include <locale.h>
907 #include <stdlib.h>
908 #include <string.h>
909-#include <error.h>
910+#include <err.h>
911
912
913 static void
914diff --git a/tests/low_high_pc.c b/tests/low_high_pc.c
915index 5c6b343..fa0c158 100644
916--- a/tests/low_high_pc.c
917+++ b/tests/low_high_pc.c
918@@ -25,7 +25,7 @@
919 #include <stdio_ext.h>
920 #include <locale.h>
921 #include <stdlib.h>
922-#include <error.h>
923+#include <err.h>
924 #include <string.h>
925 #include <fnmatch.h>
926
927diff --git a/tests/rdwrmmap.c b/tests/rdwrmmap.c
928index 6f027df..1ce5e6e 100644
929--- a/tests/rdwrmmap.c
930+++ b/tests/rdwrmmap.c
931@@ -19,7 +19,7 @@
932 #endif
933
934 #include <errno.h>
935-#include <error.h>
936+#include <err.h>
937 #include <stdio.h>
938 #include <fcntl.h>
939 #include <unistd.h>
940diff --git a/tests/saridx.c b/tests/saridx.c
941index 8a450d8..b387801 100644
942--- a/tests/saridx.c
943+++ b/tests/saridx.c
944@@ -17,7 +17,7 @@
945
946 #include <config.h>
947
948-#include <error.h>
949+#include <err.h>
950 #include <fcntl.h>
951 #include <gelf.h>
952 #include <stdio.h>
953diff --git a/tests/sectiondump.c b/tests/sectiondump.c
954index 3033fed..8e888db 100644
955--- a/tests/sectiondump.c
956+++ b/tests/sectiondump.c
957@@ -18,7 +18,7 @@
958 #include <config.h>
959
960 #include <errno.h>
961-#include <error.h>
962+#include <err.h>
963 #include <fcntl.h>
964 #include <gelf.h>
965 #include <inttypes.h>
966diff --git a/tests/varlocs.c b/tests/varlocs.c
967index f4a711c..1d89a61 100644
968--- a/tests/varlocs.c
969+++ b/tests/varlocs.c
970@@ -25,7 +25,7 @@
971 #include <dwarf.h>
972 #include <stdio.h>
973 #include <stdlib.h>
974-#include <error.h>
975+#include <err.h>
976 #include <string.h>
977 #include <sys/types.h>
978 #include <sys/stat.h>
979diff --git a/tests/vdsosyms.c b/tests/vdsosyms.c
980index b876c10..afb2823 100644
981--- a/tests/vdsosyms.c
982+++ b/tests/vdsosyms.c
983@@ -18,7 +18,7 @@
984 #include <config.h>
985 #include <assert.h>
986 #include <errno.h>
987-#include <error.h>
988+#include <err.h>
989 #include <inttypes.h>
990 #include <stdio.h>
991 #include <string.h>
992-- 224--
9932.7.4 2252.7.4
994 226
diff --git a/meta/recipes-devtools/elfutils/files/CVE-2018-16062.patch b/meta/recipes-devtools/elfutils/files/CVE-2018-16062.patch
deleted file mode 100644
index cfeb1ca13c..0000000000
--- a/meta/recipes-devtools/elfutils/files/CVE-2018-16062.patch
+++ /dev/null
@@ -1,79 +0,0 @@
1From 29e31978ba51c1051743a503ee325b5ebc03d7e9 Mon Sep 17 00:00:00 2001
2From: Mark Wielaard <mark@klomp.org>
3Date: Sat, 18 Aug 2018 13:27:48 +0200
4Subject: [PATCH] libdw, readelf: Make sure there is enough data to read full
5 aranges header.
6
7dwarf_getaranges didn't check if there was enough data left to read both
8the address and segment size. readelf didn't check there was enough data
9left to read the segment size.
10
11https://sourceware.org/bugzilla/show_bug.cgi?id=23541
12
13CVE: CVE-2018-16062
14Upstream-Status: Backport
15
16Signed-off-by: Mark Wielaard <mark@klomp.org>
17---
18 libdw/ChangeLog | 5 +++++
19 libdw/dwarf_getaranges.c | 4 ++++
20 src/ChangeLog | 5 +++++
21 src/readelf.c | 2 ++
22 4 files changed, 16 insertions(+)
23
24diff --git a/libdw/ChangeLog b/libdw/ChangeLog
25index cb4f34e..472d922 100644
26--- a/libdw/ChangeLog
27+++ b/libdw/ChangeLog
28@@ -1,3 +1,8 @@
29+2018-08-18 Mark Wielaard <mark@klomp.org>
30+
31+ * dwarf_getaranges.c (dwarf_getaranges.c): Make sure there is enough
32+ data to read the address and segment size.
33+
34 2018-06-28 Mark Wielaard <mark@klomp.org>
35
36 * dwarf_next_cfi.c (dwarf_next_cfi): Check whether length is zero.
37diff --git a/libdw/dwarf_getaranges.c b/libdw/dwarf_getaranges.c
38index bff9c86..de5b81b 100644
39--- a/libdw/dwarf_getaranges.c
40+++ b/libdw/dwarf_getaranges.c
41@@ -148,6 +148,10 @@ dwarf_getaranges (Dwarf *dbg, Dwarf_Aranges **aranges, size_t *naranges)
42 length_bytes, &offset, IDX_debug_info, 4))
43 goto fail;
44
45+ /* Next up two bytes for address and segment size. */
46+ if (readp + 2 > readendp)
47+ goto invalid;
48+
49 unsigned int address_size = *readp++;
50 if (unlikely (address_size != 4 && address_size != 8))
51 goto invalid;
52diff --git a/src/ChangeLog b/src/ChangeLog
53index 8c89f83..2f9f774 100644
54--- a/src/ChangeLog
55+++ b/src/ChangeLog
56@@ -1,3 +1,8 @@
57+2018-08-18 Mark Wielaard <mark@klomp.org>
58+
59+ * readelf.c (print_debug_aranges_section): Make sure there is enough
60+ data to read the header segment size.
61+
62 2018-06-25 Mark Wielaard <mark@klomp.org>
63
64 * readelf.c (print_decoded_line_section): Use dwarf_next_lines
65diff --git a/src/readelf.c b/src/readelf.c
66index 7b5707f..7b488ac 100644
67--- a/src/readelf.c
68+++ b/src/readelf.c
69@@ -5447,6 +5447,8 @@ print_debug_aranges_section (Dwfl_Module *dwflmod __attribute__ ((unused)),
70 goto next_table;
71 }
72
73+ if (readp + 1 > readendp)
74+ goto invalid_data;
75 unsigned int segment_size = *readp++;
76 printf (gettext (" Segment size: %6" PRIu64 "\n\n"),
77 (uint64_t) segment_size);
78--
792.9.3