Compare commits
10 Commits
0ab5ed9f2f
...
8e9986c28a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e9986c28a | ||
|
|
0cb1c3a918 | ||
|
|
e639d16328 | ||
|
|
6014e72690 | ||
|
|
b4296214d6 | ||
|
|
f735492250 | ||
|
|
77ce6fad94 | ||
|
|
74802ec94f | ||
|
|
c8394e147d | ||
|
|
7cad1fd422 |
@ -0,0 +1,74 @@
|
||||
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 7729d40159..819c9ba96a 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)
|
||||
{
|
||||
@ -1,33 +0,0 @@
|
||||
From e30be251c101ca17e16648f703af224459601498 Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Bzatek <tbzatek@redhat.com>
|
||||
Date: Wed, 27 May 2020 14:16:44 +0200
|
||||
Subject: [PATCH 349/363] udiskslinuxmountoptions: Prevent a memory leak
|
||||
|
||||
Absolutely improbable scenario though.
|
||||
---
|
||||
src/udiskslinuxmountoptions.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/udiskslinuxmountoptions.c b/src/udiskslinuxmountoptions.c
|
||||
index 1071e29a..c9368560 100644
|
||||
--- a/src/udiskslinuxmountoptions.c
|
||||
+++ b/src/udiskslinuxmountoptions.c
|
||||
@@ -259,12 +259,12 @@ compute_mount_options_for_fs_type (UDisksDaemon *daemon,
|
||||
|
||||
config_manager = udisks_daemon_get_config_manager (daemon);
|
||||
|
||||
- fsmo = g_malloc0 (sizeof (FSMountOptions));
|
||||
- fsmo_any = g_malloc0 (sizeof (FSMountOptions));
|
||||
-
|
||||
/* Builtin options, two-level hashtable */
|
||||
builtin_opts = g_object_get_data (G_OBJECT (daemon), "mount-options");
|
||||
g_return_val_if_fail (builtin_opts != NULL, NULL);
|
||||
+
|
||||
+ fsmo = g_malloc0 (sizeof (FSMountOptions));
|
||||
+ fsmo_any = g_malloc0 (sizeof (FSMountOptions));
|
||||
compute_block_level_mount_options (builtin_opts, block, fstype, fsmo, fsmo_any);
|
||||
|
||||
/* Global config file overrides, two-level hashtable */
|
||||
--
|
||||
2.21.1 (Apple Git-122.3)
|
||||
|
||||
@ -1,79 +0,0 @@
|
||||
From 7c23020e3b6931395f85a08f6ab2b764a5625e43 Mon Sep 17 00:00:00 2001
|
||||
From: Vojtech Trefny <vtrefny@redhat.com>
|
||||
Date: Tue, 29 Sep 2020 13:00:53 +0200
|
||||
Subject: [PATCH 30/30] Memory leak fixes
|
||||
|
||||
Fixes for leaks found by new version of coverity.
|
||||
---
|
||||
modules/zram/udiskszramutil.c | 3 +++
|
||||
src/udiskslinuxdriveata.c | 1 +
|
||||
src/udiskslinuxfilesystem.c | 2 +-
|
||||
tools/udisksctl.c | 2 ++
|
||||
4 files changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/zram/udiskszramutil.c b/modules/zram/udiskszramutil.c
|
||||
index 96b2d66..2c64eb9 100644
|
||||
--- a/modules/zram/udiskszramutil.c
|
||||
+++ b/modules/zram/udiskszramutil.c
|
||||
@@ -95,8 +95,11 @@ set_conf_property (char *filename,
|
||||
if (rename (tmpfname, filename))
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno),"%m");
|
||||
+ g_free (tmpfname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+ g_free (tmpfname);
|
||||
+
|
||||
return TRUE;
|
||||
}
|
||||
diff --git a/src/udiskslinuxdriveata.c b/src/udiskslinuxdriveata.c
|
||||
index 4ba66d0..f4e848c 100644
|
||||
--- a/src/udiskslinuxdriveata.c
|
||||
+++ b/src/udiskslinuxdriveata.c
|
||||
@@ -582,6 +582,7 @@ udisks_linux_drive_ata_refresh_smart_sync (UDisksLinuxDriveAta *drive,
|
||||
UDISKS_ERROR,
|
||||
UDISKS_ERROR_FAILED,
|
||||
"sk_disk_open: %m");
|
||||
+ g_free (blob);
|
||||
goto out;
|
||||
}
|
||||
|
||||
diff --git a/src/udiskslinuxfilesystem.c b/src/udiskslinuxfilesystem.c
|
||||
index 3ae11c3..279d952 100644
|
||||
--- a/src/udiskslinuxfilesystem.c
|
||||
+++ b/src/udiskslinuxfilesystem.c
|
||||
@@ -697,9 +697,9 @@ calculate_mount_point (UDisksDaemon *daemon,
|
||||
}
|
||||
}
|
||||
g_free (orig_mount_point);
|
||||
- g_free (mount_dir);
|
||||
|
||||
out:
|
||||
+ g_free (mount_dir);
|
||||
g_clear_object (&object);
|
||||
g_free (escaped_user_name);
|
||||
return mount_point;
|
||||
diff --git a/tools/udisksctl.c b/tools/udisksctl.c
|
||||
index 3b0a48e..7a5de65 100644
|
||||
--- a/tools/udisksctl.c
|
||||
+++ b/tools/udisksctl.c
|
||||
@@ -1282,6 +1282,7 @@ handle_command_unlock_lock (gint *argc,
|
||||
g_printerr ("Error unlocking %s: %s\n",
|
||||
udisks_block_get_device (block),
|
||||
error->message);
|
||||
+ g_clear_error (&error);
|
||||
goto out;
|
||||
}
|
||||
g_variant_builder_add (&builder,
|
||||
@@ -3103,6 +3104,7 @@ handle_command_status (gint *argc,
|
||||
serial,
|
||||
block);
|
||||
g_free (block);
|
||||
+ g_free (vendor_model);
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
75
0002-udisksctl-Guard-object-lookup.patch
Normal file
75
0002-udisksctl-Guard-object-lookup.patch
Normal file
@ -0,0 +1,75 @@
|
||||
From ad83cfb26c2dd8d4532a634e105baaee76441c8f Mon Sep 17 00:00:00 2001
|
||||
From: Tomas Bzatek <tbzatek@redhat.com>
|
||||
Date: Mon, 3 Jun 2024 17:02:15 +0800
|
||||
Subject: [PATCH] udisksctl: Guard object lookup
|
||||
|
||||
Added extra checks for object validity when looking up physical
|
||||
device through a drive. Reproducible e.g. by calling 'power-off'
|
||||
over a LUKS container.
|
||||
---
|
||||
tools/udisksctl.c | 26 ++++++++++++++++++++++++++
|
||||
1 file changed, 26 insertions(+)
|
||||
|
||||
diff --git a/tools/udisksctl.c b/tools/udisksctl.c
|
||||
index 7a5de65..349dca3 100644
|
||||
--- a/tools/udisksctl.c
|
||||
+++ b/tools/udisksctl.c
|
||||
@@ -2003,6 +2003,7 @@ handle_command_smart_simulate (gint *argc,
|
||||
{
|
||||
UDisksObject *block_object;
|
||||
UDisksDrive *drive;
|
||||
+
|
||||
block_object = lookup_object_by_device (opt_smart_simulate_device);
|
||||
if (block_object == NULL)
|
||||
{
|
||||
@@ -2010,7 +2011,19 @@ handle_command_smart_simulate (gint *argc,
|
||||
goto out;
|
||||
}
|
||||
drive = udisks_client_get_drive_for_block (client, udisks_object_peek_block (block_object));
|
||||
+ if (drive == NULL)
|
||||
+ {
|
||||
+ g_printerr ("Error looking up drive for device %s\n", opt_smart_simulate_device);
|
||||
+ g_object_unref (block_object);
|
||||
+ goto out;
|
||||
+ }
|
||||
object = (UDisksObject *) g_dbus_interface_dup_object (G_DBUS_INTERFACE (drive));
|
||||
+ if (object == NULL)
|
||||
+ {
|
||||
+ g_printerr ("Error looking up object for device %s\n", opt_smart_simulate_device);
|
||||
+ g_object_unref (block_object);
|
||||
+ goto out;
|
||||
+ }
|
||||
g_object_unref (block_object);
|
||||
}
|
||||
else
|
||||
@@ -2244,6 +2257,7 @@ handle_command_power_off (gint *argc,
|
||||
{
|
||||
UDisksObject *block_object;
|
||||
UDisksDrive *drive;
|
||||
+
|
||||
block_object = lookup_object_by_device (opt_power_off_device);
|
||||
if (block_object == NULL)
|
||||
{
|
||||
@@ -2251,7 +2265,19 @@ handle_command_power_off (gint *argc,
|
||||
goto out;
|
||||
}
|
||||
drive = udisks_client_get_drive_for_block (client, udisks_object_peek_block (block_object));
|
||||
+ if (drive == NULL)
|
||||
+ {
|
||||
+ g_printerr ("Error looking up drive for device %s\n", opt_power_off_device);
|
||||
+ g_object_unref (block_object);
|
||||
+ goto out;
|
||||
+ }
|
||||
object = (UDisksObject *) g_dbus_interface_dup_object (G_DBUS_INTERFACE (drive));
|
||||
+ if (object == NULL)
|
||||
+ {
|
||||
+ g_printerr ("Error looking up object for device %s\n", opt_power_off_device);
|
||||
+ g_object_unref (block_object);
|
||||
+ goto out;
|
||||
+ }
|
||||
g_object_unref (block_object);
|
||||
}
|
||||
else
|
||||
--
|
||||
2.33.0
|
||||
|
||||
Binary file not shown.
BIN
udisks-2.9.4.tar.bz2
Normal file
BIN
udisks-2.9.4.tar.bz2
Normal file
Binary file not shown.
30
udisks2.spec
30
udisks2.spec
@ -57,15 +57,14 @@
|
||||
|
||||
Name: udisks2
|
||||
Summary: Disk Manager
|
||||
Version: 2.9.1
|
||||
Release: 1
|
||||
License: GPLv2+
|
||||
Version: 2.9.4
|
||||
Release: 5
|
||||
License: GPL-2.0+ and LGPL-2.0+
|
||||
Group: System Environment/Libraries
|
||||
URL: https://github.com/storaged-project/udisks
|
||||
Source0: https://github.com/storaged-project/udisks/releases/download/udisks-%{version}/udisks-%{version}.tar.bz2
|
||||
|
||||
Patch1: 0001-udiskslinuxmountoptions-Prevent-a-memory-leak.patch
|
||||
Patch2: 0002-Memory-leak-fixes.patch
|
||||
Patch1: 0001-udiskslinuxmountoptions-Do-not-free-static-daemon-resources.patch
|
||||
Patch2: 0002-udisksctl-Guard-object-lookup.patch
|
||||
|
||||
BuildRequires: glib2-devel >= %{glib2_version}
|
||||
BuildRequires: gobject-introspection-devel >= %{gobject_introspection_version}
|
||||
@ -255,7 +254,7 @@ This package contains module for VDO management.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q -n udisks-%{version}
|
||||
%autosetup -n udisks-%{version} -p1
|
||||
sed -i udisks/udisks2.conf.in -e "s/encryption=luks1/encryption=%{default_luks_encryption}/"
|
||||
|
||||
%build
|
||||
@ -438,7 +437,22 @@ udevadm trigger
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Jan 14 2020 yanglongkang <yanglongkang@huawei.com> - 2.9.1-1
|
||||
* Mon Jun 03 2024 cenhuilin <cenhuilin@kylinos.cn> - 2.9.4-5
|
||||
- udisksctl: Guard object lookup
|
||||
|
||||
* Tue Feb 21 2023 miaoguanqin <miaoguanqin@huawei.com> - 2.9.4-4
|
||||
- fix coredump while stop udisks2
|
||||
|
||||
* Sat Oct 29 2022 wangzhiqiang <wangzhiqiang95@huawei.com> - 2.9.4-3
|
||||
- update release
|
||||
|
||||
* Sat Feb 19 2022 yanglongkang <yanglongkang@h-partners.com> - 2.9.4-2
|
||||
- correct License
|
||||
|
||||
* Mon Nov 22 2021 Li Jinlin <lijinlin3@huawei.com> - 2.9.4-1
|
||||
- update udisks2 version to 2.9.4
|
||||
|
||||
* Tue Jan 14 2020 yanglongkang <yanglongkang@huawei.com> - 2.9.1-1
|
||||
- update to 2.9.1
|
||||
|
||||
* Thu Oct 29 2020 Zhiqiang Liu <lzhq28@mail.ustc.edu.cn> - 2.9.0-3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user