From f68da24d2adfc1cc025cd5de69c047847831f65f Mon Sep 17 00:00:00 2001 From: David Michael Date: Mon, 8 May 2017 18:07:14 -0700 Subject: [PATCH] net-libs/libtirpc: sync with the latest Gentoo version --- .../coreos-overlay/net-libs/libtirpc/Manifest | 2 +- .../files/libtirpc-0.2.5-stdarg.patch | 29 -- .../files/libtirpc-1.0.1-CVE-2017-8779.patch | 255 ++++++++++++++++++ ...2.5-r1.ebuild => libtirpc-1.0.1-r1.ebuild} | 34 +-- .../net-libs/libtirpc/metadata.xml | 5 +- 5 files changed, 273 insertions(+), 52 deletions(-) delete mode 100644 sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-0.2.5-stdarg.patch create mode 100644 sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-1.0.1-CVE-2017-8779.patch rename sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/{libtirpc-0.2.5-r1.ebuild => libtirpc-1.0.1-r1.ebuild} (57%) diff --git a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/Manifest b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/Manifest index 7881ebc2d2..3dfc0a5f55 100644 --- a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/Manifest @@ -1,2 +1,2 @@ -DIST libtirpc-0.2.5.tar.bz2 459094 SHA256 62f9de7c2c8686c568757730e1fef66502a0e00d6cacf33546d0267984e002db SHA512 9f8afa1acb04a2c2c558018f2528f8caaa79994a2af2abeed947f914145872ef72988b241e11925c799db0de9ec51fd9baecd2b08150240b22f91e2e55a45194 WHIRLPOOL a2b4f1c4825f2b774c2290cccd9d552bb7566ec9eb5988d3ab619d7870a907600f67e7af39fbc3e245606db8534f114c990145789c383206d3a9cf96cf043d8c +DIST libtirpc-1.0.1.tar.bz2 495125 SHA256 5156974f31be7ccbc8ab1de37c4739af6d9d42c87b1d5caf4835dda75fcbb89e SHA512 c9b449e737bc2bd3d56e31e8352f312e89a7ec2a11b73b5ac314e7d82d3b644c611e422b623912453b67b668f86a6de7bb7f18c9495dd15de8e2798ec2ff41c8 WHIRLPOOL cce6a4e69bd634b40d66594a81c23d2044b63eec16d6c96d6fcfaa7f2ca41fb9af99c8e2b964ec12be82682afa4090b218d7e14399fdfc9b32df6c2234bc3c9e DIST libtirpc-glibc-nfs.tar.xz 8948 SHA256 2677cfedf626f3f5a8f6e507aed5bb8f79a7453b589d684dbbc086e755170d83 SHA512 90255bf0a27af16164e0710dd940778609925d473f4343093ff19d98cc4f23023788bf4edf0178eae1961afc0ba8b69b273de95b7d7e2afdb706701d8ba6f7ba WHIRLPOOL 06bcf3fd4e424a86071e5c4ddeb89aa571c862e765aae9382d9f9a55ab72cd1c623490555c1a9bd3380a2d04ecb10fb47a75a7dddf449d4368a1a01617226858 diff --git a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-0.2.5-stdarg.patch b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-0.2.5-stdarg.patch deleted file mode 100644 index 8006de39e4..0000000000 --- a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-0.2.5-stdarg.patch +++ /dev/null @@ -1,29 +0,0 @@ -From d26607bade0893fe8652e1a0983f9fae59c64649 Mon Sep 17 00:00:00 2001 -From: Mike Frysinger -Date: Tue, 12 Aug 2014 03:11:41 -0400 -Subject: [PATCH libtirpc] include stdarg.h when used - -The debug.h header uses va_list but doesn't include stdarg.h which -can lead to random build failures. - -Signed-off-by: Mike Frysinger ---- - src/debug.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/debug.h b/src/debug.h -index afc8d57..c971ac3 100644 ---- a/src/debug.h -+++ b/src/debug.h -@@ -21,6 +21,8 @@ - - #ifndef _DEBUG_H - #define _DEBUG_H -+ -+#include - #include - - extern int libtirpc_debug_level; --- -2.0.0 - diff --git a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-1.0.1-CVE-2017-8779.patch b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-1.0.1-CVE-2017-8779.patch new file mode 100644 index 0000000000..91a50fad64 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/files/libtirpc-1.0.1-CVE-2017-8779.patch @@ -0,0 +1,255 @@ +diff --git a/src/rpc_generic.c b/src/rpc_generic.c +index 2f09a8f..589cbd5 100644 +--- a/src/rpc_generic.c ++++ b/src/rpc_generic.c +@@ -615,6 +615,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf) + + switch (af) { + case AF_INET: ++ if (nbuf->len < sizeof(*sin)) { ++ return NULL; ++ } + sin = nbuf->buf; + if (inet_ntop(af, &sin->sin_addr, namebuf, sizeof namebuf) + == NULL) +@@ -626,6 +629,9 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf) + break; + #ifdef INET6 + case AF_INET6: ++ if (nbuf->len < sizeof(*sin6)) { ++ return NULL; ++ } + sin6 = nbuf->buf; + if (inet_ntop(af, &sin6->sin6_addr, namebuf6, sizeof namebuf6) + == NULL) +@@ -667,6 +673,8 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr) + + port = 0; + sin = NULL; ++ if (uaddr == NULL) ++ return NULL; + addrstr = strdup(uaddr); + if (addrstr == NULL) + return NULL; +diff --git a/src/rpcb_prot.c b/src/rpcb_prot.c +index 43fd385..a923c8e 100644 +--- a/src/rpcb_prot.c ++++ b/src/rpcb_prot.c +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include "rpc_com.h" + + bool_t + xdr_rpcb(xdrs, objp) +@@ -53,13 +54,13 @@ xdr_rpcb(xdrs, objp) + if (!xdr_u_int32_t(xdrs, &objp->r_vers)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->r_netid, RPC_MAXDATASIZE)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->r_addr, RPC_MAXDATASIZE)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->r_owner, RPC_MAXDATASIZE)) { + return (FALSE); + } + return (TRUE); +@@ -159,19 +160,19 @@ xdr_rpcb_entry(xdrs, objp) + XDR *xdrs; + rpcb_entry *objp; + { +- if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->r_maddr, RPC_MAXDATASIZE)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->r_nc_netid, RPC_MAXDATASIZE)) { + return (FALSE); + } + if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->r_nc_protofmly, RPC_MAXDATASIZE)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->r_nc_proto, RPC_MAXDATASIZE)) { + return (FALSE); + } + return (TRUE); +@@ -292,7 +293,7 @@ xdr_rpcb_rmtcallres(xdrs, p) + bool_t dummy; + struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p; + +- if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->addr, RPC_MAXDATASIZE)) { + return (FALSE); + } + if (!xdr_u_int(xdrs, &objp->results.results_len)) { +@@ -312,6 +313,11 @@ xdr_netbuf(xdrs, objp) + if (!xdr_u_int32_t(xdrs, (u_int32_t *) &objp->maxlen)) { + return (FALSE); + } ++ ++ if (objp->maxlen > RPC_MAXDATASIZE) { ++ return (FALSE); ++ } ++ + dummy = xdr_bytes(xdrs, (char **)&(objp->buf), + (u_int *)&(objp->len), objp->maxlen); + return (dummy); +diff --git a/src/rpcb_st_xdr.c b/src/rpcb_st_xdr.c +index 08db745..28e6a48 100644 +--- a/src/rpcb_st_xdr.c ++++ b/src/rpcb_st_xdr.c +@@ -37,6 +37,7 @@ + + + #include ++#include "rpc_com.h" + + /* Link list of all the stats about getport and getaddr */ + +@@ -58,7 +59,7 @@ xdr_rpcbs_addrlist(xdrs, objp) + if (!xdr_int(xdrs, &objp->failure)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { + return (FALSE); + } + +@@ -109,7 +110,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) + IXDR_PUT_INT32(buf, objp->failure); + IXDR_PUT_INT32(buf, objp->indirect); + } +- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { + return (FALSE); + } + if (!xdr_pointer(xdrs, (char **)&objp->next, +@@ -147,7 +148,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) + objp->failure = (int)IXDR_GET_INT32(buf); + objp->indirect = (int)IXDR_GET_INT32(buf); + } +- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { + return (FALSE); + } + if (!xdr_pointer(xdrs, (char **)&objp->next, +@@ -175,7 +176,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp) + if (!xdr_int(xdrs, &objp->indirect)) { + return (FALSE); + } +- if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) { ++ if (!xdr_string(xdrs, &objp->netid, RPC_MAXDATASIZE)) { + return (FALSE); + } + if (!xdr_pointer(xdrs, (char **)&objp->next, +diff --git a/src/xdr.c b/src/xdr.c +index f3fb9ad..b9a1558 100644 +--- a/src/xdr.c ++++ b/src/xdr.c +@@ -42,8 +42,10 @@ + #include + #include + ++#include + #include + #include ++#include + + typedef quad_t longlong_t; /* ANSI long long type */ + typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */ +@@ -53,7 +55,6 @@ typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */ + */ + #define XDR_FALSE ((long) 0) + #define XDR_TRUE ((long) 1) +-#define LASTUNSIGNED ((u_int) 0-1) + + /* + * for unit alignment +@@ -629,6 +630,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) + { + char *sp = *cpp; /* sp is the actual string pointer */ + u_int nodesize; ++ bool_t ret, allocated = FALSE; + + /* + * first deal with the length since xdr bytes are counted +@@ -652,6 +654,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) + } + if (sp == NULL) { + *cpp = sp = mem_alloc(nodesize); ++ allocated = TRUE; + } + if (sp == NULL) { + warnx("xdr_bytes: out of memory"); +@@ -660,7 +663,14 @@ xdr_bytes(xdrs, cpp, sizep, maxsize) + /* FALLTHROUGH */ + + case XDR_ENCODE: +- return (xdr_opaque(xdrs, sp, nodesize)); ++ ret = xdr_opaque(xdrs, sp, nodesize); ++ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) { ++ if (allocated == TRUE) { ++ free(sp); ++ *cpp = NULL; ++ } ++ } ++ return (ret); + + case XDR_FREE: + if (sp != NULL) { +@@ -754,6 +764,7 @@ xdr_string(xdrs, cpp, maxsize) + char *sp = *cpp; /* sp is the actual string pointer */ + u_int size; + u_int nodesize; ++ bool_t ret, allocated = FALSE; + + /* + * first deal with the length since xdr strings are counted-strings +@@ -793,8 +804,10 @@ xdr_string(xdrs, cpp, maxsize) + switch (xdrs->x_op) { + + case XDR_DECODE: +- if (sp == NULL) ++ if (sp == NULL) { + *cpp = sp = mem_alloc(nodesize); ++ allocated = TRUE; ++ } + if (sp == NULL) { + warnx("xdr_string: out of memory"); + return (FALSE); +@@ -803,7 +816,14 @@ xdr_string(xdrs, cpp, maxsize) + /* FALLTHROUGH */ + + case XDR_ENCODE: +- return (xdr_opaque(xdrs, sp, size)); ++ ret = xdr_opaque(xdrs, sp, size); ++ if ((xdrs->x_op == XDR_DECODE) && (ret == FALSE)) { ++ if (allocated == TRUE) { ++ free(sp); ++ *cpp = NULL; ++ } ++ } ++ return (ret); + + case XDR_FREE: + mem_free(sp, nodesize); +@@ -823,7 +843,7 @@ xdr_wrapstring(xdrs, cpp) + XDR *xdrs; + char **cpp; + { +- return xdr_string(xdrs, cpp, LASTUNSIGNED); ++ return xdr_string(xdrs, cpp, RPC_MAXDATASIZE); + } + + /* diff --git a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/libtirpc-0.2.5-r1.ebuild b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild similarity index 57% rename from sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/libtirpc-0.2.5-r1.ebuild rename to sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild index 7ad2b1b212..7356481b16 100644 --- a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/libtirpc-0.2.5-r1.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/libtirpc-1.0.1-r1.ebuild @@ -1,10 +1,9 @@ -# Copyright 1999-2015 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-libs/libtirpc/libtirpc-0.2.5.ebuild,v 1.11 2015/02/27 11:27:58 ago Exp $ -EAPI="4" +EAPI="5" -inherit multilib-minimal toolchain-funcs +inherit multilib-minimal toolchain-funcs eutils DESCRIPTION="Transport Independent RPC library (SunRPC replacement)" HOMEPAGE="http://libtirpc.sourceforge.net/" @@ -12,30 +11,23 @@ SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2 mirror://gentoo/${PN}-glibc-nfs.tar.xz" LICENSE="GPL-2" -SLOT="0" -KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86" +SLOT="0/3" # subslot matches SONAME major +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" IUSE="ipv6 kerberos static-libs" RDEPEND="kerberos? ( >=virtual/krb5-0-r1[${MULTILIB_USEDEP}] )" DEPEND="${RDEPEND} app-arch/xz-utils >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]" -RDEPEND="${RDEPEND} - abi_x86_32? ( - !<=app-emulation/emul-linux-x86-baselibs-20140508-r7 - !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] - )" -src_unpack() { - unpack ${A} - cp -r tirpc "${S}"/ || die -} +PATCHES=( + "${FILESDIR}/${P}-CVE-2017-8779.patch" +) src_prepare() { - epatch "${FILESDIR}"/${P}-stdarg.patch - - # set netconfig path to /usr so nfs works in CoreOS PXE/ISO booted systems. - sed -ie "s,/etc,/usr/share/tirpc," "${S}/tirpc/netconfig.h" || die + cp -r "${WORKDIR}"/tirpc "${S}"/ || die + epatch "${PATCHES[@]}" + epatch_user } multilib_src_configure() { @@ -50,13 +42,13 @@ multilib_src_install() { default # libtirpc replaces rpc support in glibc, so we need it in / - multilib_is_native_abi && gen_usr_ldscript -a tirpc + gen_usr_ldscript -a tirpc } multilib_src_install_all() { einstalldocs - insinto /usr/share/tirpc + insinto /etc doins doc/netconfig insinto /usr/include/tirpc diff --git a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/metadata.xml b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/metadata.xml index 5f43a51c7b..36e84cdfa7 100644 --- a/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/metadata.xml +++ b/sdk_container/src/third_party/coreos-overlay/net-libs/libtirpc/metadata.xml @@ -1,7 +1,10 @@ - net-fs + + base-system@gentoo.org + Gentoo Base System + libtirpc