diff options
| author | Trevor Gamblin <trevor.gamblin@windriver.com> | 2019-11-18 07:23:31 +0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-19 00:24:22 +0000 |
| commit | 724eb2e369f0050ee5ee4374c43df14ee96e04ae (patch) | |
| tree | 7403919cfefefc4169518e0c29a94108bbbee838 | |
| parent | 1fc208bd48f8942d80b02ecc2cf70edb294916a7 (diff) | |
| download | poky-724eb2e369f0050ee5ee4374c43df14ee96e04ae.tar.gz | |
binutils: fix CVE-2019-17450
Backport upstream fix. No upstream release version of
binutils it yet, so backport the fix independently.
(From OE-Core rev: a4ead72b958ded4941f96741029f4955930ba758)
(From OE-Core rev: 8b33aeb4122be31b2aed29e40dcac01ea4643b63)
Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.32.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils/CVE-2019-17450.patch | 99 |
2 files changed, 100 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.32.inc b/meta/recipes-devtools/binutils/binutils-2.32.inc index 19baf8a883..1e96cf494d 100644 --- a/meta/recipes-devtools/binutils/binutils-2.32.inc +++ b/meta/recipes-devtools/binutils/binutils-2.32.inc | |||
| @@ -49,6 +49,7 @@ SRC_URI = "\ | |||
| 49 | file://CVE-2019-12972.patch \ | 49 | file://CVE-2019-12972.patch \ |
| 50 | file://CVE-2019-14250.patch \ | 50 | file://CVE-2019-14250.patch \ |
| 51 | file://CVE-2019-14444.patch \ | 51 | file://CVE-2019-14444.patch \ |
| 52 | file://CVE-2019-17450.patch \ | ||
| 52 | " | 53 | " |
| 53 | S = "${WORKDIR}/git" | 54 | S = "${WORKDIR}/git" |
| 54 | 55 | ||
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2019-17450.patch b/meta/recipes-devtools/binutils/binutils/CVE-2019-17450.patch new file mode 100644 index 0000000000..a6ce0b9a8a --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2019-17450.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | From 09dd135df9ebc7a4b640537e23e26a03a288a789 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alan Modra <amodra@gmail.com> | ||
| 3 | Date: Wed, 9 Oct 2019 00:07:29 +1030 | ||
| 4 | Subject: [PATCH] PR25078, stack overflow in function find_abstract_instance | ||
| 5 | |||
| 6 | Selectively backporting fix for bfd/dwarf2.c, but not the ChangeLog | ||
| 7 | file. There are newer versions of binutils, but none of them contain the | ||
| 8 | commit fixing CVE-2019-17450, so backport it to master and zeus. | ||
| 9 | |||
| 10 | Upstream-Status: Backport [https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=063c511bd79] | ||
| 11 | CVE: CVE-2019-17450 | ||
| 12 | Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com> | ||
| 13 | |||
| 14 | PR 25078 | ||
| 15 | * dwarf2.c (find_abstract_instance): Delete orig_info_ptr, add | ||
| 16 | recur_count. Error on recur_count reaching 100 rather than | ||
| 17 | info_ptr matching orig_info_ptr. Adjust calls. | ||
| 18 | |||
| 19 | --- | ||
| 20 | bfd/dwarf2.c | 35 +++++++++++++++++------------------ | ||
| 21 | 1 file changed, 17 insertions(+), 18 deletions(-) | ||
| 22 | |||
| 23 | diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c | ||
| 24 | index 0b4e485582..20ec9e2e56 100644 | ||
| 25 | --- a/bfd/dwarf2.c | ||
| 26 | +++ b/bfd/dwarf2.c | ||
| 27 | @@ -2803,13 +2803,13 @@ lookup_symbol_in_variable_table (struct comp_unit *unit, | ||
| 28 | } | ||
| 29 | |||
| 30 | static bfd_boolean | ||
| 31 | -find_abstract_instance (struct comp_unit * unit, | ||
| 32 | - bfd_byte * orig_info_ptr, | ||
| 33 | - struct attribute * attr_ptr, | ||
| 34 | - const char ** pname, | ||
| 35 | - bfd_boolean * is_linkage, | ||
| 36 | - char ** filename_ptr, | ||
| 37 | - int * linenumber_ptr) | ||
| 38 | +find_abstract_instance (struct comp_unit *unit, | ||
| 39 | + struct attribute *attr_ptr, | ||
| 40 | + unsigned int recur_count, | ||
| 41 | + const char **pname, | ||
| 42 | + bfd_boolean *is_linkage, | ||
| 43 | + char **filename_ptr, | ||
| 44 | + int *linenumber_ptr) | ||
| 45 | { | ||
| 46 | bfd *abfd = unit->abfd; | ||
| 47 | bfd_byte *info_ptr; | ||
| 48 | @@ -2820,6 +2820,14 @@ find_abstract_instance (struct comp_unit * unit, | ||
| 49 | struct attribute attr; | ||
| 50 | const char *name = NULL; | ||
| 51 | |||
| 52 | + if (recur_count == 100) | ||
| 53 | + { | ||
| 54 | + _bfd_error_handler | ||
| 55 | + (_("DWARF error: abstract instance recursion detected")); | ||
| 56 | + bfd_set_error (bfd_error_bad_value); | ||
| 57 | + return FALSE; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | /* DW_FORM_ref_addr can reference an entry in a different CU. It | ||
| 61 | is an offset from the .debug_info section, not the current CU. */ | ||
| 62 | if (attr_ptr->form == DW_FORM_ref_addr) | ||
| 63 | @@ -2939,15 +2947,6 @@ find_abstract_instance (struct comp_unit * unit, | ||
| 64 | info_ptr, info_ptr_end); | ||
| 65 | if (info_ptr == NULL) | ||
| 66 | break; | ||
| 67 | - /* It doesn't ever make sense for DW_AT_specification to | ||
| 68 | - refer to the same DIE. Stop simple recursion. */ | ||
| 69 | - if (info_ptr == orig_info_ptr) | ||
| 70 | - { | ||
| 71 | - _bfd_error_handler | ||
| 72 | - (_("DWARF error: abstract instance recursion detected")); | ||
| 73 | - bfd_set_error (bfd_error_bad_value); | ||
| 74 | - return FALSE; | ||
| 75 | - } | ||
| 76 | switch (attr.name) | ||
| 77 | { | ||
| 78 | case DW_AT_name: | ||
| 79 | @@ -2961,7 +2960,7 @@ find_abstract_instance (struct comp_unit * unit, | ||
| 80 | } | ||
| 81 | break; | ||
| 82 | case DW_AT_specification: | ||
| 83 | - if (!find_abstract_instance (unit, info_ptr, &attr, | ||
| 84 | + if (!find_abstract_instance (unit, &attr, recur_count + 1, | ||
| 85 | &name, is_linkage, | ||
| 86 | filename_ptr, linenumber_ptr)) | ||
| 87 | return FALSE; | ||
| 88 | @@ -3175,7 +3174,7 @@ scan_unit_for_symbols (struct comp_unit *unit) | ||
| 89 | |||
| 90 | case DW_AT_abstract_origin: | ||
| 91 | case DW_AT_specification: | ||
| 92 | - if (!find_abstract_instance (unit, info_ptr, &attr, | ||
| 93 | + if (!find_abstract_instance (unit, &attr, 0, | ||
| 94 | &func->name, | ||
| 95 | &func->is_linkage, | ||
| 96 | &func->file, | ||
| 97 | -- | ||
| 98 | 2.23.0 | ||
| 99 | |||
