]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
static-destruct: turn on new _variable_no_sanitize_address_ variable for STATIC_DESTR...
authorLennart Poettering <lennart@poettering.net>
Mon, 3 Dec 2018 16:33:28 +0000 (17:33 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 3 Dec 2018 16:35:50 +0000 (17:35 +0100)
src/basic/static-destruct.h

index 5c0bea31a6fd6d114c41bdf1790e7472289b95b6..9f7392121da4173537f65eca56fd4e0335bcf604 100644 (file)
@@ -21,10 +21,14 @@ typedef struct StaticDestructor {
                 typeof(variable) *q = p;                                \
                 func(q);                                                \
         }                                                               \
-        /* The actual destructor structure */                           \
+        /* The actual destructor structure we place in a special section to find it */ \
         _section_("SYSTEMD_STATIC_DESTRUCT")                            \
+        /* We pick pointer alignment, since that is apparently what gcc does for static variables */ \
         _alignptr_                                                      \
+        /* Make sure this is not dropped from the image because not explicitly referenced */ \
         _used_                                                          \
+        /* Make sure that AddressSanitizer doesn't pad this variable: we want everything in this section packed next to each other so that we can enumerate it. */ \
+        _variable_no_sanitize_address_                                  \
         static const StaticDestructor UNIQ_T(static_destructor_entry, uq) = { \
                 .data = &(variable),                                    \
                 .destroy = UNIQ_T(static_destructor_wrapper, uq),       \