1 |
commit: 3fa32295616a9ffef5bbea9c8568367b080a520f |
2 |
Author: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 23 15:58:58 2022 +0000 |
4 |
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 23 15:59:23 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=3fa32295 |
7 |
|
8 |
sys-auth/polkit: sync with ::gentoo |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org> |
12 |
|
13 |
.../polkit/files/polkit-0.120-CVE-2021-4115.patch | 78 +++++++++++++ |
14 |
sys-auth/polkit/polkit-0.120-r3.ebuild | 128 +++++++++++++++++++++ |
15 |
2 files changed, 206 insertions(+) |
16 |
|
17 |
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 |
18 |
new file mode 100644 |
19 |
index 00000000..a82ce25c |
20 |
--- /dev/null |
21 |
+++ b/sys-auth/polkit/files/polkit-0.120-CVE-2021-4115.patch |
22 |
@@ -0,0 +1,78 @@ |
23 |
+https://gitlab.freedesktop.org/polkit/polkit/-/commit/41cb093f554da8772362654a128a84dd8a5542a7 |
24 |
+https://gitlab.freedesktop.org/polkit/polkit/-/issues/141 |
25 |
+https://bugs.gentoo.org/833574 |
26 |
+ |
27 |
+From: Jan Rybar <jrybar@××××××.com> |
28 |
+Date: Mon, 21 Feb 2022 08:29:05 +0000 |
29 |
+Subject: [PATCH] CVE-2021-4115 (GHSL-2021-077) fix |
30 |
+ |
31 |
+--- a/src/polkit/polkitsystembusname.c |
32 |
++++ b/src/polkit/polkitsystembusname.c |
33 |
+@@ -62,6 +62,10 @@ enum |
34 |
+ PROP_NAME, |
35 |
+ }; |
36 |
+ |
37 |
++ |
38 |
++guint8 dbus_call_respond_fails; // has to be global because of callback |
39 |
++ |
40 |
++ |
41 |
+ static void subject_iface_init (PolkitSubjectIface *subject_iface); |
42 |
+ |
43 |
+ G_DEFINE_TYPE_WITH_CODE (PolkitSystemBusName, polkit_system_bus_name, G_TYPE_OBJECT, |
44 |
+@@ -364,6 +368,7 @@ on_retrieved_unix_uid_pid (GObject *src, |
45 |
+ if (!v) |
46 |
+ { |
47 |
+ data->caught_error = TRUE; |
48 |
++ dbus_call_respond_fails += 1; |
49 |
+ } |
50 |
+ else |
51 |
+ { |
52 |
+@@ -405,6 +410,8 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus |
53 |
+ tmp_context = g_main_context_new (); |
54 |
+ g_main_context_push_thread_default (tmp_context); |
55 |
+ |
56 |
++ dbus_call_respond_fails = 0; |
57 |
++ |
58 |
+ /* Do two async calls as it's basically as fast as one sync call. |
59 |
+ */ |
60 |
+ g_dbus_connection_call (connection, |
61 |
+@@ -432,11 +439,34 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus |
62 |
+ on_retrieved_unix_uid_pid, |
63 |
+ &data); |
64 |
+ |
65 |
+- while (!((data.retrieved_uid && data.retrieved_pid) || data.caught_error)) |
66 |
+- g_main_context_iteration (tmp_context, TRUE); |
67 |
++ while (TRUE) |
68 |
++ { |
69 |
++ /* If one dbus call returns error, we must wait until the other call |
70 |
++ * calls _call_finish(), otherwise fd leak is possible. |
71 |
++ * Resolves: GHSL-2021-077 |
72 |
++ */ |
73 |
+ |
74 |
+- if (data.caught_error) |
75 |
+- goto out; |
76 |
++ if ( (dbus_call_respond_fails > 1) ) |
77 |
++ { |
78 |
++ // we got two faults, we can leave |
79 |
++ goto out; |
80 |
++ } |
81 |
++ |
82 |
++ if ((data.caught_error && (data.retrieved_pid || data.retrieved_uid))) |
83 |
++ { |
84 |
++ // we got one fault and the other call finally finished, we can leave |
85 |
++ goto out; |
86 |
++ } |
87 |
++ |
88 |
++ if ( !(data.retrieved_uid && data.retrieved_pid) ) |
89 |
++ { |
90 |
++ g_main_context_iteration (tmp_context, TRUE); |
91 |
++ } |
92 |
++ else |
93 |
++ { |
94 |
++ break; |
95 |
++ } |
96 |
++ } |
97 |
+ |
98 |
+ if (out_uid) |
99 |
+ *out_uid = data.uid; |
100 |
+GitLab |
101 |
|
102 |
diff --git a/sys-auth/polkit/polkit-0.120-r3.ebuild b/sys-auth/polkit/polkit-0.120-r3.ebuild |
103 |
new file mode 100644 |
104 |
index 00000000..b4a58c38 |
105 |
--- /dev/null |
106 |
+++ b/sys-auth/polkit/polkit-0.120-r3.ebuild |
107 |
@@ -0,0 +1,128 @@ |
108 |
+# Copyright 1999-2022 Gentoo Authors |
109 |
+# Distributed under the terms of the GNU General Public License v2 |
110 |
+ |
111 |
+EAPI=7 |
112 |
+ |
113 |
+inherit meson pam pax-utils systemd xdg-utils |
114 |
+ |
115 |
+DESCRIPTION="Policy framework for controlling privileges for system-wide services" |
116 |
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://gitlab.freedesktop.org/polkit/polkit" |
117 |
+SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz |
118 |
+ https://dev.gentoo.org/~anarchy/dist/polkit-0.120-duktape-1.patch" |
119 |
+ |
120 |
+LICENSE="LGPL-2" |
121 |
+SLOT="0" |
122 |
+KEYWORDS="amd64 ~arm ~arm64 ~mips ~ppc64 ~x86" |
123 |
+IUSE="duktape examples gtk +introspection kde pam selinux systemd test" |
124 |
+#RESTRICT="!test? ( test )" |
125 |
+# Tests currently don't work with meson. See |
126 |
+# https://gitlab.freedesktop.org/polkit/polkit/-/issues/144 |
127 |
+RESTRICT="test" |
128 |
+ |
129 |
+BDEPEND=" |
130 |
+ acct-user/polkitd |
131 |
+ app-text/docbook-xml-dtd:4.1.2 |
132 |
+ app-text/docbook-xsl-stylesheets |
133 |
+ dev-libs/glib |
134 |
+ dev-libs/gobject-introspection-common |
135 |
+ dev-libs/libxslt |
136 |
+ dev-util/glib-utils |
137 |
+ sys-devel/gettext |
138 |
+ virtual/pkgconfig |
139 |
+ introspection? ( dev-libs/gobject-introspection ) |
140 |
+" |
141 |
+DEPEND=" |
142 |
+ duktape? ( dev-lang/duktape ) |
143 |
+ !duktape? ( dev-lang/spidermonkey:78[-debug] ) |
144 |
+ dev-libs/glib:2 |
145 |
+ dev-libs/expat |
146 |
+ pam? ( |
147 |
+ sys-auth/pambase |
148 |
+ sys-libs/pam |
149 |
+ ) |
150 |
+ !pam? ( virtual/libcrypt:= ) |
151 |
+ systemd? ( sys-apps/systemd:0=[policykit] ) |
152 |
+ !systemd? ( sys-auth/elogind ) |
153 |
+" |
154 |
+RDEPEND="${DEPEND} |
155 |
+ acct-user/polkitd |
156 |
+ selinux? ( sec-policy/selinux-policykit ) |
157 |
+" |
158 |
+PDEPEND=" |
159 |
+ gtk? ( || ( |
160 |
+ >=gnome-extra/polkit-gnome-0.105 |
161 |
+ >=lxde-base/lxsession-0.5.2 |
162 |
+ ) ) |
163 |
+ kde? ( kde-plasma/polkit-kde-agent ) |
164 |
+" |
165 |
+ |
166 |
+DOCS=( docs/TODO HACKING NEWS README ) |
167 |
+ |
168 |
+QA_MULTILIB_PATHS=" |
169 |
+ usr/lib/polkit-1/polkit-agent-helper-1 |
170 |
+ usr/lib/polkit-1/polkitd" |
171 |
+ |
172 |
+src_prepare() { |
173 |
+ local PATCHES=( |
174 |
+ "${FILESDIR}/polkit-0.120-meson.patch" |
175 |
+ "${FILESDIR}/polkit-0.120-CVE-2021-4043.patch" |
176 |
+ "${FILESDIR}/polkit-0.120-CVE-2021-4115.patch" |
177 |
+ "${DISTDIR}"/${PN}-0.120-duktape-1.patch |
178 |
+ "${FILESDIR}"/${PN}-0.118-make-netgroup-support-optional.patch |
179 |
+ ) |
180 |
+ |
181 |
+ default |
182 |
+ |
183 |
+ sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die #401513 |
184 |
+} |
185 |
+ |
186 |
+src_configure() { |
187 |
+ xdg_environment_reset |
188 |
+ |
189 |
+ local emesonargs=( |
190 |
+ --localstatedir="${EPREFIX}"/var |
191 |
+ -Dauthfw="$(usex pam pam shadow)" |
192 |
+ -Dexamples=false |
193 |
+ -Dgtk_doc=false |
194 |
+ -Dman=true |
195 |
+ -Dos_type=gentoo |
196 |
+ -Dsession_tracking="$(usex systemd libsystemd-login libelogind)" |
197 |
+ -Dsystemdsystemunitdir="$(systemd_get_systemunitdir)" |
198 |
+ $(meson_use introspection) |
199 |
+ $(meson_use test tests) |
200 |
+ $(usex pam "-Dpam_module_dir=$(getpam_mod_dir)" '') |
201 |
+ -Djs_engine="$(usex duktape duktape mozjs)" |
202 |
+ ) |
203 |
+ meson_src_configure |
204 |
+} |
205 |
+ |
206 |
+src_compile() { |
207 |
+ meson_src_compile |
208 |
+ |
209 |
+ # Required for polkitd on hardened/PaX due to spidermonkey's JIT |
210 |
+ pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest |
211 |
+} |
212 |
+ |
213 |
+src_install() { |
214 |
+ meson_src_install |
215 |
+ |
216 |
+ if use examples ; then |
217 |
+ docinto examples |
218 |
+ dodoc src/examples/{*.c,*.policy*} |
219 |
+ fi |
220 |
+ |
221 |
+ diropts -m 0700 -o polkitd |
222 |
+ keepdir /usr/share/polkit-1/rules.d |
223 |
+ |
224 |
+ # meson does not install required files with SUID bit. See |
225 |
+ # https://bugs.gentoo.org/816393 |
226 |
+ # Remove the following lines once this has been fixed by upstream |
227 |
+ # (should be fixed in next release: https://gitlab.freedesktop.org/polkit/polkit/-/commit/4ff1abe4a4c1f8c8378b9eaddb0346ac6448abd8) |
228 |
+ fperms u+s /usr/bin/pkexec |
229 |
+ fperms u+s /usr/lib/polkit-1/polkit-agent-helper-1 |
230 |
+} |
231 |
+ |
232 |
+pkg_postinst() { |
233 |
+ chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d |
234 |
+ chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d |
235 |
+} |