diff options
Diffstat (limited to 'meta/recipes-devtools/binutils')
-rw-r--r-- | meta/recipes-devtools/binutils/binutils-2.27.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/binutils/binutils/CVE-2017-8396.patch | 102 |
2 files changed, 103 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc index 23aac6bd5e..014655f7df 100644 --- a/meta/recipes-devtools/binutils/binutils-2.27.inc +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc | |||
@@ -71,6 +71,7 @@ SRC_URI = "\ | |||
71 | file://CVE-2017-8395.patch \ | 71 | file://CVE-2017-8395.patch \ |
72 | file://CVE-2017-8397.patch \ | 72 | file://CVE-2017-8397.patch \ |
73 | file://CVE-2017-7300.patch \ | 73 | file://CVE-2017-7300.patch \ |
74 | file://CVE-2017-8396.patch \ | ||
74 | " | 75 | " |
75 | S = "${WORKDIR}/git" | 76 | S = "${WORKDIR}/git" |
76 | 77 | ||
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-8396.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-8396.patch new file mode 100644 index 0000000000..b1bf92f4dd --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-8396.patch | |||
@@ -0,0 +1,102 @@ | |||
1 | commit a941291cab71b9ac356e1c03968c177c03e602ab | ||
2 | Author: Alan Modra <amodra@gmail.com> | ||
3 | Date: Sat Apr 29 14:48:16 2017 +0930 | ||
4 | |||
5 | PR21432, buffer overflow in perform_relocation | ||
6 | |||
7 | The existing reloc offset range tests didn't catch small negative | ||
8 | offsets less than the size of the reloc field. | ||
9 | |||
10 | PR 21432 | ||
11 | * reloc.c (reloc_offset_in_range): New function. | ||
12 | (bfd_perform_relocation, bfd_install_relocation): Use it. | ||
13 | (_bfd_final_link_relocate): Likewise. | ||
14 | |||
15 | Upstream-Status: Backport | ||
16 | |||
17 | CVE: CVE-2017-8396 | ||
18 | Signed-off-by: Thiruvadi Rajaraman <trajaraman@mvista.com> | ||
19 | |||
20 | Index: git/bfd/reloc.c | ||
21 | =================================================================== | ||
22 | --- git.orig/bfd/reloc.c 2017-09-05 18:12:07.448886623 +0530 | ||
23 | +++ git/bfd/reloc.c 2017-09-05 18:12:07.564887511 +0530 | ||
24 | @@ -538,6 +538,22 @@ | ||
25 | return flag; | ||
26 | } | ||
27 | |||
28 | +/* HOWTO describes a relocation, at offset OCTET. Return whether the | ||
29 | + relocation field is within SECTION of ABFD. */ | ||
30 | + | ||
31 | +static bfd_boolean | ||
32 | +reloc_offset_in_range (reloc_howto_type *howto, bfd *abfd, | ||
33 | + asection *section, bfd_size_type octet) | ||
34 | +{ | ||
35 | + bfd_size_type octet_end = bfd_get_section_limit_octets (abfd, section); | ||
36 | + bfd_size_type reloc_size = bfd_get_reloc_size (howto); | ||
37 | + | ||
38 | + /* The reloc field must be contained entirely within the section. | ||
39 | + Allow zero length fields (marker relocs or NONE relocs where no | ||
40 | + relocation will be performed) at the end of the section. */ | ||
41 | + return octet <= octet_end && octet + reloc_size <= octet_end; | ||
42 | +} | ||
43 | + | ||
44 | /* | ||
45 | FUNCTION | ||
46 | bfd_perform_relocation | ||
47 | @@ -618,15 +634,9 @@ | ||
48 | return cont; | ||
49 | } | ||
50 | |||
51 | - /* Is the address of the relocation really within the section? | ||
52 | - Include the size of the reloc in the test for out of range addresses. | ||
53 | - PR 17512: file: c146ab8b, 46dff27f, 38e53ebf. */ | ||
54 | + /* Is the address of the relocation really within the section? */ | ||
55 | octets = reloc_entry->address * bfd_octets_per_byte (abfd); | ||
56 | - if (octets + bfd_get_reloc_size (howto) | ||
57 | - > bfd_get_section_limit_octets (abfd, input_section) | ||
58 | - /* Check for an overly large offset which | ||
59 | - masquerades as a negative value too. */ | ||
60 | - || (octets + bfd_get_reloc_size (howto) < bfd_get_reloc_size (howto))) | ||
61 | + if (!reloc_offset_in_range (howto, abfd, input_section, octets)) | ||
62 | return bfd_reloc_outofrange; | ||
63 | |||
64 | /* Work out which section the relocation is targeted at and the | ||
65 | @@ -1010,8 +1020,7 @@ | ||
66 | |||
67 | /* Is the address of the relocation really within the section? */ | ||
68 | octets = reloc_entry->address * bfd_octets_per_byte (abfd); | ||
69 | - if (octets + bfd_get_reloc_size (howto) | ||
70 | - > bfd_get_section_limit_octets (abfd, input_section)) | ||
71 | + if (!reloc_offset_in_range (howto, abfd, input_section, octets)) | ||
72 | return bfd_reloc_outofrange; | ||
73 | |||
74 | /* Work out which section the relocation is targeted at and the | ||
75 | @@ -1349,8 +1358,7 @@ | ||
76 | bfd_size_type octets = address * bfd_octets_per_byte (input_bfd); | ||
77 | |||
78 | /* Sanity check the address. */ | ||
79 | - if (octets + bfd_get_reloc_size (howto) | ||
80 | - > bfd_get_section_limit_octets (input_bfd, input_section)) | ||
81 | + if (!reloc_offset_in_range (howto, input_bfd, input_section, octets)) | ||
82 | return bfd_reloc_outofrange; | ||
83 | |||
84 | /* This function assumes that we are dealing with a basic relocation | ||
85 | Index: git/bfd/ChangeLog | ||
86 | =================================================================== | ||
87 | --- git.orig/bfd/ChangeLog 2017-09-05 18:12:07.448886623 +0530 | ||
88 | +++ git/bfd/ChangeLog 2017-09-05 18:13:46.745645897 +0530 | ||
89 | @@ -73,6 +73,13 @@ | ||
90 | (evax_bfd_print_egsd): Check for an overlarge record length. | ||
91 | (evax_bfd_print_etir): Likewise. | ||
92 | |||
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/21434 | ||