From 2d5168f40a40a16c331909945969a6baaf715b9c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Jun 02 2016 10:47:32 +0000 Subject: Resolves: #1337140 CVE-2016-4429: stack overflow in Sun RPC clntudp_call --- diff --git a/glibc-rh1337140.patch b/glibc-rh1337140.patch new file mode 100644 index 0000000..9fa08c8 --- /dev/null +++ b/glibc-rh1337140.patch @@ -0,0 +1,48 @@ +commit bc779a1a5b3035133024b21e2f339fe4219fb11c +Author: Florian Weimer +Date: Mon May 23 20:18:34 2016 +0200 + + CVE-2016-4429: sunrpc: Do not use alloca in clntudp_call [BZ #20112] + + The call is technically in a loop, and under certain circumstances + (which are quite difficult to reproduce in a test case), alloca + can be invoked repeatedly during a single call to clntudp_call. + As a result, the available stack space can be exhausted (even + though individual alloca sizes are bounded implicitly by what + can fit into a UDP packet, as a side effect of the earlier + successful send operation). + +Index: b/sunrpc/clnt_udp.c +=================================================================== +--- a/sunrpc/clnt_udp.c ++++ b/sunrpc/clnt_udp.c +@@ -420,9 +420,15 @@ send_again: + struct sock_extended_err *e; + struct sockaddr_in err_addr; + struct iovec iov; +- char *cbuf = (char *) alloca (outlen + 256); ++ char *cbuf = malloc (outlen + 256); + int ret; + ++ if (cbuf == NULL) ++ { ++ cu->cu_error.re_errno = errno; ++ return (cu->cu_error.re_status = RPC_CANTRECV); ++ } ++ + iov.iov_base = cbuf + 256; + iov.iov_len = outlen; + msg.msg_name = (void *) &err_addr; +@@ -447,10 +453,12 @@ send_again: + cmsg = CMSG_NXTHDR (&msg, cmsg)) + if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR) + { ++ free (cbuf); + e = (struct sock_extended_err *) CMSG_DATA(cmsg); + cu->cu_error.re_errno = e->ee_errno; + return (cu->cu_error.re_status = RPC_CANTRECV); + } ++ free (cbuf); + } + #endif + do diff --git a/glibc.spec b/glibc.spec index 9872acf..1e9a31c 100644 --- a/glibc.spec +++ b/glibc.spec @@ -1,6 +1,6 @@ %define glibcsrcdir glibc-2.22 %define glibcversion 2.22 -%define glibcrelease 16%{?dist} +%define glibcrelease 17%{?dist} # Pre-release tarballs are pulled in from git using a command that is # effectively: # @@ -267,6 +267,7 @@ Patch1046: glibc-rh1288740.patch Patch1047: glibc-rh1330888.patch Patch1048: glibc-rh1204521.patch Patch1049: glibc-rh1282011.patch +Patch1050: glibc-rh1337140.patch ############################################################################## # @@ -733,6 +734,7 @@ microbenchmark tests on the system. %patch1047 -p1 %patch1048 -p1 %patch1049 -p1 +%patch1050 -p1 %patch0059 -p1 ############################################################################## @@ -1953,6 +1955,9 @@ rm -f *.filelist* %endif %changelog +* Thu Jun 2 2016 Florian Weimer - 2.22-17 +- CVE-2016-4429: stack overflow in Sun RPC clntudp_call (#1337140) + * Wed May 11 2016 Florian Weimer - 2.22-16 - Back out dlsym (RTLD_NEXT)/dlerror change (#1333945) because it reveals an ASAN bug (#1335011)