Version in base suite: 4.4-11 Base version: mdadm_4.4-11 Target version: mdadm_4.4-11+deb13u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/m/mdadm/mdadm_4.4-11.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/m/mdadm/mdadm_4.4-11+deb13u1.dsc changelog | 8 +++++ patches/debian/0015-monitor-memory-leak.patch | 39 ++++++++++++++++++++++++++ patches/series | 1 3 files changed, 48 insertions(+) dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpz1fum3eg/mdadm_4.4-11.dsc: no acceptable signature found dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpz1fum3eg/mdadm_4.4-11+deb13u1.dsc: no acceptable signature found diff -Nru mdadm-4.4/debian/changelog mdadm-4.4/debian/changelog --- mdadm-4.4/debian/changelog 2025-04-25 16:24:19.000000000 +0000 +++ mdadm-4.4/debian/changelog 2026-08-23 19:40:00.000000000 +0000 @@ -1,3 +1,11 @@ +mdadm (4.4-11+deb13u1) trixie; urgency=medium + + * Non-Maintainer Upload. + * Adding patch from Peter Mann to fix memory leak in + mdadm --monitor --scan (Closes: #1115497). + + -- Samuel Thibault Sun, 23 Aug 2026 21:40:00 +0200 + mdadm (4.4-11) sid; urgency=medium [ Daniel Baumann ] diff -Nru mdadm-4.4/debian/patches/debian/0015-monitor-memory-leak.patch mdadm-4.4/debian/patches/debian/0015-monitor-memory-leak.patch --- mdadm-4.4/debian/patches/debian/0015-monitor-memory-leak.patch 1970-01-01 00:00:00.000000000 +0000 +++ mdadm-4.4/debian/patches/debian/0015-monitor-memory-leak.patch 2026-08-23 19:40:00.000000000 +0000 @@ -0,0 +1,39 @@ +Author: Peter Mann +Description: Memory leak in mdadm --monitor --scan (Closes: #1115497). + At mdadm/udev.c:153: + ... + if (udev_monitor_receive_device(udev_monitor)) + return UDEV_STATUS_SUCCESS; /* event detected */ + ... + . + According to libudev docs: + On success, udev_monitor_receive_device() returns a pointer to a newly referenced device that was received via the monitor. The caller is responsible to drop this reference when done. + . + As you can see, the reference to the device never gets dropped. + We put together a quick patch, which seems to have fixed the issue or at least substantially reduced the amount of leaks. + . + Since we have no experience with the codebase, we have no idea about the implications of these changes. + We would appreciate if someone took a closer look. + . + Additionaly as a workaround, passing MDADM_NO_UDEV=1 env to mdadm stops the leaks as well, since it bypasses the leaking codepath. +Forwarded: https://github.com/md-raid-utilities/mdadm/pull/197 + +diff -Naurp mdadm.orig/udev.c mdadm/udev.c +--- mdadm.orig/udev.c ++++ mdadm/udev.c +@@ -149,9 +149,13 @@ enum udev_status udev_wait_for_events(in + tv.tv_sec = seconds; + tv.tv_usec = 0; + +- if (select(fd + 1, &readfds, NULL, NULL, &tv) > 0 && FD_ISSET(fd, &readfds)) +- if (udev_monitor_receive_device(udev_monitor)) ++ if (select(fd + 1, &readfds, NULL, NULL, &tv) > 0 && FD_ISSET(fd, &readfds)) { ++ struct udev_device *dev = udev_monitor_receive_device(udev_monitor); ++ if (dev) { ++ udev_device_unref(dev); + return UDEV_STATUS_SUCCESS; /* event detected */ ++ } ++ } + return UDEV_STATUS_TIMEOUT; + } + #endif diff -Nru mdadm-4.4/debian/patches/series mdadm-4.4/debian/patches/series --- mdadm-4.4/debian/patches/series 2025-03-09 17:03:14.000000000 +0000 +++ mdadm-4.4/debian/patches/series 2026-08-23 19:40:00.000000000 +0000 @@ -10,4 +10,5 @@ debian/0011-systemd-directory.patch debian/0012-bin-directory.patch debian/0013-xmalloc-ftbfs.patch +debian/0015-monitor-memory-leak.patch upstream/0001-manpage-remove-bitmap.patch