diff options
author | Jory Pratt <anarchy@gentoo.org> | 2022-02-23 09:58:58 -0600 |
---|---|---|
committer | Jory Pratt <anarchy@gentoo.org> | 2022-02-23 09:59:23 -0600 |
commit | 3fa32295616a9ffef5bbea9c8568367b080a520f (patch) | |
tree | fd897d5bb4645842ef09caff4783ea8055a3c4a7 | |
parent | app-office/libreoffice: add subslot on gpgme dep (diff) | |
download | musl-3fa32295616a9ffef5bbea9c8568367b080a520f.tar.gz musl-3fa32295616a9ffef5bbea9c8568367b080a520f.tar.bz2 musl-3fa32295616a9ffef5bbea9c8568367b080a520f.zip |
sys-auth/polkit: sync with ::gentoo
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Jory Pratt <anarchy@gentoo.org>
-rw-r--r-- | sys-auth/polkit/files/polkit-0.120-CVE-2021-4115.patch | 78 | ||||
-rw-r--r-- | sys-auth/polkit/polkit-0.120-r3.ebuild | 128 |
2 files changed, 206 insertions, 0 deletions
diff --git a/sys-auth/polkit/files/polkit-0.120-CVE-2021-4115.patch b/sys-auth/polkit/files/polkit-0.120-CVE-2021-4115.patch new file mode 100644 index 00000000..a82ce25c --- /dev/null +++ b/sys-auth/polkit/files/polkit-0.120-CVE-2021-4115.patch @@ -0,0 +1,78 @@ +https://gitlab.freedesktop.org/polkit/polkit/-/commit/41cb093f554da8772362654a128a84dd8a5542a7 +https://gitlab.freedesktop.org/polkit/polkit/-/issues/141 +https://bugs.gentoo.org/833574 + +From: Jan Rybar <jrybar@redhat.com> +Date: Mon, 21 Feb 2022 08:29:05 +0000 +Subject: [PATCH] CVE-2021-4115 (GHSL-2021-077) fix + +--- a/src/polkit/polkitsystembusname.c ++++ b/src/polkit/polkitsystembusname.c +@@ -62,6 +62,10 @@ enum + PROP_NAME, + }; + ++ ++guint8 dbus_call_respond_fails; // has to be global because of callback ++ ++ + static void subject_iface_init (PolkitSubjectIface *subject_iface); + + G_DEFINE_TYPE_WITH_CODE (PolkitSystemBusName, polkit_system_bus_name, G_TYPE_OBJECT, +@@ -364,6 +368,7 @@ on_retrieved_unix_uid_pid (GObject *src, + if (!v) + { + data->caught_error = TRUE; ++ dbus_call_respond_fails += 1; + } + else + { +@@ -405,6 +410,8 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus + tmp_context = g_main_context_new (); + g_main_context_push_thread_default (tmp_context); + ++ dbus_call_respond_fails = 0; ++ + /* Do two async calls as it's basically as fast as one sync call. + */ + g_dbus_connection_call (connection, +@@ -432,11 +439,34 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus + on_retrieved_unix_uid_pid, + &data); + +- while (!((data.retrieved_uid && data.retrieved_pid) || data.caught_error)) +- g_main_context_iteration (tmp_context, TRUE); ++ while (TRUE) ++ { ++ /* If one dbus call returns error, we must wait until the other call ++ * calls _call_finish(), otherwise fd leak is possible. ++ * Resolves: GHSL-2021-077 ++ */ + +- if (data.caught_error) +- goto out; ++ if ( (dbus_call_respond_fails > 1) ) ++ { ++ // we got two faults, we can leave ++ goto out; ++ } ++ ++ if ((data.caught_error && (data.retrieved_pid || data.retrieved_uid))) ++ { ++ // we got one fault and the other call finally finished, we can leave ++ goto out; ++ } ++ ++ if ( !(data.retrieved_uid && data.retrieved_pid) ) ++ { ++ g_main_context_iteration (tmp_context, TRUE); ++ } ++ else ++ { ++ break; ++ } ++ } + + if (out_uid) + *out_uid = data.uid; +GitLab diff --git a/sys-auth/polkit/polkit-0.120-r3.ebuild b/sys-auth/polkit/polkit-0.120-r3.ebuild new file mode 100644 index 00000000..b4a58c38 --- /dev/null +++ b/sys-auth/polkit/polkit-0.120-r3.ebuild @@ -0,0 +1,128 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit meson pam pax-utils systemd xdg-utils + +DESCRIPTION="Policy framework for controlling privileges for system-wide services" +HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://gitlab.freedesktop.org/polkit/polkit" +SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz + https://dev.gentoo.org/~anarchy/dist/polkit-0.120-duktape-1.patch" + +LICENSE="LGPL-2" +SLOT="0" +KEYWORDS="amd64 ~arm ~arm64 ~mips ~ppc64 ~x86" +IUSE="duktape examples gtk +introspection kde pam selinux systemd test" +#RESTRICT="!test? ( test )" +# Tests currently don't work with meson. See +# https://gitlab.freedesktop.org/polkit/polkit/-/issues/144 +RESTRICT="test" + +BDEPEND=" + acct-user/polkitd + app-text/docbook-xml-dtd:4.1.2 + app-text/docbook-xsl-stylesheets + dev-libs/glib + dev-libs/gobject-introspection-common + dev-libs/libxslt + dev-util/glib-utils + sys-devel/gettext + virtual/pkgconfig + introspection? ( dev-libs/gobject-introspection ) +" +DEPEND=" + duktape? ( dev-lang/duktape ) + !duktape? ( dev-lang/spidermonkey:78[-debug] ) + dev-libs/glib:2 + dev-libs/expat + pam? ( + sys-auth/pambase + sys-libs/pam + ) + !pam? ( virtual/libcrypt:= ) + systemd? ( sys-apps/systemd:0=[policykit] ) + !systemd? ( sys-auth/elogind ) +" +RDEPEND="${DEPEND} + acct-user/polkitd + selinux? ( sec-policy/selinux-policykit ) +" +PDEPEND=" + gtk? ( || ( + >=gnome-extra/polkit-gnome-0.105 + >=lxde-base/lxsession-0.5.2 + ) ) + kde? ( kde-plasma/polkit-kde-agent ) +" + +DOCS=( docs/TODO HACKING NEWS README ) + +QA_MULTILIB_PATHS=" + usr/lib/polkit-1/polkit-agent-helper-1 + usr/lib/polkit-1/polkitd" + +src_prepare() { + local PATCHES=( + "${FILESDIR}/polkit-0.120-meson.patch" + "${FILESDIR}/polkit-0.120-CVE-2021-4043.patch" + "${FILESDIR}/polkit-0.120-CVE-2021-4115.patch" + "${DISTDIR}"/${PN}-0.120-duktape-1.patch + "${FILESDIR}"/${PN}-0.118-make-netgroup-support-optional.patch + ) + + default + + sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die #401513 +} + +src_configure() { + xdg_environment_reset + + local emesonargs=( + --localstatedir="${EPREFIX}"/var + -Dauthfw="$(usex pam pam shadow)" + -Dexamples=false + -Dgtk_doc=false + -Dman=true + -Dos_type=gentoo + -Dsession_tracking="$(usex systemd libsystemd-login libelogind)" + -Dsystemdsystemunitdir="$(systemd_get_systemunitdir)" + $(meson_use introspection) + $(meson_use test tests) + $(usex pam "-Dpam_module_dir=$(getpam_mod_dir)" '') + -Djs_engine="$(usex duktape duktape mozjs)" + ) + meson_src_configure +} + +src_compile() { + meson_src_compile + + # Required for polkitd on hardened/PaX due to spidermonkey's JIT + pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest +} + +src_install() { + meson_src_install + + if use examples ; then + docinto examples + dodoc src/examples/{*.c,*.policy*} + fi + + diropts -m 0700 -o polkitd + keepdir /usr/share/polkit-1/rules.d + + # meson does not install required files with SUID bit. See + # https://bugs.gentoo.org/816393 + # Remove the following lines once this has been fixed by upstream + # (should be fixed in next release: https://gitlab.freedesktop.org/polkit/polkit/-/commit/4ff1abe4a4c1f8c8378b9eaddb0346ac6448abd8) + fperms u+s /usr/bin/pkexec + fperms u+s /usr/lib/polkit-1/polkit-agent-helper-1 +} + +pkg_postinst() { + chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d + chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d +} |