]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
homed,shutdown: call valgrind magic after LOOP_GET_STATUS64
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Oct 2021 15:58:13 +0000 (17:58 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 16 Oct 2021 08:11:15 +0000 (10:11 +0200)
valgrind doesn't understand LOOP_GET_STATUS64. We already work around
this in various placed, via VALGRIND_MAKE_MEM_DEFINE(), but we forgot
three places. Let's fix that.

src/home/homework-luks.c
src/shutdown/umount.c

index 050c9cd6d553273e7a47fc52dbf69741acb2d6cb..1f459fedc7ca4a93db5b6a2f5800011a9a898486 100644 (file)
@@ -8,6 +8,10 @@
 #include <sys/mount.h>
 #include <sys/xattr.h>
 
+#if HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
+
 #include "sd-daemon.h"
 
 #include "blkid-util.h"
@@ -1193,6 +1197,10 @@ int home_prepare_luks(
                                 offset *= 512U;
                         }
                 } else {
+#if HAVE_VALGRIND_MEMCHECK_H
+                        VALGRIND_MAKE_MEM_DEFINED(&info, sizeof(info));
+#endif
+
                         offset = info.lo_offset;
                         size = info.lo_sizelimit;
                 }
index 09fc339ab1d486620b0a124cce704ce0511faaca..881d4e471e9bb00e41431c4128423fe7f0905c8d 100644 (file)
 #include <sys/types.h>
 #include <unistd.h>
 
+#if HAVE_VALGRIND_MEMCHECK_H
+#include <valgrind/memcheck.h>
+#endif
+
 #include "sd-device.h"
 
 #include "alloc-util.h"
@@ -409,6 +413,10 @@ static int delete_loopback(const char *device) {
                         return -EBUSY; /* propagate original error */
                 }
 
+#if HAVE_VALGRIND_MEMCHECK_H
+                VALGRIND_MAKE_MEM_DEFINED(&info, sizeof(info));
+#endif
+
                 if (FLAGS_SET(info.lo_flags, LO_FLAGS_AUTOCLEAR)) /* someone else already set LO_FLAGS_AUTOCLEAR for us? fine by us */
                         return -EBUSY; /* propagate original error */
 
@@ -434,6 +442,10 @@ static int delete_loopback(const char *device) {
                 return 1;
         }
 
+#if HAVE_VALGRIND_MEMCHECK_H
+        VALGRIND_MAKE_MEM_DEFINED(&info, sizeof(info));
+#endif
+
         /* Linux makes LOOP_CLR_FD succeed whenever LO_FLAGS_AUTOCLEAR is set without actually doing
          * anything. Very confusing. Let's hence not claim we did anything in this case. */
         if (FLAGS_SET(info.lo_flags, LO_FLAGS_AUTOCLEAR))