From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3EC31158094 for ; Tue, 11 Oct 2022 10:07:22 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D20D4E0894; Tue, 11 Oct 2022 10:07:01 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 913EDE0886 for ; Tue, 11 Oct 2022 10:07:01 +0000 (UTC) From: Florian Schmaus To: gentoo-dev@lists.gentoo.org Cc: Florian Schmaus Subject: [gentoo-dev] [PATCH] go-module.eclass: ensure that A is less than 112 KiB Date: Tue, 11 Oct 2022 12:06:46 +0200 Message-Id: <20221011100646.1677690-2-flow@gentoo.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221011100646.1677690-1-flow@gentoo.org> References: <7F747AD3-0625-482C-9014-DBA7F56EF92D@gentoo.org> <20221011100646.1677690-1-flow@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 5f5e3813-514a-4de8-9d16-ebf4241c1a5b X-Archives-Hash: de4909021208ba9ce4f36bcd57f352a7 Packages with a large number of EGO_SUM entries, i.e., many thousands, cause SRC_URI, and in turn A, to become quite large. Prevent issues that are caused by large environment variables, e.g., execve() errors (see bug #719203), by ensuring that A stays below a reasonable size. Signed-off-by: Florian Schmaus --- eclass/go-module.eclass | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eclass/go-module.eclass b/eclass/go-module.eclass index 8047d498b08d..88414b7e9459 100644 --- a/eclass/go-module.eclass +++ b/eclass/go-module.eclass @@ -377,6 +377,15 @@ _go-module_src_unpack_gosum() { die "go-module_set_globals must be called in global scope" fi + local -i a_size="${#A}" + # Environment variables must not exceed MAX_ARG_STRLEN (128 KiB) on + # Linux, or otherwise execve() may fail. Ensure that A stays below + # this value. See also https://bugs.gentoo.org/719202#c16 + if [[ ${a_size} -gt 114688 ]]; then + # A is larger than 112 KiB. + die "Size of A variable (${a_size} bytes) is too large. Please use a dependency tarball instead of EGO_SUM." + fi + local goproxy_dir="${GOPROXY/file:\/\//}" mkdir -p "${goproxy_dir}" || die -- 2.35.1