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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9DDB41382C5 for ; Thu, 7 Jan 2021 00:48:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C71AFE0857; Thu, 7 Jan 2021 00:48:51 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id A01A8E0857 for ; Thu, 7 Jan 2021 00:48:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7F77A33BEEA for ; Thu, 7 Jan 2021 00:48:50 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 082AF48D for ; Thu, 7 Jan 2021 00:48:49 +0000 (UTC) From: "Lars Wendler" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Lars Wendler" Message-ID: <1609980525.ba53be405112d10b85e88cc2637156804b88bd91.polynomial-c@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/, app-shells/bash/ X-VCS-Repository: repo/gentoo X-VCS-Files: app-shells/bash/bash-5.0_p11-r1.ebuild app-shells/bash/files/bash-5.0_p11-disable_priv_mode.patch X-VCS-Directories: app-shells/bash/files/ app-shells/bash/ X-VCS-Committer: polynomial-c X-VCS-Committer-Name: Lars Wendler X-VCS-Revision: ba53be405112d10b85e88cc2637156804b88bd91 X-VCS-Branch: master Date: Thu, 7 Jan 2021 00:48:49 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 8c0a0e65-b0f3-44b3-ba01-37970e0878a8 X-Archives-Hash: 179d1de7b1fb8f447124f223757195b9 commit: ba53be405112d10b85e88cc2637156804b88bd91 Author: Hank Leininger korelogic com> AuthorDate: Wed Dec 11 22:06:45 2019 +0000 Commit: Lars Wendler gentoo org> CommitDate: Thu Jan 7 00:48:45 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba53be40 app-shells/bash: fix CVE-2019-18276 (priv-dropping bug) Cherry-picked the relevant parts of https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=951bdaad7a18cc0dc1036bba86b18b90874d39ff and modified the patches to apply. Note that the existing bash-5.0*patch files are applied with -p0, which is not the norm for eapply, etc. I simply followed what was required to work with the rest of the existing patches. Signed-off-by: Hank Leininger korelogic.com> Bug: https://bugs.gentoo.org/702488 Package-Manager: Portage-2.3.81, Repoman-2.3.18 Closes: https://github.com/gentoo/gentoo/pull/13941 Signed-off-by: Lars Wendler gentoo.org> app-shells/bash/bash-5.0_p11-r1.ebuild | 266 +++++++++++++++++++++ .../files/bash-5.0_p11-disable_priv_mode.patch | 85 +++++++ 2 files changed, 351 insertions(+) diff --git a/app-shells/bash/bash-5.0_p11-r1.ebuild b/app-shells/bash/bash-5.0_p11-r1.ebuild new file mode 100644 index 00000000000..a6cf9c086ce --- /dev/null +++ b/app-shells/bash/bash-5.0_p11-r1.ebuild @@ -0,0 +1,266 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit flag-o-matic toolchain-funcs multilib prefix + +# Official patchlevel +# See ftp://ftp.cwru.edu/pub/bash/bash-5.0-patches/ +PLEVEL=${PV##*_p} +MY_PV=${PV/_p*} +MY_PV=${MY_PV/_/-} +MY_P=${PN}-${MY_PV} +is_release() { + case ${PV} in + *_alpha*|*_beta*|*_rc*) return 1 ;; + *) return 0 ;; + esac +} +[[ ${PV} != *_p* ]] && PLEVEL=0 +patches() { + local opt=$1 plevel=${2:-${PLEVEL}} pn=${3:-${PN}} pv=${4:-${MY_PV}} + [[ ${plevel} -eq 0 ]] && return 1 + eval set -- {1..${plevel}} + set -- $(printf "${pn}${pv/\.}-%03d " "$@") + if [[ ${opt} == -s ]] ; then + echo "${@/#/${DISTDIR}/}" + else + local u + for u in ftp://ftp.cwru.edu/pub/bash mirror://gnu/${pn} ; do + printf "${u}/${pn}-${pv}-patches/%s " "$@" + done + fi +} + +# The version of readline this bash normally ships with. +READLINE_VER="8.0" + +DESCRIPTION="The standard GNU Bourne again shell" +HOMEPAGE="http://tiswww.case.edu/php/chet/bash/bashtop.html" +if is_release ; then + SRC_URI="mirror://gnu/bash/${MY_P}.tar.gz $(patches)" +else + SRC_URI="ftp://ftp.cwru.edu/pub/bash/${MY_P}.tar.gz" +fi + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="afs bashlogger examples mem-scramble +net nls plugins +readline" + +DEPEND=" + >=sys-libs/ncurses-5.2-r2:0= + nls? ( virtual/libintl ) + readline? ( >=sys-libs/readline-${READLINE_VER}:0= ) +" +RDEPEND=" + ${DEPEND} + !>confdefs.h <<_ACEOF ++#define HAVE_DECL_ $ac_have_decl ++_ACEOF ++(setresuid, setresgid) + ac_fn_c_check_decl "$LINENO" "strcpy" "ac_cv_have_decl_strcpy" "$ac_includes_default" + if test "x$ac_cv_have_decl_strcpy" = xyes; then : + ac_have_decl=1 +diff -urP ../bash-5.0.orig/configure.ac configure.ac +--- ../bash-5.0.orig/configure.ac 2019-01-02 07:39:11.000000000 -0700 ++++ configure.ac 2019-12-10 11:34:42.168926317 -0700 +@@ -810,6 +810,7 @@ + AC_CHECK_DECLS([printf]) + AC_CHECK_DECLS([sbrk]) + AC_CHECK_DECLS([setregid]) ++AC_CHECK_DECLS[(setresuid, setresgid]) + AC_CHECK_DECLS([strcpy]) + AC_CHECK_DECLS([strsignal]) + +diff -urP ../bash-5.0.orig/shell.c shell.c +--- ../bash-5.0.orig/shell.c 2018-12-06 09:28:21.000000000 -0700 ++++ shell.c 2019-12-10 11:34:42.170926317 -0700 +@@ -1293,7 +1293,11 @@ + { + int e; + ++#if HAVE_DECL_SETRESUID ++ if (setresuid (current_user.uid, current_user.uid, current_user.uid) < 0) ++#else + if (setuid (current_user.uid) < 0) ++#endif + { + e = errno; + sys_error (_("cannot set uid to %d: effective uid %d"), current_user.uid, current_user.euid); +@@ -1302,7 +1306,11 @@ + exit (e); + #endif + } ++#if HAVE_DECL_SETRESGID ++ if (setresgid (current_user.gid, current_user.gid, current_user.gid) < 0) ++#else + if (setgid (current_user.gid) < 0) ++#endif + sys_error (_("cannot set gid to %d: effective gid %d"), current_user.gid, current_user.egid); + + current_user.euid = current_user.uid;