summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-8394.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/CVE-2017-8394.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2017-8394.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-8394.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-8394.patch
new file mode 100644
index 0000000000..14ee1910f4
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-8394.patch
@@ -0,0 +1,114 @@
1commit 7eacd66b086cabb1daab20890d5481894d4f56b2
2Author: Alan Modra <amodra@gmail.com>
3Date: Sun Apr 23 15:21:11 2017 +0930
4
5 PR 21414, null pointer deref of _bfd_elf_large_com_section sym
6
7 PR 21414
8 * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
9 * elf.c (lcomm_sym): New.
10 (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
11 * bfd-in2.h: Regenerate.
12
13Upstream-Status: Backport
14
15CVE: CVE-2017-8394
16Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com>
17
18Index: git/bfd/bfd-in2.h
19===================================================================
20--- git.orig/bfd/bfd-in2.h 2017-09-20 12:54:44.847475928 +0530
21+++ git/bfd/bfd-in2.h 2017-09-20 12:54:44.903476171 +0530
22@@ -1805,6 +1805,18 @@
23 { NULL }, { NULL } \
24 }
25
26+/* We use a macro to initialize the static asymbol structures because
27+ traditional C does not permit us to initialize a union member while
28+ gcc warns if we don't initialize it.
29+ the_bfd, name, value, attr, section [, udata] */
30+#ifdef __STDC__
31+#define GLOBAL_SYM_INIT(NAME, SECTION) \
32+ { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 }}
33+#else
34+#define GLOBAL_SYM_INIT(NAME, SECTION) \
35+ { 0, NAME, 0, BSF_SECTION_SYM, SECTION }
36+#endif
37+
38 void bfd_section_list_clear (bfd *);
39
40 asection *bfd_get_section_by_name (bfd *abfd, const char *name);
41Index: git/bfd/section.c
42===================================================================
43--- git.orig/bfd/section.c 2017-09-20 12:54:44.847475928 +0530
44+++ git/bfd/section.c 2017-09-20 12:54:44.903476171 +0530
45@@ -738,20 +738,20 @@
46 . { NULL }, { NULL } \
47 . }
48 .
49+.{* We use a macro to initialize the static asymbol structures because
50+. traditional C does not permit us to initialize a union member while
51+. gcc warns if we don't initialize it.
52+. the_bfd, name, value, attr, section [, udata] *}
53+.#ifdef __STDC__
54+.#define GLOBAL_SYM_INIT(NAME, SECTION) \
55+. { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 }}
56+.#else
57+.#define GLOBAL_SYM_INIT(NAME, SECTION) \
58+. { 0, NAME, 0, BSF_SECTION_SYM, SECTION }
59+.#endif
60+.
61 */
62
63-/* We use a macro to initialize the static asymbol structures because
64- traditional C does not permit us to initialize a union member while
65- gcc warns if we don't initialize it. */
66- /* the_bfd, name, value, attr, section [, udata] */
67-#ifdef __STDC__
68-#define GLOBAL_SYM_INIT(NAME, SECTION) \
69- { 0, NAME, 0, BSF_SECTION_SYM, SECTION, { 0 }}
70-#else
71-#define GLOBAL_SYM_INIT(NAME, SECTION) \
72- { 0, NAME, 0, BSF_SECTION_SYM, SECTION }
73-#endif
74-
75 /* These symbols are global, not specific to any BFD. Therefore, anything
76 that tries to change them is broken, and should be repaired. */
77
78Index: git/bfd/ChangeLog
79===================================================================
80--- git.orig/bfd/ChangeLog 2017-09-20 12:54:44.735475444 +0530
81+++ git/bfd/ChangeLog 2017-09-20 12:54:44.903476171 +0530
82@@ -102,6 +102,14 @@
83 * readelf.c (process_mips_specific): Remove null GOT data check.
84
85 2017-04-23 Alan Modra <amodra@gmail.com>
86+
87+ PR 21414
88+ * section.c (GLOBAL_SYM_INIT): Make available in bfd.h.
89+ * elf.c (lcomm_sym): New.
90+ (_bfd_elf_large_com_section): Use lcomm_sym section symbol.
91+ * bfd-in2.h: Regenerate.
92+
93+2017-04-23 Alan Modra <amodra@gmail.com>
94
95 PR 21412
96 * elf-bfd.h (struct elf_backend_data <get_reloc_section>): Change
97Index: git/bfd/elf.c
98===================================================================
99--- git.orig/bfd/elf.c 2017-09-20 12:54:44.847475928 +0530
100+++ git/bfd/elf.c 2017-09-20 13:00:22.636091768 +0530
101@@ -10986,9 +10986,11 @@
102
103 /* It is only used by x86-64 so far.
104 ??? This repeats *COM* id of zero. sec->id is supposed to be unique,
105- but current usage would allow all of _bfd_std_section to be zero. t*/
106+ but current usage would allow all of _bfd_std_section to be zero. */
107+static const asymbol lcomm_sym
108+ = GLOBAL_SYM_INIT ("LARGE_COMMON", &_bfd_elf_large_com_section);
109 asection _bfd_elf_large_com_section
110- = BFD_FAKE_SECTION (_bfd_elf_large_com_section, NULL,
111+ = BFD_FAKE_SECTION (_bfd_elf_large_com_section, &lcomm_sym,
112 "LARGE_COMMON", 0, SEC_IS_COMMON);
113
114 void