CVE-2018-17794, CVE-2018-18700,CVE-2018-18701, CVE-2018-18484
CVE-2018-18605, CVE-2018-18606, CVE-2018-18607
Change-Id: Ibdd3a412965817bd887ccef3a6c26f9e5d011ac5
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6432
Tested-by: Tapas Kundu <tkundu@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,312 @@ |
| 0 |
+Author: nickc |
|
| 1 |
+Date: Fri Dec 7 10:33:30 2018 |
|
| 2 |
+New Revision: 266886 |
|
| 3 |
+ |
|
| 4 |
+URL: https://gcc.gnu.org/viewcvs?rev=266886&root=gcc&view=rev |
|
| 5 |
+Log: |
|
| 6 |
+Add a recursion limit to libiberty's demangling code. The limit is enabled by default, but can be disabled via a new demangling option. |
|
| 7 |
+ |
|
| 8 |
+include * demangle.h (DMGL_NO_RECURSE_LIMIT): Define. |
|
| 9 |
+ (DEMANGLE_RECURSION_LIMIT): Define |
|
| 10 |
+ |
|
| 11 |
+ PR 87681 |
|
| 12 |
+ PR 87675 |
|
| 13 |
+ PR 87636 |
|
| 14 |
+ PR 87350 |
|
| 15 |
+ PR 87335 |
|
| 16 |
+libiberty * cp-demangle.h (struct d_info): Add recursion_level field. |
|
| 17 |
+ * cp-demangle.c (d_function_type): Add recursion counter. |
|
| 18 |
+ If the recursion limit is reached and the check is not disabled, |
|
| 19 |
+ then return with a failure result. |
|
| 20 |
+ (cplus_demangle_init_info): Initialise the recursion_level field. |
|
| 21 |
+ (d_demangle_callback): If the recursion limit is enabled, check |
|
| 22 |
+ for a mangled string that is so long that there is not enough |
|
| 23 |
+ stack space for the local arrays. |
|
| 24 |
+ * cplus-dem.c (struct work): Add recursion_level field. |
|
| 25 |
+ (squangle_mop_up): Set the numb and numk fields to zero. |
|
| 26 |
+ (work_stuff_copy_to_from): Handle the case where a btypevec or |
|
| 27 |
+ ktypevec field is NULL. |
|
| 28 |
+ (demangle_nested_args): Add recursion counter. If |
|
| 29 |
+ the recursion limit is not disabled and reached, return with a |
|
| 30 |
+ failure result. |
|
| 31 |
+ |
|
| 32 |
+Modified: |
|
| 33 |
+ trunk/include/ChangeLog |
|
| 34 |
+ trunk/include/demangle.h |
|
| 35 |
+ trunk/libiberty/ChangeLog |
|
| 36 |
+ trunk/libiberty/cp-demangle.c |
|
| 37 |
+ trunk/libiberty/cp-demangle.h |
|
| 38 |
+ trunk/libiberty/cplus-dem.c |
|
| 39 |
+ |
|
| 40 |
+diff --git a/include/ChangeLog b/include/ChangeLog |
|
| 41 |
+index 18655f0..2c4a7bd 100644 |
|
| 42 |
+--- a/include/ChangeLog |
|
| 43 |
+@@ -1,3 +1,8 @@ |
|
| 44 |
++2018-12-07 Nick Clifton <nickc@redhat.com> |
|
| 45 |
++ |
|
| 46 |
++ * demangle.h (DMGL_NO_RECURSE_LIMIT): Define. |
|
| 47 |
++ (DEMANGLE_RECURSION_LIMIT): Define |
|
| 48 |
++ |
|
| 49 |
+ 2018-07-14 Nick Clifton <nickc@redhat.com> |
|
| 50 |
+ |
|
| 51 |
+ 2.31 Release point. |
|
| 52 |
+diff --git a/include/demangle.h b/include/demangle.h |
|
| 53 |
+index b8d57cf..9bb8a19 100644 |
|
| 54 |
+--- a/include/demangle.h |
|
| 55 |
+@@ -68,6 +68,17 @@ extern "C" {
|
|
| 56 |
+ /* If none of these are set, use 'current_demangling_style' as the default. */ |
|
| 57 |
+ #define DMGL_STYLE_MASK (DMGL_AUTO|DMGL_GNU|DMGL_LUCID|DMGL_ARM|DMGL_HP|DMGL_EDG|DMGL_GNU_V3|DMGL_JAVA|DMGL_GNAT|DMGL_DLANG|DMGL_RUST) |
|
| 58 |
+ |
|
| 59 |
++/* Disable a limit on the depth of recursion in mangled strings. |
|
| 60 |
++ Note if this limit is disabled then stack exhaustion is possible when |
|
| 61 |
++ demangling pathologically complicated strings. Bug reports about stack |
|
| 62 |
++ exhaustion when the option is enabled will be rejected. */ |
|
| 63 |
++#define DMGL_NO_RECURSE_LIMIT (1 << 18) |
|
| 64 |
++ |
|
| 65 |
++/* If DMGL_NO_RECURSE_LIMIT is not enabled, then this is the value used as |
|
| 66 |
++ the maximum depth of recursion allowed. It should be enough for any |
|
| 67 |
++ real-world mangled name. */ |
|
| 68 |
++#define DEMANGLE_RECURSION_LIMIT 1024 |
|
| 69 |
++ |
|
| 70 |
+ /* Enumeration of possible demangling styles. |
|
| 71 |
+ |
|
| 72 |
+ Lucid and ARM styles are still kept logically distinct, even though |
|
| 73 |
+diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog |
|
| 74 |
+index c944f9e..e547a48 100644 |
|
| 75 |
+--- a/libiberty/ChangeLog |
|
| 76 |
+@@ -1,3 +1,26 @@ |
|
| 77 |
++2018-12-07 Nick Clifton <nickc@redhat.com> |
|
| 78 |
++ |
|
| 79 |
++ PR 87681 |
|
| 80 |
++ PR 87675 |
|
| 81 |
++ PR 87636 |
|
| 82 |
++ PR 87350 |
|
| 83 |
++ PR 87335 |
|
| 84 |
++ * cp-demangle.h (struct d_info): Add recursion_level field. |
|
| 85 |
++ * cp-demangle.c (d_function_type): Add recursion counter. |
|
| 86 |
++ If the recursion limit is reached and the check is not disabled, |
|
| 87 |
++ then return with a failure result. |
|
| 88 |
++ (cplus_demangle_init_info): Initialise the recursion_level field. |
|
| 89 |
++ (d_demangle_callback): If the recursion limit is enabled, check |
|
| 90 |
++ for a mangled string that is so long that there is not enough |
|
| 91 |
++ stack space for the local arrays. |
|
| 92 |
++ * cplus-dem.c (struct work): Add recursion_level field. |
|
| 93 |
++ (squangle_mop_up): Set the numb and numk fields to zero. |
|
| 94 |
++ (work_stuff_copy_to_from): Handle the case where a btypevec or |
|
| 95 |
++ ktypevec field is NULL. |
|
| 96 |
++ (demangle_nested_args): Add recursion counter. If |
|
| 97 |
++ the recursion limit is not disabled and reached, return with a |
|
| 98 |
++ failure result. |
|
| 99 |
++ |
|
| 100 |
+ 2018-06-19 Simon Marchi <simon.marchi@ericsson.com> |
|
| 101 |
+ |
|
| 102 |
+ * configure.ac: Remove AC_PREREQ. |
|
| 103 |
+diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c |
|
| 104 |
+index 3f2a097..c374e46 100644 |
|
| 105 |
+--- a/libiberty/cp-demangle.c |
|
| 106 |
+@@ -2843,21 +2843,35 @@ d_ref_qualifier (struct d_info *di, struct demangle_component *sub) |
|
| 107 |
+ static struct demangle_component * |
|
| 108 |
+ d_function_type (struct d_info *di) |
|
| 109 |
+ {
|
|
| 110 |
+- struct demangle_component *ret; |
|
| 111 |
++ struct demangle_component *ret = NULL; |
|
| 112 |
+ |
|
| 113 |
+- if (! d_check_char (di, 'F')) |
|
| 114 |
+- return NULL; |
|
| 115 |
+- if (d_peek_char (di) == 'Y') |
|
| 116 |
++ if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0) |
|
| 117 |
+ {
|
|
| 118 |
+- /* Function has C linkage. We don't print this information. |
|
| 119 |
+- FIXME: We should print it in verbose mode. */ |
|
| 120 |
+- d_advance (di, 1); |
|
| 121 |
++ if (di->recursion_level > DEMANGLE_RECURSION_LIMIT) |
|
| 122 |
++ /* FIXME: There ought to be a way to report |
|
| 123 |
++ that the recursion limit has been reached. */ |
|
| 124 |
++ return NULL; |
|
| 125 |
++ |
|
| 126 |
++ di->recursion_level ++; |
|
| 127 |
+ } |
|
| 128 |
+- ret = d_bare_function_type (di, 1); |
|
| 129 |
+- ret = d_ref_qualifier (di, ret); |
|
| 130 |
+ |
|
| 131 |
+- if (! d_check_char (di, 'E')) |
|
| 132 |
+- return NULL; |
|
| 133 |
++ if (d_check_char (di, 'F')) |
|
| 134 |
++ {
|
|
| 135 |
++ if (d_peek_char (di) == 'Y') |
|
| 136 |
++ {
|
|
| 137 |
++ /* Function has C linkage. We don't print this information. |
|
| 138 |
++ FIXME: We should print it in verbose mode. */ |
|
| 139 |
++ d_advance (di, 1); |
|
| 140 |
++ } |
|
| 141 |
++ ret = d_bare_function_type (di, 1); |
|
| 142 |
++ ret = d_ref_qualifier (di, ret); |
|
| 143 |
++ |
|
| 144 |
++ if (! d_check_char (di, 'E')) |
|
| 145 |
++ ret = NULL; |
|
| 146 |
++ } |
|
| 147 |
++ |
|
| 148 |
++ if ((di->options & DMGL_NO_RECURSE_LIMIT) == 0) |
|
| 149 |
++ di->recursion_level --; |
|
| 150 |
+ return ret; |
|
| 151 |
+ } |
|
| 152 |
+ |
|
| 153 |
+@@ -6188,6 +6202,7 @@ cplus_demangle_init_info (const char *mangled, int options, size_t len, |
|
| 154 |
+ di->expansion = 0; |
|
| 155 |
+ di->is_expression = 0; |
|
| 156 |
+ di->is_conversion = 0; |
|
| 157 |
++ di->recursion_level = 0; |
|
| 158 |
+ } |
|
| 159 |
+ |
|
| 160 |
+ /* Internal implementation for the demangler. If MANGLED is a g++ v3 ABI |
|
| 161 |
+@@ -6227,6 +6242,20 @@ d_demangle_callback (const char *mangled, int options, |
|
| 162 |
+ |
|
| 163 |
+ cplus_demangle_init_info (mangled, options, strlen (mangled), &di); |
|
| 164 |
+ |
|
| 165 |
++ /* PR 87675 - Check for a mangled string that is so long |
|
| 166 |
++ that we do not have enough stack space to demangle it. */ |
|
| 167 |
++ if (((options & DMGL_NO_RECURSE_LIMIT) == 0) |
|
| 168 |
++ /* This check is a bit arbitrary, since what we really want to do is to |
|
| 169 |
++ compare the sizes of the di.comps and di.subs arrays against the |
|
| 170 |
++ amount of stack space remaining. But there is no portable way to do |
|
| 171 |
++ this, so instead we use the recursion limit as a guide to the maximum |
|
| 172 |
++ size of the arrays. */ |
|
| 173 |
++ && (unsigned long) di.num_comps > DEMANGLE_RECURSION_LIMIT) |
|
| 174 |
++ {
|
|
| 175 |
++ /* FIXME: We need a way to indicate that a stack limit has been reached. */ |
|
| 176 |
++ return 0; |
|
| 177 |
++ } |
|
| 178 |
++ |
|
| 179 |
+ {
|
|
| 180 |
+ #ifdef CP_DYNAMIC_ARRAYS |
|
| 181 |
+ __extension__ struct demangle_component comps[di.num_comps]; |
|
| 182 |
+diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h |
|
| 183 |
+index 51b8a24..d87a830 100644 |
|
| 184 |
+--- a/libiberty/cp-demangle.h |
|
| 185 |
+@@ -122,6 +122,9 @@ struct d_info |
|
| 186 |
+ /* Non-zero if we are parsing the type operand of a conversion |
|
| 187 |
+ operator, but not when in an expression. */ |
|
| 188 |
+ int is_conversion; |
|
| 189 |
++ /* If DMGL_NO_RECURSE_LIMIT is not active then this is set to |
|
| 190 |
++ the current recursion level. */ |
|
| 191 |
++ unsigned int recursion_level; |
|
| 192 |
+ }; |
|
| 193 |
+ |
|
| 194 |
+ /* To avoid running past the ending '\0', don't: |
|
| 195 |
+diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c |
|
| 196 |
+index 6d58bd8..8b9646f 100644 |
|
| 197 |
+--- a/libiberty/cplus-dem.c |
|
| 198 |
+@@ -146,6 +146,7 @@ struct work_stuff |
|
| 199 |
+ int *proctypevec; /* Indices of currently processed remembered typevecs. */ |
|
| 200 |
+ int proctypevec_size; |
|
| 201 |
+ int nproctypes; |
|
| 202 |
++ unsigned int recursion_level; |
|
| 203 |
+ }; |
|
| 204 |
+ |
|
| 205 |
+ #define PRINT_ANSI_QUALIFIERS (work -> options & DMGL_ANSI) |
|
| 206 |
+@@ -1292,12 +1293,14 @@ squangle_mop_up (struct work_stuff *work) |
|
| 207 |
+ free ((char *) work -> btypevec); |
|
| 208 |
+ work->btypevec = NULL; |
|
| 209 |
+ work->bsize = 0; |
|
| 210 |
++ work->numb = 0; |
|
| 211 |
+ } |
|
| 212 |
+ if (work -> ktypevec != NULL) |
|
| 213 |
+ {
|
|
| 214 |
+ free ((char *) work -> ktypevec); |
|
| 215 |
+ work->ktypevec = NULL; |
|
| 216 |
+ work->ksize = 0; |
|
| 217 |
++ work->numk = 0; |
|
| 218 |
+ } |
|
| 219 |
+ } |
|
| 220 |
+ |
|
| 221 |
+@@ -1331,8 +1334,15 @@ work_stuff_copy_to_from (struct work_stuff *to, struct work_stuff *from) |
|
| 222 |
+ |
|
| 223 |
+ for (i = 0; i < from->numk; i++) |
|
| 224 |
+ {
|
|
| 225 |
+- int len = strlen (from->ktypevec[i]) + 1; |
|
| 226 |
++ int len; |
|
| 227 |
++ |
|
| 228 |
++ if (from->ktypevec[i] == NULL) |
|
| 229 |
++ {
|
|
| 230 |
++ to->ktypevec[i] = NULL; |
|
| 231 |
++ continue; |
|
| 232 |
++ } |
|
| 233 |
+ |
|
| 234 |
++ len = strlen (from->ktypevec[i]) + 1; |
|
| 235 |
+ to->ktypevec[i] = XNEWVEC (char, len); |
|
| 236 |
+ memcpy (to->ktypevec[i], from->ktypevec[i], len); |
|
| 237 |
+ } |
|
| 238 |
+@@ -1342,8 +1352,15 @@ work_stuff_copy_to_from (struct work_stuff *to, struct work_stuff *from) |
|
| 239 |
+ |
|
| 240 |
+ for (i = 0; i < from->numb; i++) |
|
| 241 |
+ {
|
|
| 242 |
+- int len = strlen (from->btypevec[i]) + 1; |
|
| 243 |
++ int len; |
|
| 244 |
++ |
|
| 245 |
++ if (from->btypevec[i] == NULL) |
|
| 246 |
++ {
|
|
| 247 |
++ to->btypevec[i] = NULL; |
|
| 248 |
++ continue; |
|
| 249 |
++ } |
|
| 250 |
+ |
|
| 251 |
++ len = strlen (from->btypevec[i]) + 1; |
|
| 252 |
+ to->btypevec[i] = XNEWVEC (char , len); |
|
| 253 |
+ memcpy (to->btypevec[i], from->btypevec[i], len); |
|
| 254 |
+ } |
|
| 255 |
+@@ -1401,6 +1418,7 @@ delete_non_B_K_work_stuff (struct work_stuff *work) |
|
| 256 |
+ |
|
| 257 |
+ free ((char*) work->tmpl_argvec); |
|
| 258 |
+ work->tmpl_argvec = NULL; |
|
| 259 |
++ work->ntmpl_args = 0; |
|
| 260 |
+ } |
|
| 261 |
+ if (work->previous_argument) |
|
| 262 |
+ {
|
|
| 263 |
+@@ -4477,6 +4495,7 @@ remember_Btype (struct work_stuff *work, const char *start, |
|
| 264 |
+ } |
|
| 265 |
+ |
|
| 266 |
+ /* Lose all the info related to B and K type codes. */ |
|
| 267 |
++ |
|
| 268 |
+ static void |
|
| 269 |
+ forget_B_and_K_types (struct work_stuff *work) |
|
| 270 |
+ {
|
|
| 271 |
+@@ -4502,6 +4521,7 @@ forget_B_and_K_types (struct work_stuff *work) |
|
| 272 |
+ } |
|
| 273 |
+ } |
|
| 274 |
+ } |
|
| 275 |
++ |
|
| 276 |
+ /* Forget the remembered types, but not the type vector itself. */ |
|
| 277 |
+ |
|
| 278 |
+ static void |
|
| 279 |
+@@ -4696,6 +4716,16 @@ demangle_nested_args (struct work_stuff *work, const char **mangled, |
|
| 280 |
+ int result; |
|
| 281 |
+ int saved_nrepeats; |
|
| 282 |
+ |
|
| 283 |
++ if ((work->options & DMGL_NO_RECURSE_LIMIT) == 0) |
|
| 284 |
++ {
|
|
| 285 |
++ if (work->recursion_level > DEMANGLE_RECURSION_LIMIT) |
|
| 286 |
++ /* FIXME: There ought to be a way to report |
|
| 287 |
++ that the recursion limit has been reached. */ |
|
| 288 |
++ return 0; |
|
| 289 |
++ |
|
| 290 |
++ work->recursion_level ++; |
|
| 291 |
++ } |
|
| 292 |
++ |
|
| 293 |
+ /* The G++ name-mangling algorithm does not remember types on nested |
|
| 294 |
+ argument lists, unless -fsquangling is used, and in that case the |
|
| 295 |
+ type vector updated by remember_type is not used. So, we turn |
|
| 296 |
+@@ -4722,6 +4752,9 @@ demangle_nested_args (struct work_stuff *work, const char **mangled, |
|
| 297 |
+ --work->forgetting_types; |
|
| 298 |
+ work->nrepeats = saved_nrepeats; |
|
| 299 |
+ |
|
| 300 |
++ if ((work->options & DMGL_NO_RECURSE_LIMIT) == 0) |
|
| 301 |
++ --work->recursion_level; |
|
| 302 |
++ |
|
| 303 |
+ return result; |
|
| 304 |
+ } |
|
| 305 |
+ |
| 0 | 306 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,41 @@ |
| 0 |
+From ab419ddbb2cdd17ca83618990f2cacf904ce1d61 Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: Alan Modra <amodra@gmail.com> |
|
| 2 |
+Date: Tue, 23 Oct 2018 18:29:24 +1030 |
|
| 3 |
+Subject: [PATCH] PR23804, buffer overflow in sec_merge_hash_lookup |
|
| 4 |
+ |
|
| 5 |
+ PR 23804 |
|
| 6 |
+ * merge.c (_bfd_add_merge_section): Don't attempt to merge |
|
| 7 |
+ sections where size is not a multiple of entsize. |
|
| 8 |
+--- |
|
| 9 |
+ bfd/ChangeLog | 6 ++++++ |
|
| 10 |
+ bfd/merge.c | 3 +++ |
|
| 11 |
+ 2 files changed, 9 insertions(+) |
|
| 12 |
+ |
|
| 13 |
+diff --git a/bfd/ChangeLog b/bfd/ChangeLog |
|
| 14 |
+index f05251a..d584505 100644 |
|
| 15 |
+--- a/bfd/ChangeLog |
|
| 16 |
+@@ -1,3 +1,9 @@ |
|
| 17 |
++2018-10-23 Alan Modra <amodra@gmail.com> |
|
| 18 |
++ |
|
| 19 |
++ PR 23804 |
|
| 20 |
++ * merge.c (_bfd_add_merge_section): Don't attempt to merge |
|
| 21 |
++ sections where size is not a multiple of entsize. |
|
| 22 |
++ |
|
| 23 |
+ 2018-07-14 Nick Clifton <nickc@redhat.com> |
|
| 24 |
+ |
|
| 25 |
+ 2.31 Release point. |
|
| 26 |
+diff --git a/bfd/merge.c b/bfd/merge.c |
|
| 27 |
+index 7904552..5e3bba0 100644 |
|
| 28 |
+--- a/bfd/merge.c |
|
| 29 |
+@@ -376,6 +376,9 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec, |
|
| 30 |
+ || sec->entsize == 0) |
|
| 31 |
+ return TRUE; |
|
| 32 |
+ |
|
| 33 |
++ if (sec->size % sec->entsize != 0) |
|
| 34 |
++ return TRUE; |
|
| 35 |
++ |
|
| 36 |
+ if ((sec->flags & SEC_RELOC) != 0) |
|
| 37 |
+ {
|
|
| 38 |
+ /* We aren't prepared to handle relocations in merged sections. */ |
| 0 | 39 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,64 @@ |
| 0 |
+From 45a0eaf77022963d639d6d19871dbab7b79703fc Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: Alan Modra <amodra@gmail.com> |
|
| 2 |
+Date: Tue, 23 Oct 2018 19:02:06 +1030 |
|
| 3 |
+Subject: [PATCH] PR23806, NULL pointer dereference in merge_strings |
|
| 4 |
+ |
|
| 5 |
+ PR 23806 |
|
| 6 |
+ * merge.c (_bfd_add_merge_section): Don't attempt to merge |
|
| 7 |
+ sections with ridiculously large alignments. |
|
| 8 |
+--- |
|
| 9 |
+ bfd/ChangeLog | 6 ++++++ |
|
| 10 |
+ bfd/merge.c | 15 +++++++++++---- |
|
| 11 |
+ 2 files changed, 17 insertions(+), 4 deletions(-) |
|
| 12 |
+ |
|
| 13 |
+diff --git a/bfd/ChangeLog b/bfd/ChangeLog |
|
| 14 |
+index cc04287..f13882a 100644 |
|
| 15 |
+--- a/bfd/ChangeLog |
|
| 16 |
+@@ -1,5 +1,11 @@ |
|
| 17 |
+ 2018-10-23 Alan Modra <amodra@gmail.com> |
|
| 18 |
+ |
|
| 19 |
++ PR 23806 |
|
| 20 |
++ * merge.c (_bfd_add_merge_section): Don't attempt to merge |
|
| 21 |
++ sections with ridiculously large alignments. |
|
| 22 |
++ |
|
| 23 |
++2018-10-23 Alan Modra <amodra@gmail.com> |
|
| 24 |
++ |
|
| 25 |
+ PR 23805 |
|
| 26 |
+ * elflink.c (elf_link_input_bfd): Don't segfault on finding |
|
| 27 |
+ STT_TLS symbols without any TLS sections. Instead, change the |
|
| 28 |
+diff --git a/bfd/merge.c b/bfd/merge.c |
|
| 29 |
+index 5e3bba0..7de0c88 100644 |
|
| 30 |
+--- a/bfd/merge.c |
|
| 31 |
+@@ -24,6 +24,7 @@ |
|
| 32 |
+ as used in ELF SHF_MERGE. */ |
|
| 33 |
+ |
|
| 34 |
+ #include "sysdep.h" |
|
| 35 |
++#include <limits.h> |
|
| 36 |
+ #include "bfd.h" |
|
| 37 |
+ #include "elf-bfd.h" |
|
| 38 |
+ #include "libbfd.h" |
|
| 39 |
+@@ -385,12 +386,18 @@ _bfd_add_merge_section (bfd *abfd, void **psinfo, asection *sec, |
|
| 40 |
+ return TRUE; |
|
| 41 |
+ } |
|
| 42 |
+ |
|
| 43 |
+- align = sec->alignment_power; |
|
| 44 |
+- if ((sec->entsize < (unsigned) 1 << align |
|
| 45 |
++#ifndef CHAR_BIT |
|
| 46 |
++#define CHAR_BIT 8 |
|
| 47 |
++#endif |
|
| 48 |
++ if (sec->alignment_power >= sizeof (align) * CHAR_BIT) |
|
| 49 |
++ return TRUE; |
|
| 50 |
++ |
|
| 51 |
++ align = 1u << sec->alignment_power; |
|
| 52 |
++ if ((sec->entsize < align |
|
| 53 |
+ && ((sec->entsize & (sec->entsize - 1)) |
|
| 54 |
+ || !(sec->flags & SEC_STRINGS))) |
|
| 55 |
+- || (sec->entsize > (unsigned) 1 << align |
|
| 56 |
+- && (sec->entsize & (((unsigned) 1 << align) - 1)))) |
|
| 57 |
++ || (sec->entsize > align |
|
| 58 |
++ && (sec->entsize & (align - 1)))) |
|
| 59 |
+ {
|
|
| 60 |
+ /* Sanity check. If string character size is smaller than |
|
| 61 |
+ alignment, then we require character size to be a power |
| 0 | 62 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,74 @@ |
| 0 |
+From 102def4da826b3d9e169741421e5e67e8731909a Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: Alan Modra <amodra@gmail.com> |
|
| 2 |
+Date: Tue, 23 Oct 2018 18:30:22 +1030 |
|
| 3 |
+Subject: [PATCH] PR23805, NULL pointer dereference in elf_link_input_bfd |
|
| 4 |
+ |
|
| 5 |
+ PR 23805 |
|
| 6 |
+ * elflink.c (elf_link_input_bfd): Don't segfault on finding |
|
| 7 |
+ STT_TLS symbols without any TLS sections. Instead, change the |
|
| 8 |
+ symbol type to STT_NOTYPE. |
|
| 9 |
+--- |
|
| 10 |
+ bfd/ChangeLog | 7 +++++++ |
|
| 11 |
+ bfd/elflink.c | 20 ++++++++++++++------ |
|
| 12 |
+ 2 files changed, 21 insertions(+), 6 deletions(-) |
|
| 13 |
+ |
|
| 14 |
+diff --git a/bfd/ChangeLog b/bfd/ChangeLog |
|
| 15 |
+index da423b1..1f3fc1c 100644 |
|
| 16 |
+--- a/bfd/ChangeLog |
|
| 17 |
+@@ -1,5 +1,12 @@ |
|
| 18 |
+ 2018-10-23 Alan Modra <amodra@gmail.com> |
|
| 19 |
+ |
|
| 20 |
++ PR 23805 |
|
| 21 |
++ * elflink.c (elf_link_input_bfd): Don't segfault on finding |
|
| 22 |
++ STT_TLS symbols without any TLS sections. Instead, change the |
|
| 23 |
++ symbol type to STT_NOTYPE. |
|
| 24 |
++ |
|
| 25 |
++2018-10-23 Alan Modra <amodra@gmail.com> |
|
| 26 |
++ |
|
| 27 |
+ PR 23804 |
|
| 28 |
+ * merge.c (_bfd_add_merge_section): Don't attempt to merge |
|
| 29 |
+ sections where size is not a multiple of entsize. |
|
| 30 |
+diff --git a/bfd/elflink.c b/bfd/elflink.c |
|
| 31 |
+index c3876cb..87440db 100644 |
|
| 32 |
+--- a/bfd/elflink.c |
|
| 33 |
+@@ -10489,8 +10489,11 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) |
|
| 34 |
+ if (ELF_ST_TYPE (osym.st_info) == STT_TLS) |
|
| 35 |
+ {
|
|
| 36 |
+ /* STT_TLS symbols are relative to PT_TLS segment base. */ |
|
| 37 |
+- BFD_ASSERT (elf_hash_table (flinfo->info)->tls_sec != NULL); |
|
| 38 |
+- osym.st_value -= elf_hash_table (flinfo->info)->tls_sec->vma; |
|
| 39 |
++ if (elf_hash_table (flinfo->info)->tls_sec != NULL) |
|
| 40 |
++ osym.st_value -= elf_hash_table (flinfo->info)->tls_sec->vma; |
|
| 41 |
++ else |
|
| 42 |
++ osym.st_info = ELF_ST_INFO (ELF_ST_BIND (osym.st_info), |
|
| 43 |
++ STT_NOTYPE); |
|
| 44 |
+ } |
|
| 45 |
+ } |
|
| 46 |
+ |
|
| 47 |
+@@ -11046,12 +11049,17 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd) |
|
| 48 |
+ sym.st_value += osec->vma; |
|
| 49 |
+ if (ELF_ST_TYPE (sym.st_info) == STT_TLS) |
|
| 50 |
+ {
|
|
| 51 |
++ struct elf_link_hash_table *htab |
|
| 52 |
++ = elf_hash_table (flinfo->info); |
|
| 53 |
++ |
|
| 54 |
+ /* STT_TLS symbols are relative to PT_TLS |
|
| 55 |
+ segment base. */ |
|
| 56 |
+- BFD_ASSERT (elf_hash_table (flinfo->info) |
|
| 57 |
+- ->tls_sec != NULL); |
|
| 58 |
+- sym.st_value -= (elf_hash_table (flinfo->info) |
|
| 59 |
+- ->tls_sec->vma); |
|
| 60 |
++ if (htab->tls_sec != NULL) |
|
| 61 |
++ sym.st_value -= htab->tls_sec->vma; |
|
| 62 |
++ else |
|
| 63 |
++ sym.st_info |
|
| 64 |
++ = ELF_ST_INFO (ELF_ST_BIND (sym.st_info), |
|
| 65 |
++ STT_NOTYPE); |
|
| 66 |
+ } |
|
| 67 |
+ } |
|
| 68 |
+ |
|
| 69 |
+-- |
|
| 70 |
+2.9.3 |
|
| 71 |
+ |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
Summary: Contains a linker, an assembler, and other tools |
| 2 | 2 |
Name: binutils |
| 3 | 3 |
Version: 2.31 |
| 4 |
-Release: 1%{?dist}
|
|
| 4 |
+Release: 2%{?dist}
|
|
| 5 | 5 |
License: GPLv2+ |
| 6 | 6 |
URL: http://www.gnu.org/software/binutils |
| 7 | 7 |
Group: System Environment/Base |
| ... | ... |
@@ -9,6 +9,10 @@ Vendor: VMware, Inc. |
| 9 | 9 |
Distribution: Photon |
| 10 | 10 |
Source0: http://ftp.gnu.org/gnu/binutils/%{name}-%{version}.tar.xz
|
| 11 | 11 |
%define sha1 binutils=e1a564cd356d2126d2e9a59e8587757634e731aa |
| 12 |
+Patch0: binutils-CVE-2018-17794-18700-18701-18484.patch |
|
| 13 |
+Patch1: binutils-CVE-2018-18605.patch |
|
| 14 |
+Patch2: binutils-CVE-2018-18607.patch |
|
| 15 |
+Patch3: binutils-CVE-2018-18606.patch |
|
| 12 | 16 |
|
| 13 | 17 |
%description |
| 14 | 18 |
The Binutils package contains a linker, an assembler, |
| ... | ... |
@@ -23,6 +27,10 @@ for handling compiled objects. |
| 23 | 23 |
|
| 24 | 24 |
%prep |
| 25 | 25 |
%setup -q |
| 26 |
+%patch0 -p1 |
|
| 27 |
+%patch1 -p1 |
|
| 28 |
+%patch2 -p1 |
|
| 29 |
+%patch3 -p1 |
|
| 26 | 30 |
|
| 27 | 31 |
%build |
| 28 | 32 |
install -vdm 755 ../binutils-build |
| ... | ... |
@@ -111,6 +119,9 @@ make %{?_smp_mflags} check
|
| 111 | 111 |
%{_libdir}/libopcodes.so
|
| 112 | 112 |
|
| 113 | 113 |
%changelog |
| 114 |
+* Wed Jan 02 2019 Ankit Jain <ankitja@vmware.com> 2.31-2 |
|
| 115 |
+- Fixes for CVE-2018-17794, CVE-2018-18700, CVE-2018-18701 |
|
| 116 |
+- CVE-2018-18484, CVE-2018-18605, CVE-2018-18606, CVE-2018-18607 |
|
| 114 | 117 |
* Fri Jul 27 2018 Keerthana K <keerthanak@vmware.com> 2.31-1 |
| 115 | 118 |
- Update to Version 2.31. |
| 116 | 119 |
* Mon Jun 25 2018 Keerthana K <keerthanak@vmware.com> 2.30-5 |