Fix a race on PolkitSubject type registration (#866718)
This commit is contained in:
parent
8254063f16
commit
576cdfa20a
115
polkit-0.112-gobject-interface-type-registration-race.patch
Normal file
115
polkit-0.112-gobject-interface-type-registration-race.patch
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
From 20ad116a6582e57d20f9d8197758947918753a4c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomas Bzatek <tbzatek@redhat.com>
|
||||||
|
Date: Wed, 29 May 2013 13:45:31 +0000
|
||||||
|
Subject: Use GOnce for interface type registration
|
||||||
|
|
||||||
|
Static local variable may not be enough since it doesn't provide locking.
|
||||||
|
|
||||||
|
Related to these udisksd warnings:
|
||||||
|
GLib-GObject-WARNING **: cannot register existing type `PolkitSubject'
|
||||||
|
|
||||||
|
Thanks to Hans de Goede for spotting this!
|
||||||
|
|
||||||
|
https://bugs.freedesktop.org/show_bug.cgi?id=65130
|
||||||
|
---
|
||||||
|
diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c
|
||||||
|
index dd15b2f..7813c2c 100644
|
||||||
|
--- a/src/polkit/polkitidentity.c
|
||||||
|
+++ b/src/polkit/polkitidentity.c
|
||||||
|
@@ -49,9 +49,9 @@ base_init (gpointer g_iface)
|
||||||
|
GType
|
||||||
|
polkit_identity_get_type (void)
|
||||||
|
{
|
||||||
|
- static GType iface_type = 0;
|
||||||
|
+ static volatile gsize g_define_type_id__volatile = 0;
|
||||||
|
|
||||||
|
- if (iface_type == 0)
|
||||||
|
+ if (g_once_init_enter (&g_define_type_id__volatile))
|
||||||
|
{
|
||||||
|
static const GTypeInfo info =
|
||||||
|
{
|
||||||
|
@@ -67,12 +67,14 @@ polkit_identity_get_type (void)
|
||||||
|
NULL /* value_table */
|
||||||
|
};
|
||||||
|
|
||||||
|
- iface_type = g_type_register_static (G_TYPE_INTERFACE, "PolkitIdentity", &info, 0);
|
||||||
|
+ GType iface_type =
|
||||||
|
+ g_type_register_static (G_TYPE_INTERFACE, "PolkitIdentity", &info, 0);
|
||||||
|
|
||||||
|
g_type_interface_add_prerequisite (iface_type, G_TYPE_OBJECT);
|
||||||
|
+ g_once_init_leave (&g_define_type_id__volatile, iface_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
- return iface_type;
|
||||||
|
+ return g_define_type_id__volatile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c
|
||||||
|
index d2c4c20..aed5795 100644
|
||||||
|
--- a/src/polkit/polkitsubject.c
|
||||||
|
+++ b/src/polkit/polkitsubject.c
|
||||||
|
@@ -50,9 +50,9 @@ base_init (gpointer g_iface)
|
||||||
|
GType
|
||||||
|
polkit_subject_get_type (void)
|
||||||
|
{
|
||||||
|
- static GType iface_type = 0;
|
||||||
|
+ static volatile gsize g_define_type_id__volatile = 0;
|
||||||
|
|
||||||
|
- if (iface_type == 0)
|
||||||
|
+ if (g_once_init_enter (&g_define_type_id__volatile))
|
||||||
|
{
|
||||||
|
static const GTypeInfo info =
|
||||||
|
{
|
||||||
|
@@ -68,12 +68,14 @@ polkit_subject_get_type (void)
|
||||||
|
NULL /* value_table */
|
||||||
|
};
|
||||||
|
|
||||||
|
- iface_type = g_type_register_static (G_TYPE_INTERFACE, "PolkitSubject", &info, 0);
|
||||||
|
+ GType iface_type =
|
||||||
|
+ g_type_register_static (G_TYPE_INTERFACE, "PolkitSubject", &info, 0);
|
||||||
|
|
||||||
|
g_type_interface_add_prerequisite (iface_type, G_TYPE_OBJECT);
|
||||||
|
+ g_once_init_leave (&g_define_type_id__volatile, iface_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
- return iface_type;
|
||||||
|
+ return g_define_type_id__volatile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
diff --git a/src/polkitbackend/polkitbackendactionlookup.c b/src/polkitbackend/polkitbackendactionlookup.c
|
||||||
|
index 5a1a228..20747e7 100644
|
||||||
|
--- a/src/polkitbackend/polkitbackendactionlookup.c
|
||||||
|
+++ b/src/polkitbackend/polkitbackendactionlookup.c
|
||||||
|
@@ -74,9 +74,9 @@ base_init (gpointer g_iface)
|
||||||
|
GType
|
||||||
|
polkit_backend_action_lookup_get_type (void)
|
||||||
|
{
|
||||||
|
- static GType iface_type = 0;
|
||||||
|
+ static volatile gsize g_define_type_id__volatile = 0;
|
||||||
|
|
||||||
|
- if (iface_type == 0)
|
||||||
|
+ if (g_once_init_enter (&g_define_type_id__volatile))
|
||||||
|
{
|
||||||
|
static const GTypeInfo info =
|
||||||
|
{
|
||||||
|
@@ -92,12 +92,14 @@ polkit_backend_action_lookup_get_type (void)
|
||||||
|
NULL /* value_table */
|
||||||
|
};
|
||||||
|
|
||||||
|
- iface_type = g_type_register_static (G_TYPE_INTERFACE, "PolkitBackendActionLookup", &info, 0);
|
||||||
|
+ GType iface_type =
|
||||||
|
+ g_type_register_static (G_TYPE_INTERFACE, "PolkitBackendActionLookup", &info, 0);
|
||||||
|
|
||||||
|
g_type_interface_add_prerequisite (iface_type, G_TYPE_OBJECT);
|
||||||
|
+ g_once_init_leave (&g_define_type_id__volatile, iface_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
- return iface_type;
|
||||||
|
+ return g_define_type_id__volatile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
--
|
||||||
|
cgit v0.9.0.2-2-gbebe
|
11
polkit.spec
11
polkit.spec
@ -6,7 +6,7 @@
|
|||||||
Summary: An authorization framework
|
Summary: An authorization framework
|
||||||
Name: polkit
|
Name: polkit
|
||||||
Version: 0.111
|
Version: 0.111
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: http://www.freedesktop.org/wiki/Software/polkit
|
URL: http://www.freedesktop.org/wiki/Software/polkit
|
||||||
Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz
|
Source0: http://www.freedesktop.org/software/polkit/releases/%{name}-%{version}.tar.gz
|
||||||
@ -47,6 +47,11 @@ Provides: polkit-desktop-policy = 0.103
|
|||||||
Obsoletes: polkit-js-engine < 0.110-4
|
Obsoletes: polkit-js-engine < 0.110-4
|
||||||
Provides: polkit-js-engine = %{version}-%{release}
|
Provides: polkit-js-engine = %{version}-%{release}
|
||||||
|
|
||||||
|
|
||||||
|
# https://bugzilla.redhat.com/show_bug.cgi?id=866718
|
||||||
|
# Use GOnce for interface type registration
|
||||||
|
Patch0: polkit-0.112-gobject-interface-type-registration-race.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
polkit is a toolkit for defining and handling authorizations. It is
|
polkit is a toolkit for defining and handling authorizations. It is
|
||||||
used for allowing unprivileged processes to speak to privileged
|
used for allowing unprivileged processes to speak to privileged
|
||||||
@ -77,6 +82,7 @@ Development documentation for polkit.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1 -b .gtype-race
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%if 0%{?enable_autoreconf}
|
%if 0%{?enable_autoreconf}
|
||||||
@ -163,6 +169,9 @@ exit 0
|
|||||||
%{_datadir}/gtk-doc
|
%{_datadir}/gtk-doc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed May 29 2013 Tomas Bzatek <tbzatek@redhat.com> - 0.111-2
|
||||||
|
- Fix a race on PolkitSubject type registration (#866718)
|
||||||
|
|
||||||
* Wed May 15 2013 Miloslav Trmač <mitr@redhat.com> - 0.111-1
|
* Wed May 15 2013 Miloslav Trmač <mitr@redhat.com> - 0.111-1
|
||||||
- Update to polkit-0.111
|
- Update to polkit-0.111
|
||||||
Resolves: #917888
|
Resolves: #917888
|
||||||
|
Loading…
Reference in New Issue
Block a user