diff options
| author | Armin Kuster <akuster808@gmail.com> | 2017-11-26 12:52:56 -0800 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-12-11 22:02:58 +0000 |
| commit | 640706066cc74667e16dd0a4014a417418fcad3c (patch) | |
| tree | f1e37f49723b3c7d7e509782d8b426810e77a9bf | |
| parent | a24b585342a351d56f817ca5e41554b2038b6015 (diff) | |
| download | poky-640706066cc74667e16dd0a4014a417418fcad3c.tar.gz | |
binutils: Secuirty fix CVE-2017-8396 and CVE-2017-8397
Affects: <= 2.28
(From OE-Core rev: 006d106c81420ab53a9755f96edb58c227850587)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.28.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/binutils/binutils/CVE-2017-8396_8397.patch | 102 |
2 files changed, 103 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.28.inc b/meta/recipes-devtools/binutils/binutils-2.28.inc index 8c91f4c920..ca78a30bb7 100644 --- a/meta/recipes-devtools/binutils/binutils-2.28.inc +++ b/meta/recipes-devtools/binutils/binutils-2.28.inc | |||
| @@ -48,6 +48,7 @@ SRC_URI = "\ | |||
| 48 | file://CVE-2017-8393.patch \ | 48 | file://CVE-2017-8393.patch \ |
| 49 | file://CVE-2017-8394.patch \ | 49 | file://CVE-2017-8394.patch \ |
| 50 | file://CVE-2017-8395.patch \ | 50 | file://CVE-2017-8395.patch \ |
| 51 | file://CVE-2017-8396_8397.patch \ | ||
| 51 | " | 52 | " |
| 52 | S = "${WORKDIR}/git" | 53 | S = "${WORKDIR}/git" |
| 53 | 54 | ||
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-8396_8397.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-8396_8397.patch new file mode 100644 index 0000000000..14f42824a0 --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-8396_8397.patch | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | From a941291cab71b9ac356e1c03968c177c03e602ab Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Alan Modra <amodra@gmail.com> | ||
| 3 | Date: Sat, 29 Apr 2017 14:48:16 +0930 | ||
| 4 | Subject: [PATCH] PR21432, buffer overflow in perform_relocation | ||
| 5 | |||
| 6 | The existing reloc offset range tests didn't catch small negative | ||
| 7 | offsets less than the size of the reloc field. | ||
| 8 | |||
| 9 | PR 21432 | ||
| 10 | * reloc.c (reloc_offset_in_range): New function. | ||
| 11 | (bfd_perform_relocation, bfd_install_relocation): Use it. | ||
| 12 | (_bfd_final_link_relocate): Likewise. | ||
| 13 | |||
| 14 | Upstream-Status: Backport | ||
| 15 | CVE: CVE-2017-8396 | ||
| 16 | CVE: CVE-2017-8397 | ||
| 17 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
| 18 | |||
| 19 | --- | ||
| 20 | bfd/ChangeLog | 7 +++++++ | ||
| 21 | bfd/reloc.c | 32 ++++++++++++++++++++------------ | ||
| 22 | 2 files changed, 27 insertions(+), 12 deletions(-) | ||
| 23 | |||
| 24 | Index: git/bfd/reloc.c | ||
| 25 | =================================================================== | ||
| 26 | --- git.orig/bfd/reloc.c | ||
| 27 | +++ git/bfd/reloc.c | ||
| 28 | @@ -538,6 +538,22 @@ bfd_check_overflow (enum complain_overfl | ||
| 29 | return flag; | ||
| 30 | } | ||
| 31 | |||
| 32 | +/* HOWTO describes a relocation, at offset OCTET. Return whether the | ||
| 33 | + relocation field is within SECTION of ABFD. */ | ||
| 34 | + | ||
| 35 | +static bfd_boolean | ||
| 36 | +reloc_offset_in_range (reloc_howto_type *howto, bfd *abfd, | ||
| 37 | + asection *section, bfd_size_type octet) | ||
| 38 | +{ | ||
| 39 | + bfd_size_type octet_end = bfd_get_section_limit_octets (abfd, section); | ||
| 40 | + bfd_size_type reloc_size = bfd_get_reloc_size (howto); | ||
| 41 | + | ||
| 42 | + /* The reloc field must be contained entirely within the section. | ||
| 43 | + Allow zero length fields (marker relocs or NONE relocs where no | ||
| 44 | + relocation will be performed) at the end of the section. */ | ||
| 45 | + return octet <= octet_end && octet + reloc_size <= octet_end; | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | /* | ||
| 49 | FUNCTION | ||
| 50 | bfd_perform_relocation | ||
| 51 | @@ -618,13 +634,10 @@ bfd_perform_relocation (bfd *abfd, | ||
| 52 | /* PR 17512: file: 0f67f69d. */ | ||
| 53 | if (howto == NULL) | ||
| 54 | return bfd_reloc_undefined; | ||
| 55 | - | ||
| 56 | - /* Is the address of the relocation really within the section? | ||
| 57 | - Include the size of the reloc in the test for out of range addresses. | ||
| 58 | - PR 17512: file: c146ab8b, 46dff27f, 38e53ebf. */ | ||
| 59 | + | ||
| 60 | + /* Is the address of the relocation really within the section? */ | ||
| 61 | octets = reloc_entry->address * bfd_octets_per_byte (abfd); | ||
| 62 | - if (octets + bfd_get_reloc_size (howto) | ||
| 63 | - > bfd_get_section_limit_octets (abfd, input_section)) | ||
| 64 | + if (!reloc_offset_in_range (howto, abfd, input_section, octets)) | ||
| 65 | return bfd_reloc_outofrange; | ||
| 66 | |||
| 67 | /* Work out which section the relocation is targeted at and the | ||
| 68 | @@ -1012,8 +1025,7 @@ bfd_install_relocation (bfd *abfd, | ||
| 69 | |||
| 70 | /* Is the address of the relocation really within the section? */ | ||
| 71 | octets = reloc_entry->address * bfd_octets_per_byte (abfd); | ||
| 72 | - if (octets + bfd_get_reloc_size (howto) | ||
| 73 | - > bfd_get_section_limit_octets (abfd, input_section)) | ||
| 74 | + if (!reloc_offset_in_range (howto, abfd, input_section, octets)) | ||
| 75 | return bfd_reloc_outofrange; | ||
| 76 | |||
| 77 | /* Work out which section the relocation is targeted at and the | ||
| 78 | @@ -1351,8 +1363,7 @@ _bfd_final_link_relocate (reloc_howto_ty | ||
| 79 | bfd_size_type octets = address * bfd_octets_per_byte (input_bfd); | ||
| 80 | |||
| 81 | /* Sanity check the address. */ | ||
| 82 | - if (octets + bfd_get_reloc_size (howto) | ||
| 83 | - > bfd_get_section_limit_octets (input_bfd, input_section)) | ||
| 84 | + if (!reloc_offset_in_range (howto, input_bfd, input_section, octets)) | ||
| 85 | return bfd_reloc_outofrange; | ||
| 86 | |||
| 87 | /* This function assumes that we are dealing with a basic relocation | ||
| 88 | Index: git/bfd/ChangeLog | ||
| 89 | =================================================================== | ||
| 90 | --- git.orig/bfd/ChangeLog | ||
| 91 | +++ git/bfd/ChangeLog | ||
| 92 | @@ -1,3 +1,10 @@ | ||
| 93 | +2017-04-29 Alan Modra <amodra@gmail.com> | ||
| 94 | + | ||
| 95 | + PR 21432 | ||
| 96 | + * reloc.c (reloc_offset_in_range): New function. | ||
| 97 | + (bfd_perform_relocation, bfd_install_relocation): Use it. | ||
| 98 | + (_bfd_final_link_relocate): Likewise. | ||
| 99 | + | ||
| 100 | 2017-04-26 Nick Clifton <nickc@redhat.com> | ||
| 101 | |||
| 102 | PR binutils/21431 | ||
