From 776302af499938bf5d058d0d0957209f09c60900 Mon Sep 17 00:00:00 2001 From: Thiruvadi Rajaraman Date: Thu, 21 Sep 2017 19:09:43 +0530 Subject: binutils: CVE-2017-9746 Source: binutils-gdb.git MR: 74049 Type: Security Fix Disposition: Backport from binutils-2_29 ChangeID: 8dad195531894850a242ccf70990a963cf16f291 Description: Fix address violation when disassembling a corrupt binary. PR binutils/21580 binutils * objdump.c (disassemble_bytes): Check for buffer overrun when printing out rae insns. ld * testsuite/ld-nds32/diff.d: Adjust expected output. Affects: <= 2.28 Author: Nick Clifton (From OE-Core rev: 2a13567ea790d71a36eab0293f5a1918ef447e13) Signed-off-by: Thiruvadi Rajaraman Reviewed-by: Armin Kuster Signed-off-by: Armin Kuster Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-devtools/binutils/binutils-2.27.inc | 1 + .../binutils/binutils/CVE-2017-9746.patch | 88 ++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 meta/recipes-devtools/binutils/binutils/CVE-2017-9746.patch (limited to 'meta/recipes-devtools') diff --git a/meta/recipes-devtools/binutils/binutils-2.27.inc b/meta/recipes-devtools/binutils/binutils-2.27.inc index 5e1e0be393..8d2c9d7031 100644 --- a/meta/recipes-devtools/binutils/binutils-2.27.inc +++ b/meta/recipes-devtools/binutils/binutils-2.27.inc @@ -80,6 +80,7 @@ SRC_URI = "\ file://CVE-2017-7299_2.patch \ file://CVE-2017-9751.patch \ file://CVE-2017-9749.patch \ + file://CVE-2017-9746.patch \ " S = "${WORKDIR}/git" diff --git a/meta/recipes-devtools/binutils/binutils/CVE-2017-9746.patch b/meta/recipes-devtools/binutils/binutils/CVE-2017-9746.patch new file mode 100644 index 0000000000..e9efb7b89a --- /dev/null +++ b/meta/recipes-devtools/binutils/binutils/CVE-2017-9746.patch @@ -0,0 +1,88 @@ +commit ae87f7e73eba29bd38b3a9684a10b948ed715612 +Author: Nick Clifton +Date: Wed Jun 14 16:50:03 2017 +0100 + + Fix address violation when disassembling a corrupt binary. + + PR binutils/21580 + binutils * objdump.c (disassemble_bytes): Check for buffer overrun when + printing out rae insns. + + ld * testsuite/ld-nds32/diff.d: Adjust expected output. + +Upstream-Status: Backport + +CVE: CVE-2017-9746 +Signed-off-by: Thiruvadi Rajaraman + + +Index: git/binutils/objdump.c +=================================================================== +--- git.orig/binutils/objdump.c 2017-09-21 13:54:00.187228032 +0530 ++++ git/binutils/objdump.c 2017-09-21 13:54:00.659231783 +0530 +@@ -1780,20 +1780,23 @@ + + for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc) + { +- int k; +- +- if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE) +- { +- for (k = bpc - 1; k >= 0; k--) +- printf ("%02x", (unsigned) data[j + k]); +- putchar (' '); +- } +- else ++ /* PR 21580: Check for a buffer ending early. */ ++ if (j + bpc <= stop_offset * opb) + { +- for (k = 0; k < bpc; k++) +- printf ("%02x", (unsigned) data[j + k]); +- putchar (' '); ++ int k; ++ ++ if (inf->display_endian == BFD_ENDIAN_LITTLE) ++ { ++ for (k = bpc - 1; k >= 0; k--) ++ printf ("%02x", (unsigned) data[j + k]); ++ } ++ else ++ { ++ for (k = 0; k < bpc; k++) ++ printf ("%02x", (unsigned) data[j + k]); ++ } + } ++ putchar (' '); + } + + for (; pb < octets_per_line; pb += bpc) +Index: git/ld/testsuite/ld-nds32/diff.d +=================================================================== +--- git.orig/ld/testsuite/ld-nds32/diff.d 2017-09-21 13:53:52.395166097 +0530 ++++ git/ld/testsuite/ld-nds32/diff.d 2017-09-21 13:54:00.659231783 +0530 +@@ -7,9 +7,9 @@ + + Disassembly of section .data: + 00008000 (7e 00 00 00|00 00 00 7e).* +-00008004 (7e 00 7e fe|00 7e 7e fe).* +-00008006 7e fe 00 fe.* +-00008007 fe 00.* ++00008004 (7e 00|00 7e).* ++00008006 7e.* ++00008007 fe.* + ... + 00008009 fe 00.* + .* +Index: git/ld/ChangeLog +=================================================================== +--- git.orig/ld/ChangeLog 2017-09-21 13:53:59.611223454 +0530 ++++ git/ld/ChangeLog 2017-09-21 14:01:12.294643335 +0530 +@@ -1,3 +1,8 @@ ++2017-06-14 Nick Clifton ++ ++ PR binutils/21580 ++ * testsuite/ld-nds32/diff.d: Adjust expected output. ++ + 2016-12-05 Nick Clifton + + PR ld/20906 -- cgit v1.2.3-54-g00ecf