Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE-12:Update
polkit
CVE-2021-4115.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File CVE-2021-4115.patch of Package polkit
From a7b1416cca95441d14e67775274a9887c83d4d10 Mon Sep 17 00:00:00 2001 From: Jan Rybar <jrybar@redhat.com> Date: Mon, 31 Jan 2022 11:34:15 +0100 Subject: [PATCH] CVE-2021-4115 (GHSL-2021-077) fix Quitting loop before both dbus responds received causes file descriptor leak --- src/polkit/polkitsystembusname.c | 37 ++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c index 8ed1363..153ca7d 100644 --- a/src/polkit/polkitsystembusname.c +++ b/src/polkit/polkitsystembusname.c @@ -62,6 +62,10 @@ enum PROP_NAME, }; + +int 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 { @@ -395,6 +400,7 @@ polkit_system_bus_name_get_creds_sync (PolkitSystemBusName *system_bus AsyncGetBusNameCredsData data = { 0, }; GDBusConnection *connection = NULL; GMainContext *tmp_context = NULL; + dbus_call_respond_fails = 0; connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error); if (connection == NULL) @@ -432,11 +438,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; -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor