summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/binutils/binutils/CVE-2017-9955_7.patch
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2017-11-26 16:36:33 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-11 22:02:59 +0000
commit7e2a26a041f96a2bb51c6711a716ef006ef54113 (patch)
treecf1aac9b1eef3fc9cb4963d2d65d0c571cbac239 /meta/recipes-devtools/binutils/binutils/CVE-2017-9955_7.patch
parentf52aa251972cff1acbaf20295a1ce09a33c21010 (diff)
downloadpoky-7e2a26a041f96a2bb51c6711a716ef006ef54113.tar.gz
binutls: Security fix for CVE-2017-9955
Affects: <= 2.28 [v2] Fixed signed-off-by for CVE-2017-9955_9 (From OE-Core rev: ccb2651cc736a6efd7e69a5afecd6aa975ee914c) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/binutils/binutils/CVE-2017-9955_7.patch')
-rw-r--r--meta/recipes-devtools/binutils/binutils/CVE-2017-9955_7.patch80
1 files changed, 80 insertions, 0 deletions
diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-9955_7.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-9955_7.patch
new file mode 100644
index 0000000000..2cae63b4fc
--- /dev/null
+++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-9955_7.patch
@@ -0,0 +1,80 @@
1From 60a02042bacf8d25814430080adda61ed086bca6 Mon Sep 17 00:00:00 2001
2From: Nick Clifton <nickc@redhat.com>
3Date: Fri, 30 Jun 2017 11:03:37 +0100
4Subject: [PATCH] Fix failures in MMIX linker tests introduced by fix for PR
5 21665.
6
7 PR binutils/21665
8 * objdump.c (disassemble_section): Move check for an overlarge
9 section to just before the allocation of memory. Do not check
10 section size against file size, but instead use an arbitrary 2Gb
11 limit. Issue a warning message if the section is too big.
12
13Upstream-Status: Backport
14CVE: CVE-2017-9955 #7
15Signed-off-by: Armin Kuster <akuster@mvista.com>
16
17---
18 binutils/ChangeLog | 8 ++++++++
19 binutils/objdump.c | 25 ++++++++++++++++++++++++-
20 2 files changed, 32 insertions(+), 1 deletion(-)
21
22Index: git/binutils/objdump.c
23===================================================================
24--- git.orig/binutils/objdump.c
25+++ git/binutils/objdump.c
26@@ -2048,7 +2048,7 @@ disassemble_section (bfd *abfd, asection
27 return;
28
29 datasize = bfd_get_section_size (section);
30- if (datasize == 0 || datasize >= (bfd_size_type) bfd_get_file_size (abfd))
31+ if (datasize == 0)
32 return;
33
34 if (start_address == (bfd_vma) -1
35@@ -2112,6 +2112,29 @@ disassemble_section (bfd *abfd, asection
36 }
37 rel_ppend = rel_pp + rel_count;
38
39+ /* PR 21665: Check for overlarge datasizes.
40+ Note - we used to check for "datasize > bfd_get_file_size (abfd)" but
41+ this fails when using compressed sections or compressed file formats
42+ (eg MMO, tekhex).
43+
44+ The call to xmalloc below will fail if too much memory is requested,
45+ which will catch the problem in the normal use case. But if a memory
46+ checker is in use, eg valgrind or sanitize, then an exception will
47+ be still generated, so we try to catch the problem first.
48+
49+ Unfortunately there is no simple way to determine how much memory can
50+ be allocated by calling xmalloc. So instead we use a simple, arbitrary
51+ limit of 2Gb. Hopefully this should be enough for most users. If
52+ someone does start trying to disassemble sections larger then 2Gb in
53+ size they will doubtless complain and we can increase the limit. */
54+#define MAX_XMALLOC (1024 * 1024 * 1024 * 2UL) /* 2Gb */
55+ if (datasize > MAX_XMALLOC)
56+ {
57+ non_fatal (_("Reading section %s failed because it is too big (%#lx)"),
58+ section->name, (unsigned long) datasize);
59+ return;
60+ }
61+
62 data = (bfd_byte *) xmalloc (datasize);
63
64 bfd_get_section_contents (abfd, section, data, 0, datasize);
65Index: git/binutils/ChangeLog
66===================================================================
67--- git.orig/binutils/ChangeLog
68+++ git/binutils/ChangeLog
69@@ -1,3 +1,11 @@
70+2017-06-30 Nick Clifton <nickc@redhat.com>
71+
72+ PR binutils/21665
73+ * objdump.c (disassemble_section): Move check for an overlarge
74+ section to just before the allocation of memory. Do not check
75+ section size against file size, but instead use an arbitrary 2Gb
76+ limit. Issue a warning message if the section is too big.
77+
78 2017-06-26 Nick Clifton <nickc@redhat.com>
79
80 PR binutils/21665