mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 04:48:10 +02:00
core: don't log plain pointer values for singletons
Logging pointer values allows to defeat ASLR. Don't do that.
This commit is contained in:
parent
78999f9b61
commit
58df3f37ea
6 changed files with 18 additions and 8 deletions
|
|
@ -575,7 +575,8 @@ nm_auth_manager_setup (gboolean polkit_enabled)
|
||||||
singleton_instance = self;
|
singleton_instance = self;
|
||||||
nm_singleton_instance_register ();
|
nm_singleton_instance_register ();
|
||||||
|
|
||||||
nm_log_dbg (LOGD_CORE, "setup %s singleton (%p)", "NMAuthManager", singleton_instance);
|
nm_log_dbg (LOGD_CORE, "setup %s singleton ("NM_HASH_OBFUSCATE_PTR_FMT")",
|
||||||
|
"NMAuthManager", NM_HASH_OBFUSCATE_PTR (singleton_instance));
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2709,7 +2709,8 @@ nm_config_setup (const NMConfigCmdLineOptions *cli, char **atomic_section_prefix
|
||||||
|
|
||||||
/* usually, you would not see this logging line because when creating the
|
/* usually, you would not see this logging line because when creating the
|
||||||
* NMConfig instance, the logging is not yet set up to print debug message. */
|
* NMConfig instance, the logging is not yet set up to print debug message. */
|
||||||
nm_log_dbg (LOGD_CORE, "setup %s singleton (%p)", "NMConfig", singleton_instance);
|
nm_log_dbg (LOGD_CORE, "setup %s singleton ("NM_HASH_OBFUSCATE_PTR_FMT")",
|
||||||
|
"NMConfig", NM_HASH_OBFUSCATE_PTR (singleton_instance));
|
||||||
}
|
}
|
||||||
return singleton_instance;
|
return singleton_instance;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -142,8 +142,10 @@ _nm_singleton_instance_destroy (void)
|
||||||
|
|
||||||
g_object_weak_unref (instance, _nm_singleton_instance_weak_cb, NULL);
|
g_object_weak_unref (instance, _nm_singleton_instance_weak_cb, NULL);
|
||||||
|
|
||||||
if (instance->ref_count > 1)
|
if (instance->ref_count > 1) {
|
||||||
nm_log_dbg (LOGD_CORE, "disown %s singleton (%p)", G_OBJECT_TYPE_NAME (instance), instance);
|
nm_log_dbg (LOGD_CORE, "disown %s singleton ("NM_HASH_OBFUSCATE_PTR_FMT")",
|
||||||
|
G_OBJECT_TYPE_NAME (instance), NM_HASH_OBFUSCATE_PTR (instance));
|
||||||
|
}
|
||||||
|
|
||||||
g_object_unref (instance);
|
g_object_unref (instance);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,9 @@ static void \
|
||||||
_singleton_instance_weak_ref_cb (gpointer data, \
|
_singleton_instance_weak_ref_cb (gpointer data, \
|
||||||
GObject *where_the_object_was) \
|
GObject *where_the_object_was) \
|
||||||
{ \
|
{ \
|
||||||
nm_log_dbg (LOGD_CORE, "disposing %s singleton (%p)", G_STRINGIFY (TYPE), singleton_instance); \
|
nm_log_dbg (LOGD_CORE, "disposing %s singleton ("NM_HASH_OBFUSCATE_PTR_FMT")", \
|
||||||
|
G_STRINGIFY (TYPE), \
|
||||||
|
NM_HASH_OBFUSCATE_PTR (singleton_instance)); \
|
||||||
singleton_instance = NULL; \
|
singleton_instance = NULL; \
|
||||||
} \
|
} \
|
||||||
static inline void \
|
static inline void \
|
||||||
|
|
@ -73,7 +75,9 @@ GETTER (void) \
|
||||||
singleton_instance = (g_object_new (GTYPE, ##__VA_ARGS__, NULL)); \
|
singleton_instance = (g_object_new (GTYPE, ##__VA_ARGS__, NULL)); \
|
||||||
g_assert (singleton_instance); \
|
g_assert (singleton_instance); \
|
||||||
nm_singleton_instance_register (); \
|
nm_singleton_instance_register (); \
|
||||||
nm_log_dbg (LOGD_CORE, "create %s singleton (%p)", G_STRINGIFY (TYPE), singleton_instance); \
|
nm_log_dbg (LOGD_CORE, "create %s singleton ("NM_HASH_OBFUSCATE_PTR_FMT")", \
|
||||||
|
G_STRINGIFY (TYPE), \
|
||||||
|
NM_HASH_OBFUSCATE_PTR (singleton_instance)); \
|
||||||
} \
|
} \
|
||||||
return singleton_instance; \
|
return singleton_instance; \
|
||||||
} \
|
} \
|
||||||
|
|
|
||||||
|
|
@ -7272,7 +7272,8 @@ nm_manager_setup (void)
|
||||||
singleton_instance = self;
|
singleton_instance = self;
|
||||||
|
|
||||||
nm_singleton_instance_register ();
|
nm_singleton_instance_register ();
|
||||||
_LOGD (LOGD_CORE, "setup %s singleton (%p)", "NMManager", singleton_instance);
|
nm_log_dbg (LOGD_CORE, "setup %s singleton ("NM_HASH_OBFUSCATE_PTR_FMT")",
|
||||||
|
"NMManager", NM_HASH_OBFUSCATE_PTR (singleton_instance));
|
||||||
|
|
||||||
nm_dbus_object_export (NM_DBUS_OBJECT (self));
|
nm_dbus_object_export (NM_DBUS_OBJECT (self));
|
||||||
return self;
|
return self;
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,8 @@ nm_platform_setup (NMPlatform *instance)
|
||||||
|
|
||||||
nm_singleton_instance_register ();
|
nm_singleton_instance_register ();
|
||||||
|
|
||||||
nm_log_dbg (LOGD_CORE, "setup %s singleton (%p, %s)", "NMPlatform", singleton_instance, G_OBJECT_TYPE_NAME (instance));
|
nm_log_dbg (LOGD_CORE, "setup %s singleton ("NM_HASH_OBFUSCATE_PTR_FMT")",
|
||||||
|
"NMPlatform", NM_HASH_OBFUSCATE_PTR (instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue