Accepting request 1105520 from home:luc14n0:branches:devel:libraries:c_c++

Version update: 2.9.4 -> 2.10.0

OBS-URL: https://build.opensuse.org/request/show/1105520
OBS-URL: https://build.opensuse.org/package/show/Base:System/udisks2?expand=0&rev=100
This commit is contained in:
Dominique Leuenberger 2023-08-29 15:02:34 +00:00 committed by Git OBS Bridge
parent 555ca276bb
commit 50750de89a
9 changed files with 131 additions and 716 deletions

View File

@ -1,129 +0,0 @@
From a7d9b97c9460f65a726b727e9eaee31ea5016538 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Wed, 5 Jan 2022 20:17:55 +0100
Subject: [PATCH] udisksata: Move the low-level PM state call
(cherry picked from commit 4588dbeecd23c17d1cb7f7fa60afd56702acd455)
---
doc/udisks2-sections.txt.daemon.sections.in | 2 +
src/udisksata.c | 62 +++++++++++++++++++++
src/udisksata.h | 13 +++++
3 files changed, 77 insertions(+)
diff --git a/doc/udisks2-sections.txt.daemon.sections.in b/doc/udisks2-sections.txt.daemon.sections.in
index 12935c4d..9a2bfa03 100644
--- a/doc/udisks2-sections.txt.daemon.sections.in
+++ b/doc/udisks2-sections.txt.daemon.sections.in
@@ -270,6 +270,8 @@ UDisksAtaCommandProtocol
UDisksAtaCommandInput
UDisksAtaCommandOutput
udisks_ata_send_command_sync
+udisks_ata_get_pm_state
+UDISKS_ATA_PM_STATE_AWAKE
</SECTION>
<SECTION>
diff --git a/src/udisksata.c b/src/udisksata.c
index 9491af5e..e6da8c35 100644
--- a/src/udisksata.c
+++ b/src/udisksata.c
@@ -308,3 +308,65 @@ udisks_ata_send_command_sync (gint fd,
out:
return ret;
}
+
+/**
+ * udisks_ata_get_pm_state:
+ * @device: ATA drive block device path.
+ * @error: Return location for error.
+ * @pm_state: Return location for the current power state value.
+ *
+ * Get the current power mode state.
+ *
+ * The format of @pm_state is the result obtained from sending the
+ * ATA command `CHECK POWER MODE` to the drive.
+ *
+ * Known values include:
+ * - `0x00`: Device is in PM2: Standby state.
+ * - `0x40`: Device is in the PM0: Active state, the NV Cache power mode is enabled, and the spindle is spun down or spinning down.
+ * - `0x41`: Device is in the PM0: Active state, the NV Cache power mode is enabled, and the spindle is spun up or spinning up.
+ * - `0x80`: Device is in PM1: Idle state.
+ * - `0xff`: Device is in the PM0: Active state or PM1: Idle State.
+ *
+ * Typically user interfaces will report "Drive is spun down" if @pm_state is
+ * 0x00 and "Drive is spun up" otherwise.
+ *
+ * Returns: %TRUE if the operation succeeded, %FALSE if @error is set.
+ */
+gboolean
+udisks_ata_get_pm_state (const gchar *device, GError **error, guchar *count)
+{
+ int fd;
+ gboolean rc = FALSE;
+ /* ATA8: 7.8 CHECK POWER MODE - E5h, Non-Data */
+ UDisksAtaCommandInput input = {.command = 0xe5};
+ UDisksAtaCommandOutput output = {0};
+
+ g_warn_if_fail (device != NULL);
+
+ fd = open (device, O_RDONLY|O_NONBLOCK);
+ if (fd == -1)
+ {
+ g_set_error (error, UDISKS_ERROR, UDISKS_ERROR_FAILED,
+ "Error opening device file %s while getting PM state: %m",
+ device);
+ goto out;
+ }
+
+ if (!udisks_ata_send_command_sync (fd,
+ -1,
+ UDISKS_ATA_COMMAND_PROTOCOL_NONE,
+ &input,
+ &output,
+ error))
+ {
+ g_prefix_error (error, "Error sending ATA command CHECK POWER MODE: ");
+ goto out;
+ }
+ /* count field is used for the state, see ATA8: table 102 */
+ *count = output.count;
+ rc = TRUE;
+ out:
+ if (fd != -1)
+ close (fd);
+ return rc;
+}
diff --git a/src/udisksata.h b/src/udisksata.h
index 1d4918f1..d652f3ab 100644
--- a/src/udisksata.h
+++ b/src/udisksata.h
@@ -73,6 +73,16 @@ struct _UDisksAtaCommandOutput
guchar *buffer;
};
+/**
+ * UDISKS_ATA_PM_STATE_AWAKE:
+ * @pm_state: The power state value.
+ *
+ * Decodes the power state value as returned by #udisks_ata_get_pm_state.
+ *
+ * Returns: %TRUE when the drive is awake, %FALSE when sleeping.
+*/
+#define UDISKS_ATA_PM_STATE_AWAKE(pm_state) (pm_state >= 0x41)
+
gboolean udisks_ata_send_command_sync (gint fd,
gint timeout_msec,
UDisksAtaCommandProtocol protocol,
@@ -80,6 +90,9 @@ gboolean udisks_ata_send_command_sync (gint fd,
UDisksAtaCommandOutput *output,
GError **error);
+gboolean udisks_ata_get_pm_state (const gchar *device,
+ GError **error,
+ guchar *count);
G_END_DECLS
--
2.38.1

View File

@ -1,277 +0,0 @@
From 9a2a96b46803b1d76d105f3bed994188b8205133 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Sun, 2 Jan 2022 23:45:12 +0100
Subject: [PATCH] udiskslinuxfilesystem: Make the 'size' property retrieval
on-demand
Filesystem size value retrieval is very expensive as it typically calls
filesystem tools that read superblock -> doing some I/O. Other
filesystem properties are typically retrieved from existing stateful
sources, either udev or sysfs.
This change overrides the gdbus-codegen-generated GDBusInterfaceSkeleton
property retrieval and adds a custom hook that retrieves the filesystem
size value when actually requested.
One limitation of such approach is that the hook is called with
the GDBusObjectManager lock held and thus it needs to be as minimal
as possible and avoiding access to any GDBusObject.
---
src/udiskslinuxfilesystem.c | 129 +++++++++++++++++++++++++++---------
1 file changed, 97 insertions(+), 32 deletions(-)
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
index a8390a04..413a5a37 100644
--- a/src/udiskslinuxfilesystem.c
+++ b/src/udiskslinuxfilesystem.c
@@ -56,6 +56,7 @@
#include "udiskssimplejob.h"
#include "udiskslinuxdriveata.h"
#include "udiskslinuxmountoptions.h"
+#include "udisksata.h"
/**
* SECTION:udiskslinuxfilesystem
@@ -78,6 +79,10 @@ struct _UDisksLinuxFilesystem
{
UDisksFilesystemSkeleton parent_instance;
GMutex lock;
+ guint64 cached_fs_size;
+ gchar *cached_device_file;
+ gchar *cached_fs_type;
+ gboolean cached_drive_is_ata;
};
struct _UDisksLinuxFilesystemClass
@@ -85,7 +90,14 @@ struct _UDisksLinuxFilesystemClass
UDisksFilesystemSkeletonClass parent_class;
};
+enum
+{
+ PROP_0,
+ PROP_SIZE,
+};
+
static void filesystem_iface_init (UDisksFilesystemIface *iface);
+static guint64 get_filesystem_size (UDisksLinuxFilesystem *filesystem);
G_DEFINE_TYPE_WITH_CODE (UDisksLinuxFilesystem, udisks_linux_filesystem, UDISKS_TYPE_FILESYSTEM_SKELETON,
G_IMPLEMENT_INTERFACE (UDISKS_TYPE_FILESYSTEM, filesystem_iface_init));
@@ -106,6 +118,8 @@ udisks_linux_filesystem_finalize (GObject *object)
UDisksLinuxFilesystem *filesystem = UDISKS_LINUX_FILESYSTEM (object);
g_mutex_clear (&(filesystem->lock));
+ g_free (filesystem->cached_device_file);
+ g_free (filesystem->cached_fs_type);
if (G_OBJECT_CLASS (udisks_linux_filesystem_parent_class)->finalize != NULL)
G_OBJECT_CLASS (udisks_linux_filesystem_parent_class)->finalize (object);
@@ -119,6 +133,44 @@ udisks_linux_filesystem_init (UDisksLinuxFilesystem *filesystem)
G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD);
}
+static void
+udisks_linux_filesystem_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ UDisksLinuxFilesystem *filesystem = UDISKS_LINUX_FILESYSTEM (object);
+
+ switch (prop_id)
+ {
+ case PROP_SIZE:
+ g_value_set_uint64 (value, get_filesystem_size (filesystem));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+udisks_linux_filesystem_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (prop_id)
+ {
+ case PROP_SIZE:
+ g_warning ("udisks_linux_filesystem_set_property() should never be called, value = %lu", g_value_get_uint64 (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static void
udisks_linux_filesystem_class_init (UDisksLinuxFilesystemClass *klass)
{
@@ -126,6 +178,10 @@ udisks_linux_filesystem_class_init (UDisksLinuxFilesystemClass *klass)
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = udisks_linux_filesystem_finalize;
+ gobject_class->get_property = udisks_linux_filesystem_get_property;
+ gobject_class->set_property = udisks_linux_filesystem_set_property;
+
+ g_object_class_override_property (gobject_class, PROP_SIZE, "size");
}
/**
@@ -144,49 +200,58 @@ udisks_linux_filesystem_new (void)
/* ---------------------------------------------------------------------------------------------------- */
+/* WARNING: called with GDBusObjectManager lock held, avoid any object lookup */
static guint64
-get_filesystem_size (UDisksLinuxBlockObject *object)
+get_filesystem_size (UDisksLinuxFilesystem *filesystem)
{
guint64 size = 0;
- UDisksLinuxDevice *device;
- gchar *dev;
- const gchar *type;
GError *error = NULL;
- device = udisks_linux_block_object_get_device (object);
- dev = udisks_linux_block_object_get_device_file (object);
- type = g_udev_device_get_property (device->udev_device, "ID_FS_TYPE");
+ if (!filesystem->cached_device_file || !filesystem->cached_fs_type)
+ return 0;
+
+ /* if the drive is ATA and is sleeping, skip filesystem size check to prevent
+ * drive waking up - nothing has changed anyway since it's been sleeping...
+ */
+ if (filesystem->cached_drive_is_ata)
+ {
+ guchar pm_state = 0;
+
+ if (udisks_ata_get_pm_state (filesystem->cached_device_file, NULL, &pm_state))
+ if (!UDISKS_ATA_PM_STATE_AWAKE (pm_state) && filesystem->cached_fs_size > 0)
+ return filesystem->cached_fs_size;
+ }
- if (g_strcmp0 (type, "ext2") == 0)
+ if (g_strcmp0 (filesystem->cached_fs_type, "ext2") == 0)
{
- BDFSExt2Info *info = bd_fs_ext2_get_info (dev, &error);
+ BDFSExt2Info *info = bd_fs_ext2_get_info (filesystem->cached_device_file, &error);
if (info)
{
size = info->block_size * info->block_count;
bd_fs_ext2_info_free (info);
}
}
- else if (g_strcmp0 (type, "ext3") == 0)
+ else if (g_strcmp0 (filesystem->cached_fs_type, "ext3") == 0)
{
- BDFSExt3Info *info = bd_fs_ext3_get_info (dev, &error);
+ BDFSExt3Info *info = bd_fs_ext3_get_info (filesystem->cached_device_file, &error);
if (info)
{
size = info->block_size * info->block_count;
bd_fs_ext3_info_free (info);
}
}
- else if (g_strcmp0 (type, "ext4") == 0)
+ else if (g_strcmp0 (filesystem->cached_fs_type, "ext4") == 0)
{
- BDFSExt4Info *info = bd_fs_ext4_get_info (dev, &error);
+ BDFSExt4Info *info = bd_fs_ext4_get_info (filesystem->cached_device_file, &error);
if (info)
{
size = info->block_size * info->block_count;
bd_fs_ext4_info_free (info);
}
}
- else if (g_strcmp0 (type, "xfs") == 0)
+ else if (g_strcmp0 (filesystem->cached_fs_type, "xfs") == 0)
{
- BDFSXfsInfo *info = bd_fs_xfs_get_info (dev, &error);
+ BDFSXfsInfo *info = bd_fs_xfs_get_info (filesystem->cached_device_file, &error);
if (info)
{
size = info->block_size * info->block_count;
@@ -194,10 +259,9 @@ get_filesystem_size (UDisksLinuxBlockObject *object)
}
}
- g_free (dev);
- g_object_unref (device);
g_clear_error (&error);
+ filesystem->cached_fs_size = size;
return size;
}
@@ -234,14 +298,12 @@ void
udisks_linux_filesystem_update (UDisksLinuxFilesystem *filesystem,
UDisksLinuxBlockObject *object)
{
+ UDisksDriveAta *ata = NULL;
UDisksMountMonitor *mount_monitor;
UDisksLinuxDevice *device;
- UDisksDriveAta *ata = NULL;
GPtrArray *p;
GList *mounts;
GList *l;
- gboolean skip_fs_size = FALSE;
- guchar pm_state;
mount_monitor = udisks_daemon_get_mount_monitor (udisks_linux_block_object_get_daemon (object));
device = udisks_linux_block_object_get_device (object);
@@ -263,20 +325,24 @@ udisks_linux_filesystem_update (UDisksLinuxFilesystem *filesystem,
g_ptr_array_free (p, TRUE);
g_list_free_full (mounts, g_object_unref);
- /* if the drive is ATA and is sleeping, skip filesystem size check to prevent
- * drive waking up - nothing has changed anyway since it's been sleeping...
+ /* cached device properties for on-demand filesystem size retrieval */
+ g_free (filesystem->cached_device_file);
+ g_free (filesystem->cached_fs_type);
+ filesystem->cached_fs_type = g_strdup (g_udev_device_get_property (device->udev_device, "ID_FS_TYPE"));
+ if (g_strcmp0 (filesystem->cached_fs_type, "ext2") == 0 ||
+ g_strcmp0 (filesystem->cached_fs_type, "ext3") == 0 ||
+ g_strcmp0 (filesystem->cached_fs_type, "ext4") == 0 ||
+ g_strcmp0 (filesystem->cached_fs_type, "xfs") == 0)
+ filesystem->cached_device_file = udisks_linux_block_object_get_device_file (object);
+
+ /* TODO: this only looks for a drive object associated with the current
+ * block object. In case of a complex layered structure this needs to walk
+ * the tree and return a list of physical drives to check the powermanagement on.
*/
ata = get_drive_ata (object);
- if (ata != NULL)
- {
- if (udisks_linux_drive_ata_get_pm_state (UDISKS_LINUX_DRIVE_ATA (ata), NULL, &pm_state))
- skip_fs_size = ! UDISKS_LINUX_DRIVE_ATA_IS_AWAKE (pm_state);
- }
+ filesystem->cached_drive_is_ata = ata != NULL && udisks_drive_ata_get_pm_supported (ata);
g_clear_object (&ata);
- if (! skip_fs_size)
- udisks_filesystem_set_size (UDISKS_FILESYSTEM (filesystem), get_filesystem_size (object));
-
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (filesystem));
g_object_unref (device);
@@ -1872,10 +1938,9 @@ handle_resize (UDisksFilesystem *filesystem,
/* At least resize2fs might need another uevent after it is done.
*/
+ UDISKS_LINUX_FILESYSTEM (filesystem)->cached_fs_size = 0;
udisks_linux_block_object_trigger_uevent_sync (UDISKS_LINUX_BLOCK_OBJECT (object),
UDISKS_DEFAULT_WAIT_TIMEOUT);
-
- udisks_filesystem_set_size (filesystem, get_filesystem_size (UDISKS_LINUX_BLOCK_OBJECT (object)));
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (filesystem));
udisks_filesystem_complete_resize (filesystem, invocation);
udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), TRUE, NULL);
--
2.38.1

View File

@ -1,77 +0,0 @@
From d205057296957d6064825252a3d3377e809d6fed Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Wed, 6 Oct 2021 17:12:13 +0200
Subject: [PATCH] udiskslinuxmountoptions: Do not free static daemon resources
The GResource instance returned from udisks_daemon_resources_get_resource()
that calls g_static_resource_get_resource() internally is marked as
'(transfer none)' and should not be freed. In fact that causes double
free inside the g_static_resource_fini() atexit handler leading
to memory corruption causing random failures of further atexit
handlers such as cryptsetup and openssl destructors.
Invalid read of size 4
at 0x4BB03A4: g_resource_unref (gresource.c:527)
by 0x4BB2150: g_static_resource_fini (gresource.c:1449)
by 0x4010ADB: _dl_fini (dl-fini.c:139)
by 0x4EF0DF4: __run_exit_handlers (exit.c:113)
by 0x4EF0F6F: exit (exit.c:143)
by 0x4ED9566: __libc_start_call_main (libc_start_call_main.h:74)
by 0x4ED960B: __libc_start_main@@GLIBC_2.34 (libc-start.c:409)
by 0x128774: (below main) (in udisks/src/.libs/udisksd)
Address 0x5cc5fc0 is 0 bytes inside a block of size 16 free'd
at 0x48430E4: free (vg_replace_malloc.c:755)
by 0x4DB10BC: g_free (gmem.c:199)
by 0x4BB2148: g_static_resource_fini (gresource.c:1448)
by 0x4010ADB: _dl_fini (dl-fini.c:139)
by 0x4EF0DF4: __run_exit_handlers (exit.c:113)
by 0x4EF0F6F: exit (exit.c:143)
by 0x4ED9566: __libc_start_call_main (libc_start_call_main.h:74)
by 0x4ED960B: __libc_start_main@@GLIBC_2.34 (libc-start.c:409)
by 0x128774: (below main) (in udisks/src/.libs/udisksd)
Block was alloc'd at
at 0x484086F: malloc (vg_replace_malloc.c:380)
by 0x4DB47A8: g_malloc (gmem.c:106)
by 0x4BB19C7: UnknownInlinedFun (gresource.c:545)
by 0x4BB19C7: g_resource_new_from_data (gresource.c:613)
by 0x4BB1A88: register_lazy_static_resources_unlocked (gresource.c:1374)
by 0x4BB218C: UnknownInlinedFun (gresource.c:1393)
by 0x4BB218C: UnknownInlinedFun (gresource.c:1387)
by 0x4BB218C: g_static_resource_get_resource (gresource.c:1472)
by 0x14F6A3: UnknownInlinedFun (udisks-daemon-resources.c:284)
by 0x14F6A3: udisks_linux_mount_options_get_builtin (udiskslinuxmountoptions.c:612)
by 0x12CC6E: udisks_daemon_constructed (udisksdaemon.c:441)
by 0x4D1ED96: g_object_new_internal (gobject.c:1985)
by 0x4D20227: g_object_new_valist (gobject.c:2288)
by 0x4D2075C: g_object_new (gobject.c:1788)
by 0x129A5F: udisks_daemon_new (udisksdaemon.c:619)
by 0x129AD5: on_bus_acquired (main.c:63)
by 0x4C35C95: connection_get_cb.lto_priv.0 (gdbusnameowning.c:504)
by 0x4BD3F99: g_task_return_now (gtask.c:1219)
by 0x4BD419A: UnknownInlinedFun (gtask.c:1289)
by 0x4BD419A: g_task_return (gtask.c:1245)
by 0x4C31D51: bus_get_async_initable_cb (gdbusconnection.c:7433)
by 0x4BD3F99: g_task_return_now (gtask.c:1219)
by 0x4BD3FDC: complete_in_idle_cb (gtask.c:1233)
by 0x4DA852A: g_idle_dispatch (gmain.c:5897)
by 0x4DAC33E: UnknownInlinedFun (gmain.c:3381)
by 0x4DAC33E: g_main_context_dispatch (gmain.c:4099)
---
src/udiskslinuxmountoptions.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/udiskslinuxmountoptions.c b/src/udiskslinuxmountoptions.c
index 7729d401..819c9ba9 100644
--- a/src/udiskslinuxmountoptions.c
+++ b/src/udiskslinuxmountoptions.c
@@ -614,7 +614,6 @@ udisks_linux_mount_options_get_builtin (void)
"/org/freedesktop/UDisks2/data/builtin_mount_options.conf",
G_RESOURCE_LOOKUP_FLAGS_NONE,
&error);
- g_resource_unref (daemon_resource);
if (builtin_opts_bytes == NULL)
{
--
2.38.1

View File

@ -1,115 +0,0 @@
From ec380135ed8cf57a70501542081dad51d2d11fa8 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 6 Jan 2022 20:45:45 +0100
Subject: [PATCH] udiskslinuxprovider: Only update related objects on utab
changes
Updating all existing block objects on any utab change
was unnecessary and overly expensive. With the UDisksUtabMonitor
providing specific utab entry, update just block objects
with matching device file.
Note that there is a room for similar optimization in fstab
and crypttab monitoring.
---
src/udiskslinuxprovider.c | 33 ++++++++++++++++++++++++++-------
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/src/udiskslinuxprovider.c b/src/udiskslinuxprovider.c
index cfc6a330..4231a33c 100644
--- a/src/udiskslinuxprovider.c
+++ b/src/udiskslinuxprovider.c
@@ -39,6 +39,7 @@
#include "udisksmoduleobject.h"
#include "udisksdaemonutil.h"
#include "udisksconfigmanager.h"
+#include "udisksutabentry.h"
/**
* SECTION:udiskslinuxprovider
@@ -1559,7 +1560,7 @@ on_housekeeping_timeout (gpointer user_data)
/* ---------------------------------------------------------------------------------------------------- */
static void
-update_all_block_objects (UDisksLinuxProvider *provider)
+update_block_objects (UDisksLinuxProvider *provider, const gchar *device_path)
{
GList *objects;
GList *l;
@@ -1572,18 +1573,36 @@ update_all_block_objects (UDisksLinuxProvider *provider)
for (l = objects; l != NULL; l = l->next)
{
UDisksLinuxBlockObject *object = UDISKS_LINUX_BLOCK_OBJECT (l->data);
- udisks_linux_block_object_uevent (object, "change", NULL);
+
+ if (device_path == NULL)
+ udisks_linux_block_object_uevent (object, "change", NULL);
+ else
+ {
+ gchar *block_dev;
+ gboolean match;
+
+ block_dev = udisks_linux_block_object_get_device_file (object);
+ match = g_strcmp0 (block_dev, device_path) == 0;
+ g_free (block_dev);
+ if (match)
+ {
+ udisks_linux_block_object_uevent (object, "change", NULL);
+ break;
+ }
+ }
}
g_list_free_full (objects, g_object_unref);
}
+/* fstab monitoring */
static void
mount_monitor_on_mountpoints_changed (GUnixMountMonitor *monitor,
gpointer user_data)
{
UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data);
- update_all_block_objects (provider);
+ /* TODO: compare differences and only update relevant objects */
+ update_block_objects (provider, NULL);
}
static void
@@ -1592,7 +1611,7 @@ crypttab_monitor_on_entry_added (UDisksCrypttabMonitor *monitor,
gpointer user_data)
{
UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data);
- update_all_block_objects (provider);
+ update_block_objects (provider, NULL);
}
static void
@@ -1601,7 +1620,7 @@ crypttab_monitor_on_entry_removed (UDisksCrypttabMonitor *monitor,
gpointer user_data)
{
UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data);
- update_all_block_objects (provider);
+ update_block_objects (provider, NULL);
}
#ifdef HAVE_LIBMOUNT_UTAB
@@ -1611,7 +1630,7 @@ utab_monitor_on_entry_added (UDisksUtabMonitor *monitor,
gpointer user_data)
{
UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data);
- update_all_block_objects (provider);
+ update_block_objects (provider, udisks_utab_entry_get_source (entry));
}
static void
@@ -1620,6 +1639,6 @@ utab_monitor_on_entry_removed (UDisksUtabMonitor *monitor,
gpointer user_data)
{
UDisksLinuxProvider *provider = UDISKS_LINUX_PROVIDER (user_data);
- update_all_block_objects (provider);
+ update_block_objects (provider, udisks_utab_entry_get_source (entry));
}
#endif
--
2.38.1

View File

@ -1,16 +0,0 @@
Index: udisks-2.9.4/modules/zram/data/udisks2-zram-setup@.service.in
===================================================================
--- udisks-2.9.4.orig/modules/zram/data/udisks2-zram-setup@.service.in
+++ udisks-2.9.4/modules/zram/data/udisks2-zram-setup@.service.in
@@ -5,6 +5,11 @@ After=dev-%i.device
Requires=dev-%i.device
[Service]
+# added automatically, for details please see
+# https://en.opensuse.org/openSUSE:Security_Features#Systemd_hardening_effort
+ProtectHostname=true
+RestrictRealtime=true
+# end of automatic additions
Type=oneshot
RemainAfterExit=no
EnvironmentFile=-@zramconfdir@/%i

3
udisks-2.10.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4f5a7a592526f7f32795a1f2211c67b9a649ab40386752f9a71ebaa2fc2090bc
size 1784010

BIN
udisks-2.9.4.tar.bz2 (Stored with Git LFS)

Binary file not shown.

View File

@ -1,3 +1,62 @@
-------------------------------------------------------------------
Wed Aug 16 23:33:19 UTC 2023 - Luciano Santos <luc14n0@opensuse.org>
- Update to version 2.10.0:
+ This release brings large number of internal changes, while
keeping the promise of API stability. This development cycle
was mostly driven by libblockdev 3.0 API overhaul.
+ Partitioning was ported to libfdisk.
+ The kbd and vdo libblockdev plugins were removed and so were
zram, bcache and vdo udisks modules.
+ Definition of supported filesystems was moved to libblockdev
and filesystem operations were unified.
+ Native NVMe support has been added through libnvme.
+ Syntax of configurable mount options was extended to separate
filesystem signature and filesystem driver used for mounting.
+ A number of workarounds was placed around the
org.freedesktop.UDisks2.Filesystem.Size property value
retrieval to avoid excessive I/O traffic whenever possible.
+ Bash and Zsh completion enhancements.
+ lvm2 module uevent handling improvements.
+ ATA Secure Erase is now allowed only on top-level block
objects.
+ Extra iSCSI node parameters are now honoured properly.
+ FIPS mode fixes.
+ Added support for resolving devices by PARTLABEL and PARTUUID.
+ Full support for setting filesystem and partition UUIDs.
+ Dynamic mountpoint name sanitization and ACL fixes.
+ Added support for LVM2 RAID.
+ UUID of Bitlocker volumes is now properly exposed.
+ Added an option to force/avoid creation of mdraid write-intent
bitmap.
+ Updated translations.
- Drop default_luks_encryption macro definition. It's no longer
needed as upstream defaults to LUKS2 now.
- Drop bcache, vdo and zram sub-packages, following upstream
changes, and libblockdev-kbd(-devel) BuildRequires/Requires.
- Drop bogus build requirement on libblockdev-lvm-dbus-devel, and
move libblockdev-lvm-devel BuildRequires to the lvm2 module
sub-package.
- Move libconfig and libstoragemgmt pkgconfig() BuildRequires to
the lsm module sub-package, and libblockdev-btrfs-devel
BuildRequires to the btrfs modules sub-package, which is where
they belong.
- Add libblockdev-nvme-devel BuildRequires and libblockdev-nvme
Requires as new required dependencies.
- Drop harden_udisks2-zram-setup@.service.patch: It's unneeded now
that the zram module has been deprecated.
- Drop merged upstream patches:
0001-udisksata-Move-the-low-level-PM-state-call.patch,
0001-udiskslinuxfilesystem-Make-the-size-property-retriev.patch,
0001-udiskslinuxmountoptions-Do-not-free-static-daemon-re.patch,
0001-udiskslinuxprovider-Only-update-related-objects-on-u.patch.
- Split Bash and Zsh (new to this release) completion scripts to
sub-packages of their own.
- Amend GPL-2.0-or-later License tags to LGPL-2.0-or-later for the
btrfs, lvm2 and lsm UDisks modules sub-packages. This correction
is based on what's explicitly stated on the source code from
UDisks modules' folders under the modules/ top-level directory.
-------------------------------------------------------------------
Tue Nov 22 08:21:22 UTC 2022 - Thomas Blume <thomas.blume@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package udisks2
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,38 +16,29 @@
#
%define somajor 0
%define libudisks lib%{name}-%{somajor}
%define libblockdev_version 2.19
# valid options are 'luks1' or 'luks2' - Note, remove this and the sed call, as upstream moves to luks2 as default
%define default_luks_encryption luks2
%define soversion 0
%define libblockdev_version 3.0
Name: udisks2
Version: 2.9.4
Version: 2.10.0
Release: 0
Summary: Disk Manager
License: GPL-2.0-or-later AND LGPL-2.0-or-later
Group: System/Daemons
URL: https://github.com/storaged-project/udisks
Source0: %{url}/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2
Patch0: harden_udisks2-zram-setup@.service.patch
Patch1: harden_udisks2.service.patch
Patch2: 0001-udiskslinuxmountoptions-Do-not-free-static-daemon-re.patch
Patch3: 0001-udisksata-Move-the-low-level-PM-state-call.patch
Patch4: 0001-udiskslinuxfilesystem-Make-the-size-property-retriev.patch
Patch5: 0001-udiskslinuxprovider-Only-update-related-objects-on-u.patch
Patch0: harden_udisks2.service.patch
BuildRequires: chrpath
BuildRequires: docbook-xsl-stylesheets
BuildRequires: gobject-introspection-devel >= 0.6.2
BuildRequires: libacl-devel
BuildRequires: libblockdev-btrfs-devel >= %{libblockdev_version}
BuildRequires: libblockdev-crypto-devel >= %{libblockdev_version}
BuildRequires: libblockdev-fs-devel >= %{libblockdev_version}
BuildRequires: libblockdev-kbd-devel >= %{libblockdev_version}
BuildRequires: libblockdev-loop-devel >= %{libblockdev_version}
BuildRequires: libblockdev-lvm-dbus-devel >= %{libblockdev_version}
BuildRequires: libblockdev-lvm-devel >= %{libblockdev_version}
BuildRequires: libblockdev-mdraid-devel >= %{libblockdev_version}
BuildRequires: libblockdev-nvme-devel >= %{libblockdev_version}
BuildRequires: libblockdev-part-devel >= %{libblockdev_version}
BuildRequires: libblockdev-swap-devel >= %{libblockdev_version}
BuildRequires: lvm2-devel
@ -60,8 +51,6 @@ BuildRequires: pkgconfig(glib-2.0) >= 2.50
BuildRequires: pkgconfig(gmodule-2.0)
BuildRequires: pkgconfig(gudev-1.0) >= 165
BuildRequires: pkgconfig(libatasmart) >= 0.17
BuildRequires: pkgconfig(libconfig) >= 1.3.2
BuildRequires: pkgconfig(libstoragemgmt) >= 1.3.0
BuildRequires: pkgconfig(libsystemd) >= 209
BuildRequires: pkgconfig(mount) >= 2.30
BuildRequires: pkgconfig(polkit-agent-1) >= 0.102
@ -69,7 +58,8 @@ BuildRequires: pkgconfig(polkit-gobject-1) >= 0.102
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(uuid)
Requires: %{libudisks} = %{version}
Requires: libudisks2-%{soversion} = %{version}
# For LUKS devices
Requires: cryptsetup
# Needed to pull in the system bus daemon
@ -89,6 +79,7 @@ Requires: libblockdev-crypto >= %{libblockdev_version}
Requires: libblockdev-fs >= %{libblockdev_version}
Requires: libblockdev-loop >= %{libblockdev_version}
Requires: libblockdev-mdraid >= %{libblockdev_version}
Requires: libblockdev-nvme >= %{libblockdev_version}
Requires: libblockdev-part >= %{libblockdev_version}
Requires: libblockdev-swap >= %{libblockdev_version}
# Needed to pull in the udev daemon
@ -97,7 +88,8 @@ Requires: udev >= 208
Requires: util-linux
# For mkfs.xfs, xfs_admin
Requires: xfsprogs
Recommends: %{libudisks}_btrfs
Recommends: libudisks2-%{soversion}_btrfs
# Add Obsoletes to ease removal of deprecated standalone vdo module
Obsoletes: libudisks2-0_vdo <= 2.9.4
%{?systemd_requires}
@ -110,12 +102,12 @@ Obsoletes: libudisks2-0_vdo <= 2.9.4
The Udisks project provides a daemon, tools and libraries to access and
manipulate disks, storage devices and technologies.
%package -n %{libudisks}
%package -n libudisks2-%{soversion}
Summary: Dynamic library to access the UDisksd daemon
License: LGPL-2.0-or-later
Group: System/Libraries
%description -n %{libudisks}
%description -n libudisks2-%{soversion}
This package contains the dynamic library, which provides
access to the UDisksd daemon.
@ -131,13 +123,13 @@ for managing disks and storage devices.
This package provides the GObject Introspection bindings for
the UDisks client library.
%package -n %{libudisks}-devel
%package -n libudisks2-%{soversion}-devel
Summary: Development files for UDisks
License: LGPL-2.0-or-later
Group: Development/Libraries/C and C++
Requires: %{libudisks} >= %{version}
Requires: libudisks2-%{soversion} >= %{version}
%description -n %{libudisks}-devel
%description -n libudisks2-%{soversion}-devel
This package contains the development files for the library libUDisks2, a
dynamic library, which provides access to the UDisksd daemon.
@ -148,77 +140,76 @@ BuildArch: noarch
%description docs
This package contains developer documentation for %{name}.
%package -n %{libudisks}_bcache
Summary: UDisks module for Bcache
License: GPL-2.0-or-later
Group: System/Libraries
Requires: %{libudisks} >= %{version}
Requires: libblockdev-kbd >= %{libblockdev_version}
%description -n %{libudisks}_bcache
This package contains the UDisks module for bcache support.
%package -n %{libudisks}_btrfs
%package -n libudisks2-%{soversion}_btrfs
Summary: UDisks module for btrfs
License: GPL-2.0-or-later
License: LGPL-2.0-or-later
Group: System/Libraries
Requires: %{libudisks} >= %{version}
BuildRequires: libblockdev-btrfs-devel >= %{libblockdev_version}
Requires: libblockdev-btrfs >= %{libblockdev_version}
Requires: libudisks2-%{soversion} >= %{version}
%description -n %{libudisks}_btrfs
%description -n libudisks2-%{soversion}_btrfs
This package contains the UDisks module for btrfs support.
%package -n %{libudisks}_lsm
%package -n libudisks2-%{soversion}_lsm
Summary: UDisks module for LSM
License: GPL-2.0-or-later
License: LGPL-2.0-or-later
Group: System/Libraries
Requires: %{libudisks} >= %{version}
BuildRequires: pkgconfig(libconfig) >= 1.3.2
BuildRequires: pkgconfig(libstoragemgmt) >= 1.3.0
Requires: libstoragemgmt >= 1.3.0
Requires: libudisks2-%{soversion} >= %{version}
%description -n %{libudisks}_lsm
%description -n libudisks2-%{soversion}_lsm
This package contains the UDisks module for LSM support.
%package -n %{libudisks}_lvm2
%package -n libudisks2-%{soversion}_lvm2
Summary: UDisks module for LVM2
License: GPL-2.0-or-later
License: LGPL-2.0-or-later
Group: System/Libraries
Requires: %{libudisks} >= %{version}
BuildRequires: libblockdev-lvm-devel >= %{libblockdev_version}
Requires: libblockdev-lvm >= %{libblockdev_version}
Requires: libudisks2-%{soversion} >= %{version}
Requires: lvm2
%description -n %{libudisks}_lvm2
%description -n libudisks2-%{soversion}_lvm2
This package contains the UDisks module for LVM2 support.
%package -n %{libudisks}_zram
Summary: UDisks module for Zram
License: GPL-2.0-or-later
Group: System/Libraries
Requires: %{libudisks} = %{version}
Requires: libblockdev-kbd >= %{libblockdev_version}
Requires: libblockdev-swap >= %{libblockdev_version}
%package bash-completion
Summary: Bash Completion for udisksctl
BuildRequires: bash-completion
Requires: %{name} = %{version}
Requires: bash-completion
Supplements: (%{name} and bash-completion)
BuildArch: noarch
%description -n %{libudisks}_zram
This package contains the UDisks module for zram support.
%description bash-completion
Bash command line completion support for the udisksctl command.
%package zsh-completion
Summary: Zsh Completion for udisksctl
BuildRequires: zsh
Requires: %{name} = %{version}
Requires: zsh
Supplements: (%{name} and zsh)
BuildArch: noarch
%description zsh-completion
Zsh command line completion support for the udisksctl command.
%lang_package
%prep
%autosetup -p1 -n udisks-%{version}
# Move to luks2 as default
sed -i udisks/udisks2.conf.in -e "s/encryption=luks1/encryption=%{default_luks_encryption}/"
%build
%configure \
--disable-static \
--disable-gtk-doc \
--docdir=%{_docdir}/%{name} \
--enable-bcache \
--enable-btrfs \
--enable-lsm \
--enable-lvm2 \
--enable-lvmcache \
--enable-zram \
--disable-vdo \
%{nil}
%make_build
@ -236,10 +227,11 @@ ln -sf %{_sbindir}/service %{buildroot}/%{_sbindir}/rc%{name}
# Move example config file to docs
mkdir -p %{buildroot}%{_docdir}/%{name}
mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example %{buildroot}%{_docdir}/%{name}/mount_options.conf.example
mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example \
%{buildroot}%{_docdir}/%{name}/mount_options.conf.example
%post -n %{libudisks} -p /sbin/ldconfig
%postun -n %{libudisks} -p /sbin/ldconfig
%post -n libudisks2-%{soversion} -p /sbin/ldconfig
%postun -n libudisks2-%{soversion} -p /sbin/ldconfig
%pre -n %{name}
%service_add_pre udisks2.service
@ -255,18 +247,6 @@ mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example %{buildroot}
%postun -n %{name}
%service_del_postun udisks2.service
%pre -n %{libudisks}_zram
%service_add_pre udisks2-zram-setup@.service
%post -n %{libudisks}_zram
%service_add_post udisks2-zram-setup@.service
%preun -n %{libudisks}_zram
%service_del_preun udisks2-zram-setup@.service
%postun -n %{libudisks}_zram
%service_del_postun udisks2-zram-setup@.service
%files
%doc AUTHORS NEWS
%{_bindir}/udisksctl
@ -277,11 +257,9 @@ mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example %{buildroot}
%doc %{_docdir}/%{name}/mount_options.conf.example
%{_tmpfilesdir}/udisks2.conf
%ghost %{_rundir}/media
%{_datadir}/bash-completion/completions/udisksctl
%{_unitdir}/udisks2.service
%dir %{_udevrulesdir}
%{_udevrulesdir}/80-udisks2.rules
%{_udevrulesdir}/90-udisks2-zram.rules
%{_sbindir}/rc%{name}
%{_sbindir}/umount.udisks2
%dir %{_libexecdir}/udisks2
@ -297,43 +275,35 @@ mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example %{buildroot}
# about e.g. mounts to unprivileged users
%attr(0700,root,root) %dir %{_localstatedir}/lib/udisks2
%files -n %{libudisks}
%files -n libudisks2-%{soversion}
%license COPYING
%{_libdir}/libudisks2.so.*
%files -n typelib-1_0-UDisks-2_0
%{_libdir}/girepository-1.0/UDisks-2.0.typelib
%files -n %{libudisks}-devel
%files -n libudisks2-%{soversion}-devel
%doc HACKING README.md
%{_libdir}/libudisks2.so
%dir %{_includedir}/udisks2
%dir %{_includedir}/udisks2/udisks
%{_includedir}/udisks2/udisks/*.h
%{_libdir}/pkgconfig/udisks2.pc
%{_libdir}/pkgconfig/udisks2-bcache.pc
%{_libdir}/pkgconfig/udisks2-btrfs.pc
%{_libdir}/pkgconfig/udisks2-lsm.pc
%{_libdir}/pkgconfig/udisks2-lvm2.pc
%{_libdir}/pkgconfig/udisks2-zram.pc
%{_datadir}/gir-1.0/UDisks-2.0.gir
%files docs
%doc %{_datadir}/gtk-doc/html/udisks2/
%files -n %{libudisks}_bcache
%dir %{_libdir}/udisks2
%dir %{_libdir}/udisks2/modules
%{_libdir}/udisks2/modules/libudisks2_bcache.so
%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.bcache.policy
%files -n %{libudisks}_btrfs
%files -n libudisks2-%{soversion}_btrfs
%dir %{_libdir}/udisks2
%dir %{_libdir}/udisks2/modules
%{_libdir}/udisks2/modules/libudisks2_btrfs.so
%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.btrfs.policy
%files -n %{libudisks}_lsm
%files -n libudisks2-%{soversion}_lsm
%dir %{_sysconfdir}/udisks2/modules.conf.d
%attr(0600,root,root) %config %{_sysconfdir}/udisks2/modules.conf.d/udisks2_lsm.conf
%dir %{_libdir}/udisks2
@ -342,18 +312,18 @@ mv -v %{buildroot}%{_sysconfdir}/udisks2/mount_options.conf.example %{buildroot}
%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.lsm.policy
%{_mandir}/man5/udisks2_lsm.conf.5%{?ext_man}
%files -n %{libudisks}_lvm2
%files -n libudisks2-%{soversion}_lvm2
%dir %{_libdir}/udisks2
%dir %{_libdir}/udisks2/modules
%{_libdir}/udisks2/modules/libudisks2_lvm2.so
%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.lvm2.policy
%files -n %{libudisks}_zram
%dir %{_libdir}/udisks2
%dir %{_libdir}/udisks2/modules
%{_libdir}/udisks2/modules/libudisks2_zram.so
%{_datadir}/polkit-1/actions/org.freedesktop.UDisks2.zram.policy
%{_unitdir}/udisks2-zram-setup@.service
%files bash-completion
%{_datadir}/bash-completion/completions/udisksctl
%files zsh-completion
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_udisks2
%files lang -f udisks2.lang