Skip to contentSkip to conversation

(e)glibc: add security patches for CVE-2014-6040

PATCH New Gustavo Zacarias 2 participants 3 messages Jan 8, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 (e)glibc: add security patches for CVE-2014-6040

Fixes CVE-2014-6040 - crash in code page decoding functions (IBM933, IBM935, IBM937, IBM939, IBM1364).

---
 .../glibc/2.18-svnr23787/0003-CVE-2014-6040.patch  | 141 +++++++++++++++++++++
 .../glibc/2.19-svnr25243/0002-CVE-2014-6040.patch  | 141 +++++++++++++++++++++
 package/glibc/2.19/0002-CVE-2014-6040.patch        | 141 +++++++++++++++++++++
 3 files changed, 423 insertions(+)
 create mode 100644 package/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch
 create mode 100644 package/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch
 create mode 100644 package/glibc/2.19/0002-CVE-2014-6040.patch
package/glibc/2.18-svnr23787/0003-CVE-2014-6040.patch new file +141 -0
new file mode 100644
index 0000000..f447dcd
@@ -0,0 +1,141 @@
+Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commit;h=41488498b6
+See https://bugzilla.redhat.com/show_bug.cgi?id=1135841
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm1364.c eglibc-2.19/libc/iconvdata/ibm1364.c
+--- eglibc-2.19.orig/libc/iconvdata/ibm1364.c	2015-01-08 16:05:53.918823240 -0300
++++ eglibc-2.19/libc/iconvdata/ibm1364.c	2015-01-08 16:06:02.781555143 -0300
+@@ -220,7 +220,8 @@
+ 	  ++rp2;							      \
+ 									      \
+ 	uint32_t res;							      \
+-	if (__builtin_expect (ch < rp2->start, 0)			      \
++	if (__builtin_expect (rp2->start == 0xffff, 0)			      \
++	    || __builtin_expect (ch < rp2->start, 0)			      \
+ 	    || (res = DB_TO_UCS4[ch + rp2->idx],			      \
+ 		__builtin_expect (res, L'\1') == L'\0' && ch != '\0'))	      \
+ 	  {								      \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm932.c eglibc-2.19/libc/iconvdata/ibm932.c
+--- eglibc-2.19.orig/libc/iconvdata/ibm932.c	2015-01-08 16:05:53.910818967 -0300
++++ eglibc-2.19/libc/iconvdata/ibm932.c	2015-01-08 16:06:02.781555143 -0300
+@@ -73,11 +73,12 @@
+ 	  }								      \
+ 									      \
+ 	ch = (ch * 0x100) + inptr[1];					      \
++	/* ch was less than 0xfd.  */					      \
++	assert (ch < 0xfd00);						      \
+ 	while (ch > rp2->end)						      \
+ 	  ++rp2;							      \
+ 									      \
+-	if (__builtin_expect (rp2 == NULL, 0)				      \
+-	    || __builtin_expect (ch < rp2->start, 0)			      \
++	if (__builtin_expect (ch < rp2->start, 0)			      \
+ 	    || (res = __ibm932db_to_ucs4[ch + rp2->idx],		      \
+ 	    __builtin_expect (res, '\1') == 0 && ch !=0))		      \
+ 	  {								      \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm933.c eglibc-2.19/libc/iconvdata/ibm933.c
+--- eglibc-2.19.orig/libc/iconvdata/ibm933.c	2015-01-08 16:05:53.917822706 -0300
++++ eglibc-2.19/libc/iconvdata/ibm933.c	2015-01-08 16:06:02.781555143 -0300
+@@ -161,7 +161,7 @@
+ 	while (ch > rp2->end)						      \
+ 	  ++rp2;							      \
+ 									      \
+-	if (__builtin_expect (rp2 == NULL, 0)				      \
++	if (__builtin_expect (rp2->start == 0xffff, 0)			      \
+ 	    || __builtin_expect (ch < rp2->start, 0)			      \
+ 	    || (res = __ibm933db_to_ucs4[ch + rp2->idx],		      \
+ 		__builtin_expect (res, L'\1') == L'\0' && ch != '\0'))	      \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm935.c eglibc-2.19/libc/iconvdata/ibm935.c
+--- eglibc-2.19.orig/libc/iconvdata/ibm935.c	2015-01-08 16:05:53.921824843 -0300
++++ eglibc-2.19/libc/iconvdata/ibm935.c	2015-01-08 16:06:02.782555677 -0300
+@@ -161,7 +161,7 @@
+ 	while (ch > rp2->end)						      \
+ 	  ++rp2;							      \
+ 									      \
+-	if (__builtin_expect (rp2 == NULL, 0)				      \
++	if (__builtin_expect (rp2->start == 0xffff, 0)			      \
+ 	    || __builtin_expect (ch < rp2->start, 0)			      \
+ 	    || (res = __ibm935db_to_ucs4[ch + rp2->idx],		      \
+ 		__builtin_expect (res, L'\1') == L'\0' && ch != '\0'))	      \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm937.c eglibc-2.19/libc/iconvdata/ibm937.c
+--- eglibc-2.19.orig/libc/iconvdata/ibm937.c	2015-01-08 16:05:53.915821638 -0300
++++ eglibc-2.19/libc/iconvdata/ibm937.c	2015-01-08 16:06:02.782555677 -0300
+@@ -161,7 +161,7 @@
+ 	while (ch > rp2->end)						      \
+ 	  ++rp2;							      \
+ 									      \
+-	if (__builtin_expect (rp2 == NULL, 0)				      \
++	if (__builtin_expect (rp2->start == 0xffff, 0)			      \
+ 	    || __builtin_expect (ch < rp2->start, 0)			      \
+ 	    || (res = __ibm937db_to_ucs4[ch + rp2->idx],		      \
+ 		__builtin_expect (res, L'\1') == L'\0' && ch != '\0'))	      \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm939.c eglibc-2.19/libc/iconvdata/ibm939.c
+--- eglibc-2.19.orig/libc/iconvdata/ibm939.c	2015-01-08 16:05:53.917822706 -0300
++++ eglibc-2.19/libc/iconvdata/ibm939.c	2015-01-08 16:06:02.782555677 -0300
+@@ -161,7 +161,7 @@
+ 	while (ch > rp2->end)						      \
+ 	  ++rp2;							      \
+ 									      \
+-	if (__builtin_expect (rp2 == NULL, 0)				      \
++	if (__builtin_expect (rp2->start == 0xffff, 0)			      \
+ 	    || __builtin_expect (ch < rp2->start, 0)			      \
+ 	    || (res = __ibm939db_to_ucs4[ch + rp2->idx],		      \
+ 		__builtin_expect (res, L'\1') == L'\0' && ch != '\0'))	      \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/ibm943.c eglibc-2.19/libc/iconvdata/ibm943.c
+--- eglibc-2.19.orig/libc/iconvdata/ibm943.c	2015-01-08 16:05:53.918823240 -0300
++++ eglibc-2.19/libc/iconvdata/ibm943.c	2015-01-08 16:06:02.782555677 -0300
+@@ -74,11 +74,12 @@
+ 	  }								      \
+ 									      \
+ 	ch = (ch * 0x100) + inptr[1];					      \
++	/* ch was less than 0xfd.  */					      \
++	assert (ch < 0xfd00);						      \
+ 	while (ch > rp2->end)						      \
+ 	  ++rp2;							      \
+ 									      \
+-	if (__builtin_expect (rp2 == NULL, 0)				      \
+-	    || __builtin_expect (ch < rp2->start, 0)			      \
++	if (__builtin_expect (ch < rp2->start, 0)			      \
+ 	    || (res = __ibm943db_to_ucs4[ch + rp2->idx],		      \
+ 	    __builtin_expect (res, '\1') == 0 && ch !=0))		      \
+ 	  {								      \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/Makefile eglibc-2.19/libc/iconvdata/Makefile
+--- eglibc-2.19.orig/libc/iconvdata/Makefile	2015-01-08 16:05:53.903815227 -0300
++++ eglibc-2.19/libc/iconvdata/Makefile	2015-01-08 16:06:02.782555677 -0300
+@@ -303,6 +303,7 @@
+ $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
+ 			 $(addprefix $(objpfx),$(modules.so)) \
+ 			 $(common-objdir)/iconv/iconv_prog TESTS
++	iconv_modules="$(modules)" \
+ 	$(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@
+ 
+ $(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
+diff -Nura eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh eglibc-2.19/libc/iconvdata/run-iconv-test.sh
+--- eglibc-2.19.orig/libc/iconvdata/run-iconv-test.sh	2015-01-08 16:05:53.894810420 -0300
++++ eglibc-2.19/libc/iconvdata/run-iconv-test.sh	2015-01-08 16:06:02.782555677 -0300
+@@ -188,6 +188,24 @@
+ 
+ done < TESTS2
+ 
++# Check for crashes in decoders.
++printf '\016\377\377\377\377\377\377\377' > $temp1
++for from in $iconv_modules ; do
++    echo $ac_n "test decoder $from $ac_c"
++    PROG=`eval echo $ICONV`
++    if $PROG < $temp1 >/dev/null 2>&1 ; then
++	: # fall through
++    else
++	status=$?
++	if test $status -gt 1 ; then
++	    echo "/FAILED"
++	    failed=1
++	    continue
++	fi
++    fi
++    echo "OK"
++done
++
+ exit $failed
+ # Local Variables:
+ #  mode:shell-script
package/glibc/2.19-svnr25243/0002-CVE-2014-6040.patch new file +141 -0

141 lines not on this page · raw message

package/glibc/2.19/0002-CVE-2014-6040.patch new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.0.5
#1 lore raw

PATCH 2/2 (e)glibc: add security patches for CVE-2014-9402

Fixes CVE-2014-9402 - denial of service in getnetbyname function.

---
 .../glibc/2.18-svnr23787/0004-CVE-2014-9402.patch  | 20 ++++++++++++++++++
 .../glibc/2.19-svnr25243/0003-CVE-2014-9402.patch  | 20 ++++++++++++++++++
 package/glibc/2.19/0003-CVE-2014-9402.patch        | 24 ++++++++++++++++++++++
 package/glibc/2.20/0002-CVE-2014-9402.patch        | 24 ++++++++++++++++++++++
 4 files changed, 88 insertions(+)
 create mode 100644 package/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch
 create mode 100644 package/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch
 create mode 100644 package/glibc/2.19/0003-CVE-2014-9402.patch
 create mode 100644 package/glibc/2.20/0002-CVE-2014-9402.patch
package/glibc/2.18-svnr23787/0004-CVE-2014-9402.patch new file +20 -0
new file mode 100644
index 0000000..c7aa12c
@@ -0,0 +1,20 @@
+Fix CVE-2014-9402 - denial of service in getnetbyname function.
+Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d
+See https://bugzilla.redhat.com/show_bug.cgi?id=1175369
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+diff -Nura eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c eglibc-2.19/libc/resolv/nss_dns/dns-network.c
+--- eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c	2015-01-08 16:12:35.024977879 -0300
++++ eglibc-2.19/libc/resolv/nss_dns/dns-network.c	2015-01-08 16:12:42.543992357 -0300
+@@ -398,8 +398,8 @@
+ 
+ 	case BYNAME:
+ 	  {
+-	    char **ap = result->n_aliases++;
+-	    while (*ap != NULL)
++	    char **ap;
++	    for (ap = result->n_aliases; *ap != NULL; ++ap)
+ 	      {
+ 		/* Check each alias name for being of the forms:
+ 		   4.3.2.1.in-addr.arpa		= net 1.2.3.4
package/glibc/2.19-svnr25243/0003-CVE-2014-9402.patch new file +20 -0
new file mode 100644
index 0000000..c7aa12c
@@ -0,0 +1,20 @@
+Fix CVE-2014-9402 - denial of service in getnetbyname function.
+Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d
+See https://bugzilla.redhat.com/show_bug.cgi?id=1175369
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+diff -Nura eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c eglibc-2.19/libc/resolv/nss_dns/dns-network.c
+--- eglibc-2.19.orig/libc/resolv/nss_dns/dns-network.c	2015-01-08 16:12:35.024977879 -0300
++++ eglibc-2.19/libc/resolv/nss_dns/dns-network.c	2015-01-08 16:12:42.543992357 -0300
+@@ -398,8 +398,8 @@
+ 
+ 	case BYNAME:
+ 	  {
+-	    char **ap = result->n_aliases++;
+-	    while (*ap != NULL)
++	    char **ap;
++	    for (ap = result->n_aliases; *ap != NULL; ++ap)
+ 	      {
+ 		/* Check each alias name for being of the forms:
+ 		   4.3.2.1.in-addr.arpa		= net 1.2.3.4
package/glibc/2.19/0003-CVE-2014-9402.patch new file +24 -0
new file mode 100644
index 0000000..d6d753e
@@ -0,0 +1,24 @@
+Fix CVE-2014-9402 - denial of service in getnetbyname function.
+Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d
+See https://bugzilla.redhat.com/show_bug.cgi?id=1175369
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
+index 0a77c8b..08cf0a6 100644
+--- a/resolv/nss_dns/dns-network.c
++++ b/resolv/nss_dns/dns-network.c
+@@ -398,8 +398,8 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
+ 
+ 	case BYNAME:
+ 	  {
+-	    char **ap = result->n_aliases++;
+-	    while (*ap != NULL)
++	    char **ap;
++	    for (ap = result->n_aliases; *ap != NULL; ++ap)
+ 	      {
+ 		/* Check each alias name for being of the forms:
+ 		   4.3.2.1.in-addr.arpa		= net 1.2.3.4
+-- 
+1.7.1
+
package/glibc/2.20/0002-CVE-2014-9402.patch new file +24 -0
new file mode 100644
index 0000000..d6d753e
@@ -0,0 +1,24 @@
+Fix CVE-2014-9402 - denial of service in getnetbyname function.
+Backport from https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=11e3417af6e354f1942c68a271ae51e892b2814d
+See https://bugzilla.redhat.com/show_bug.cgi?id=1175369
+
+Signed-off-by: Gustavo Zacarias <[email protected]>
+
+diff --git a/resolv/nss_dns/dns-network.c b/resolv/nss_dns/dns-network.c
+index 0a77c8b..08cf0a6 100644
+--- a/resolv/nss_dns/dns-network.c
++++ b/resolv/nss_dns/dns-network.c
+@@ -398,8 +398,8 @@ getanswer_r (const querybuf *answer, int anslen, struct netent *result,
+ 
+ 	case BYNAME:
+ 	  {
+-	    char **ap = result->n_aliases++;
+-	    while (*ap != NULL)
++	    char **ap;
++	    for (ap = result->n_aliases; *ap != NULL; ++ap)
+ 	      {
+ 		/* Check each alias name for being of the forms:
+ 		   4.3.2.1.in-addr.arpa		= net 1.2.3.4
+-- 
+1.7.1
+
Signature · 1 line
2.0.5
#2 lore raw

PATCH 1/2 (e)glibc: add security patches for CVE-2014-6040

In reply to Gustavo Zacarias

Dear Gustavo Zacarias,

Quoted 4 lines · Gustavo Zacarias

Fixes CVE-2014-6040 - crash in code page decoding functions (IBM933, IBM935, IBM937, IBM939, IBM1364).

Both applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com