about summary refs log tree commit diff
path: root/include/link.h
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2019-11-03 11:20:23 +0100
committerFlorian Weimer <fweimer@redhat.com>2019-11-15 13:03:59 +0100
commite21a7867713c87d0b0698254685d414d811d72b2 (patch)
tree5f6a4ce16652bdd9c9f59ec9d3b5d4629104ee45 /include/link.h
parente1d559f337de2c8ab68a6749dfe873477c883807 (diff)
downloadglibc-e21a7867713c87d0b0698254685d414d811d72b2.tar.gz
glibc-e21a7867713c87d0b0698254685d414d811d72b2.tar.xz
glibc-e21a7867713c87d0b0698254685d414d811d72b2.zip
Avoid zero-length array at the end of struct link_map [BZ #25097]
l_audit ends up as an internal array with _rtld_global, and GCC 10
warns about this.

This commit does not change the layout of _rtld_global, so it is
suitable for backporting.  Future changes could allocate more of the
audit state dynamically and remove it from always-allocated data
structures, to optimize the common case of inactive auditing.

Change-Id: Ic911100730f9124d4ea977ead8e13cee64b84d45
Diffstat (limited to 'include/link.h')
-rw-r--r--include/link.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/link.h b/include/link.h
index 1184201f91..be52b97370 100644
--- a/include/link.h
+++ b/include/link.h
@@ -325,16 +325,18 @@ struct link_map
     size_t l_relro_size;
 
     unsigned long long int l_serial;
-
-    /* Audit information.  This array apparent must be the last in the
-       structure.  Never add something after it.  */
-    struct auditstate
-    {
-      uintptr_t cookie;
-      unsigned int bindflags;
-    } l_audit[0];
   };
 
+/* Information used by audit modules.  For most link maps, this data
+   immediate follows the link map in memory.  For the dynamic linker,
+   it is allocated separately.  See link_map_audit_state in
+   <ldsodefs.h>.  */
+struct auditstate
+{
+  uintptr_t cookie;
+  unsigned int bindflags;
+};
+
 
 #if __ELF_NATIVE_CLASS == 32
 # define symbind symbind32