Change-Id: I60c5064278480925ec1793a8af5769e8d7950957
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2294
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,80 @@ |
| 0 |
+From 7e27a9d5f22f9f7ead11738b1546d0b5c737266b Mon Sep 17 00:00:00 2001 |
|
| 1 |
+From: "Yuriy M. Kaminskiy" <yumkam@gmail.com> |
|
| 2 |
+Date: Tue, 4 Aug 2015 16:51:53 +0100 |
|
| 3 |
+Subject: [PATCH 1/1] Fix stack buffer overflows when parsing corrupt ihex |
|
| 4 |
+ files. |
|
| 5 |
+ |
|
| 6 |
+ PR binutils/18750 |
|
| 7 |
+ * ihex.c (ihex_scan): Fixes incorrect escape sequence in error message |
|
| 8 |
+ and stack overflow when char is signed and \200-\376 was in place of hex |
|
| 9 |
+ digit; also fixes \377 was handled as EOF instead of "incorrect character". |
|
| 10 |
+ (ihex_read_section): Changed for consistency. |
|
| 11 |
+ (ihex_bad_byte): Prevent (now impossible to trigger) stack |
|
| 12 |
+ overflow and incorrect escape sequence handling. |
|
| 13 |
+ * srec.c (srec_bad_byte): Likewise. |
|
| 14 |
+ |
|
| 15 |
+ * readelf.c (process_mips_specific): Fix incorrect escape |
|
| 16 |
+ sequence handling. |
|
| 17 |
+--- |
|
| 18 |
+ bfd/ihex.c | 6 +++--- |
|
| 19 |
+ bfd/srec.c | 2 +- |
|
| 20 |
+ binutils/readelf.c | 2 +- |
|
| 21 |
+ 5 files changed, 28 insertions(+), 5 deletions(-) |
|
| 22 |
+ |
|
| 23 |
+diff --git a/bfd/ihex.c b/bfd/ihex.c |
|
| 24 |
+index 8e66372..38112f6 100644 |
|
| 25 |
+--- a/bfd/ihex.c |
|
| 26 |
+@@ -219,7 +219,7 @@ ihex_bad_byte (bfd *abfd, unsigned int lineno, int c, bfd_boolean error) |
|
| 27 |
+ char buf[10]; |
|
| 28 |
+ |
|
| 29 |
+ if (! ISPRINT (c)) |
|
| 30 |
+- sprintf (buf, "\\%03o", (unsigned int) c); |
|
| 31 |
++ sprintf (buf, "\\%03o", (unsigned int) c & 0xff); |
|
| 32 |
+ else |
|
| 33 |
+ {
|
|
| 34 |
+ buf[0] = c; |
|
| 35 |
+@@ -276,7 +276,7 @@ ihex_scan (bfd *abfd) |
|
| 36 |
+ else |
|
| 37 |
+ {
|
|
| 38 |
+ file_ptr pos; |
|
| 39 |
+- char hdr[8]; |
|
| 40 |
++ unsigned char hdr[8]; |
|
| 41 |
+ unsigned int i; |
|
| 42 |
+ unsigned int len; |
|
| 43 |
+ bfd_vma addr; |
|
| 44 |
+@@ -553,7 +553,7 @@ ihex_read_section (bfd *abfd, asection *section, bfd_byte *contents) |
|
| 45 |
+ error = FALSE; |
|
| 46 |
+ while ((c = ihex_get_byte (abfd, &error)) != EOF) |
|
| 47 |
+ {
|
|
| 48 |
+- char hdr[8]; |
|
| 49 |
++ unsigned char hdr[8]; |
|
| 50 |
+ unsigned int len; |
|
| 51 |
+ unsigned int type; |
|
| 52 |
+ unsigned int i; |
|
| 53 |
+diff --git a/bfd/srec.c b/bfd/srec.c |
|
| 54 |
+index 24573cf..96b6a2f 100644 |
|
| 55 |
+--- a/bfd/srec.c |
|
| 56 |
+@@ -249,7 +249,7 @@ srec_bad_byte (bfd *abfd, |
|
| 57 |
+ char buf[40]; |
|
| 58 |
+ |
|
| 59 |
+ if (! ISPRINT (c)) |
|
| 60 |
+- sprintf (buf, "\\%03o", (unsigned int) c); |
|
| 61 |
++ sprintf (buf, "\\%03o", (unsigned int) c & 0xff); |
|
| 62 |
+ else |
|
| 63 |
+ {
|
|
| 64 |
+ buf[0] = c; |
|
| 65 |
+diff --git a/binutils/readelf.c b/binutils/readelf.c |
|
| 66 |
+index a9b9f2d..6298f1e 100644 |
|
| 67 |
+--- a/binutils/readelf.c |
|
| 68 |
+@@ -14467,7 +14467,7 @@ process_mips_specific (FILE * file) |
|
| 69 |
+ len = sizeof (* eopt); |
|
| 70 |
+ while (len < option->size) |
|
| 71 |
+ {
|
|
| 72 |
+- char datum = * ((char *) eopt + offset + len); |
|
| 73 |
++ unsigned char datum = * ((unsigned char *) eopt + offset + len); |
|
| 74 |
+ |
|
| 75 |
+ if (ISPRINT (datum)) |
|
| 76 |
+ printf ("%c", datum);
|
| ... | ... |
@@ -1,36 +1,38 @@ |
| 1 |
-Summary: Contains a linker, an assembler, and other tools |
|
| 2 |
-Name: binutils |
|
| 3 |
-Version: 2.25.1 |
|
| 4 |
-Release: 2%{?dist}
|
|
| 5 |
-License: GPLv2+ |
|
| 6 |
-URL: http://www.gnu.org/software/binutils |
|
| 7 |
-Group: System Environment/Base |
|
| 8 |
-Vendor: VMware, Inc. |
|
| 9 |
-Distribution: Photon |
|
| 10 |
-Source0: http://ftp.gnu.org/gnu/binutils/%{name}-%{version}.tar.bz2
|
|
| 1 |
+Summary: Contains a linker, an assembler, and other tools |
|
| 2 |
+Name: binutils |
|
| 3 |
+Version: 2.25.1 |
|
| 4 |
+Release: 3%{?dist}
|
|
| 5 |
+License: GPLv2+ |
|
| 6 |
+URL: http://www.gnu.org/software/binutils |
|
| 7 |
+Group: System Environment/Base |
|
| 8 |
+Vendor: VMware, Inc. |
|
| 9 |
+Distribution: Photon |
|
| 10 |
+Source0: http://ftp.gnu.org/gnu/binutils/%{name}-%{version}.tar.bz2
|
|
| 11 | 11 |
%define sha1 binutils=1d597ae063e3947a5f61e23ceda8aebf78405fcd |
| 12 |
-Patch0: http://www.linuxfromscratch.org/patches/downloads/binutils/binutils-2.25.1-gold_export_symbols-1.patch |
|
| 12 |
+Patch0: http://www.linuxfromscratch.org/patches/downloads/binutils/binutils-2.25.1-gold_export_symbols-1.patch |
|
| 13 |
+Patch1: binutils-CVE-2014-9939.patch |
|
| 13 | 14 |
%description |
| 14 | 15 |
The Binutils package contains a linker, an assembler, |
| 15 | 16 |
and other tools for handling object files. |
| 16 |
-%package devel |
|
| 17 |
-Summary: Header and development files for binutils |
|
| 18 |
-Requires: %{name} = %{version}
|
|
| 19 |
-%description devel |
|
| 17 |
+%package devel |
|
| 18 |
+Summary: Header and development files for binutils |
|
| 19 |
+Requires: %{name} = %{version}
|
|
| 20 |
+%description devel |
|
| 20 | 21 |
It contains the libraries and header files to create applications |
| 21 | 22 |
for handling compiled objects. |
| 22 | 23 |
%prep |
| 23 | 24 |
%setup -q |
| 24 | 25 |
%patch0 -p1 |
| 26 |
+%patch1 -p1 |
|
| 25 | 27 |
rm -fv etc/standards.info |
| 26 | 28 |
sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in |
| 27 | 29 |
%build |
| 28 | 30 |
install -vdm 755 ../binutils-build |
| 29 | 31 |
cd ../binutils-build |
| 30 | 32 |
../%{name}-%{version}/configure \
|
| 31 |
- --prefix=%{_prefix} \
|
|
| 32 |
- --enable-shared \ |
|
| 33 |
- --disable-silent-rules |
|
| 33 |
+ --prefix=%{_prefix} \
|
|
| 34 |
+ --enable-shared \ |
|
| 35 |
+ --disable-silent-rules |
|
| 34 | 36 |
make %{?_smp_mflags} tooldir=%{_prefix}
|
| 35 | 37 |
%install |
| 36 | 38 |
pushd ../binutils-build |
| ... | ... |
@@ -43,8 +45,8 @@ popd |
| 43 | 43 |
%check |
| 44 | 44 |
cd ../binutils-build |
| 45 | 45 |
make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
|
| 46 |
-%post -p /sbin/ldconfig |
|
| 47 |
-%postun -p /sbin/ldconfig |
|
| 46 |
+%post -p /sbin/ldconfig |
|
| 47 |
+%postun -p /sbin/ldconfig |
|
| 48 | 48 |
%files -f %{name}.lang
|
| 49 | 49 |
%defattr(-,root,root) |
| 50 | 50 |
%{_bindir}/gprof
|
| ... | ... |
@@ -168,13 +170,15 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
|
| 168 | 168 |
%{_libdir}/libopcodes.so
|
| 169 | 169 |
|
| 170 | 170 |
%changelog |
| 171 |
-* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.25.1-2 |
|
| 172 |
-- GA - Bump release of all rpms |
|
| 171 |
+* Tue Apr 04 2017 Anish Swaminathan <anishs@vmware.com> 2.25.1-3 |
|
| 172 |
+- Apply patch for CVE-2014-9939 |
|
| 173 |
+* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.25.1-2 |
|
| 174 |
+- GA - Bump release of all rpms |
|
| 173 | 175 |
* Tue Jan 12 2016 Xiaolin Li <xiaolinl@vmware.com> 2.25.1-1 |
| 174 | 176 |
- Updated to version 2.25.1 |
| 175 |
-* Tue Nov 10 2015 Xiaolin Li <xiaolinl@vmware.com> 2.25-2 |
|
| 176 |
-- Handled locale files with macro find_lang |
|
| 177 |
-* Mon Apr 6 2015 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.25-1 |
|
| 178 |
-- Updated to 2.25 |
|
| 179 |
-* Wed Nov 5 2014 Divya Thaluru <dthaluru@vmware.com> 2.24-1 |
|
| 180 |
-- Initial build. First version |
|
| 177 |
+* Tue Nov 10 2015 Xiaolin Li <xiaolinl@vmware.com> 2.25-2 |
|
| 178 |
+- Handled locale files with macro find_lang |
|
| 179 |
+* Mon Apr 6 2015 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 2.25-1 |
|
| 180 |
+- Updated to 2.25 |
|
| 181 |
+* Wed Nov 5 2014 Divya Thaluru <dthaluru@vmware.com> 2.24-1 |
|
| 182 |
+- Initial build. First version |