Skip to content
Snippets Groups Projects
Commit 23f5fa8e authored by Philip Withnall's avatar Philip Withnall
Browse files

WIP work to try and find a way to make valgrinding Rhosydd easy

Currently steps to valgrind:
 • sudo chmod a+rx /usr/bin/rhosydd
 • Copy all .service files and add valgrind adverb to them
 • sudo aa-complain /usr/bin/rhosydd;
   /usr/lib/*/rhosydd-*/rhosydd-*-backend
 • sudo systemctl daemon-reload
 • sudo systemctl restart rhosydd[-mock-backend|-speedo-backend].service
parent ba9b681d
No related branches found
No related tags found
No related merge requests found
......@@ -251,6 +251,23 @@ csr_backend_manager_ensure_peer_info_async (CsrPeerManager *peer_manager,
}
}
static const gchar *
process_type_to_string (CbyProcessType type)
{
switch (type)
{
case CBY_PROCESS_TYPE_PLATFORM:
return "platform";
case CBY_PROCESS_TYPE_BUILT_IN_BUNDLE:
return "built-in-bundle";
case CBY_PROCESS_TYPE_STORE_BUNDLE:
return "store-bundle";
case CBY_PROCESS_TYPE_UNKNOWN:
default:
return "unknown";
}
}
static void
ensure_peer_info_cb (GObject *object,
GAsyncResult *result,
......@@ -259,6 +276,7 @@ ensure_peer_info_cb (GObject *object,
CsrBackendManager *self;
g_autoptr (GTask) task = G_TASK (user_data);
EnsurePeerInfoData *data;
CbyProcessInfo *self_info = NULL;
g_autoptr (CbyProcessInfo) process_info = NULL;
GError *error = NULL;
......@@ -272,11 +290,26 @@ ensure_peer_info_cb (GObject *object,
return;
}
/* Check that the peer is actually the daemon. */
if (cby_process_info_get_process_type (process_info) !=
CBY_PROCESS_TYPE_PLATFORM ||
g_strcmp0 (cby_process_info_get_apparmor_label (process_info),
"/usr/bin/rhosydd") != 0)
self_info = cby_process_info_get_self ();
DEBUG ("Got peer info: process type: %s, AppArmor label: %s; "
"self info: process type: %s, AppArmor label: %s",
process_type_to_string (cby_process_info_get_process_type (process_info)),
cby_process_info_get_apparmor_label (process_info),
process_type_to_string (cby_process_info_get_process_type (self_info)),
cby_process_info_get_apparmor_label (self_info));
/* Check that the peer is actually the daemon. Alternatively, allow it to be
* unconfined iff we are also unconfined. This is useful for debugging; and
* if one of the Rhosydd processes is unconfined then we’ve lost anyway. */
if (!(cby_process_info_get_process_type (process_info) ==
CBY_PROCESS_TYPE_PLATFORM &&
g_strcmp0 (cby_process_info_get_apparmor_label (process_info),
"/usr/bin/rhosydd") == 0) &&
!(g_strcmp0 (cby_process_info_get_apparmor_label (process_info),
"unconfined") == 0 &&
g_strcmp0 (cby_process_info_get_apparmor_label (self_info),
"unconfined") == 0))
{
g_task_return_new_error (task, G_DBUS_ERROR,
G_DBUS_ERROR_ACCESS_DENIED,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment