]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Add attribute __bnd_variable_size to make using flexible size arrays Intel MPX complient.
authorLiubov Dmitrieva <liubov.dmitrieva@intel.com>
Mon, 17 Dec 2012 09:44:21 +0000 (13:44 +0400)
committerLiubov Dmitrieva <ldmitrie@sourceware.org>
Wed, 23 Oct 2013 15:07:35 +0000 (19:07 +0400)
21 files changed:
bits/dirent.h
bits/sched.h
debug/tst-chk1.c
dlfcn/dlfcn.h
include/link.h
inet/netinet/in.h
inet/protocols/routed.h
intl/dcigettext.c
intl/gettextP.h
intl/gmo.h
intl/loadinfo.h
io/fts.h
locale/localeinfo.h
misc/search.h
nptl/descr.h
nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h
stdio-common/psiginfo-define.h
sunrpc/clnt_udp.c
sysdeps/gnu/netinet/ip_icmp.h
sysdeps/unix/sysv/linux/bits/sched.h
sysvipc/sys/msg.h

index 2117a7c0a9375ab98b52e17b05f9ba5e5741cc1c..77cae84efa8b46e3dfe19a4400b6fae3447545e4 100644 (file)
@@ -32,7 +32,7 @@ struct dirent
     unsigned char d_namlen;    /* Length of the file name.  */
 
     /* Only this member is in the POSIX standard.  */
-    char d_name[1];            /* File name (actually longer).  */
+    char d_name[1] __attribute__((bnd_variable_size));         /* File name (actually longer).  */
   };
 
 #ifdef __USE_LARGEFILE64
@@ -43,7 +43,7 @@ struct dirent64
     unsigned char d_type;
     unsigned char d_namlen;
 
-    char d_name[1];
+    char d_name[1] __attribute__((bnd_variable_size));
   };
 #endif
 
index 0c200a95ec7446746a2044cde300d2ce2f9337ac..0a9513ad0e29d77e738a5e2201aa8c158626ec3b 100644 (file)
@@ -65,7 +65,7 @@ typedef unsigned long int __cpu_mask;
 /* Data structure to describe CPU mask.  */
 typedef struct
 {
-  __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
+  __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS] __attribute__((bnd_variable_size));
 } cpu_set_t;
 
 /* Access functions for CPU masks.  */
index 6ca8d9d85c2b7717ffaf5ad9c195c06ab9e756fa..9783d3a54ab40fbb18360d533e272d40544d0ec6 100644 (file)
@@ -137,8 +137,8 @@ do_test (void)
     }
   setenv ("LIBC_FATAL_STDERR_", "1", 1);
 
-  struct A { char buf1[9]; char buf2[1]; } a;
-  struct wA { wchar_t buf1[9]; wchar_t buf2[1]; } wa;
+  struct A { char buf1[9] __attribute__((bnd_variable_size)); char buf2[1]; } a;
+  struct wA { wchar_t buf1[9] __attribute__((bnd_variable_size)); wchar_t buf2[1]; } wa;
 
   printf ("Test checking routines at fortify level %d\n",
 #ifdef __USE_FORTIFY_LEVEL
index 1ed47b1d1e7c16c64cc58c2556020d9cec75509c..0fab755e96b6ee62559be356a656d841caaad0bd 100644 (file)
@@ -180,7 +180,7 @@ typedef struct
 {
   size_t dls_size;             /* Size in bytes of the whole buffer.  */
   unsigned int dls_cnt;                /* Number of elements in `dls_serpath'.  */
-  Dl_serpath dls_serpath[1];   /* Actually longer, dls_cnt elements.  */
+  Dl_serpath dls_serpath[1] __attribute__((bnd_variable_size));        /* Actually longer, dls_cnt elements.  */
 } Dl_serinfo;
 #endif /* __USE_GNU */
 
index 16824676319b39b68cd776abb3e22599a439e763..ca253ebd86b235be991c869f2a9c927458e02b3d 100644 (file)
@@ -318,7 +318,7 @@ struct link_map
     {
       uintptr_t cookie;
       unsigned int bindflags;
-    } l_audit[0];
+    } l_audit[0] __attribute__((bnd_variable_size));
   };
 
 
index 89e3813d00c1b243e524e3f6494ec82f52d9e41c..12294d08ef3aa791dcbde4d6070fde5f75a5f9eb 100644 (file)
@@ -319,7 +319,7 @@ struct ip_msfilter
     /* Number of source addresses.  */
     uint32_t imsf_numsrc;
     /* Source addresses.  */
-    struct in_addr imsf_slist[1];
+    struct in_addr imsf_slist[1] __attribute__((bnd_variable_size));
   };
 
 #define IP_MSFILTER_SIZE(numsrc) (sizeof (struct ip_msfilter) \
@@ -340,7 +340,7 @@ struct group_filter
     /* Number of source addresses.  */
     uint32_t gf_numsrc;
     /* Source addresses.  */
-    struct sockaddr_storage gf_slist[1];
+    struct sockaddr_storage gf_slist[1] __attribute__((bnd_variable_size));
 };
 
 #define GROUP_FILTER_SIZE(numsrc) (sizeof (struct group_filter) \
index befd8654d725e914be1133a35a7fac0e9ecede6c..457d79269364fc80258e0c1031c868d3d9465677 100644 (file)
@@ -52,8 +52,8 @@ struct rip {
        u_char  rip_vers;               /* protocol version # */
        u_char  rip_res1[2];            /* pad to 32-bit boundary */
        union {
-               struct  netinfo ru_nets[1];     /* variable length... */
-               char    ru_tracefile[1];        /* ditto ... */
+               struct  netinfo ru_nets[1] __attribute__((bnd_variable_size));  /* variable length... */
+               char    ru_tracefile[1] __attribute__((bnd_variable_size));     /* ditto ... */
        } ripun;
 #define        rip_nets        ripun.ru_nets
 #define        rip_tracefile   ripun.ru_tracefile
index f4aa215744ce89e38f82dfe24c36bf6c08b7f4d7..9885a13e8fe1b149e3c7bd39b91638cf448f0f4e 100644 (file)
@@ -204,7 +204,7 @@ struct known_translation_t
   /* Pointer to the string in question.  */
   union
     {
-      char appended[ZERO];  /* used if domain != NULL */
+      char appended[ZERO] __attribute__((bnd_variable_size));  /* used if domain != NULL */
       const char *ptr;      /* used if domain == NULL */
     }
   msgid;
@@ -342,7 +342,7 @@ struct block_list
 typedef struct transmem_list
 {
   struct transmem_list *next;
-  char data[ZERO];
+  char data[ZERO] __attribute__((bnd_variable_size));
 } transmem_block_t;
 static struct transmem_list *transmem_list;
 #else
index d1ec644cb7dc516a08109535aee031bc4bc134a9..79f0a4ce736d9a21346d7ddd1ee727eeeda6e0c4 100644 (file)
@@ -160,7 +160,7 @@ struct binding
   struct binding *next;
   char *dirname;
   char *codeset;
-  char domainname[ZERO];
+  char domainname[ZERO] __attribute__((bnd_variable_size));
 };
 
 /* A counter which is incremented each time some previous translations
index 7b50597a9b16ba8d1d36232766106f379f645c9d..b4c48cc7e2bd1f7b9933f857657f4323661bdf5a 100644 (file)
@@ -137,7 +137,7 @@ struct sysdep_string
     nls_uint32 segsize;
     /* Reference to system dependent string segment, or ~0 at the end.  */
     nls_uint32 sysdepref;
-  } segments[1];
+  } segments[1] __attribute__((bnd_variable_size));
 };
 
 /* Marker for the end of the segments[] array.  This has the value 0xFFFFFFFF,
index 75636247ab91f82debc2542cbdd15353d5b0f396..800423335f026508d6d9764149fa83aeec5bf6c4 100644 (file)
@@ -58,7 +58,7 @@ struct loaded_l10nfile
   const void *data;
 
   struct loaded_l10nfile *next;
-  struct loaded_l10nfile *successor[1];
+  struct loaded_l10nfile *successor[1] __attribute__((bnd_variable_size));
 };
 
 
index 0a070ba8dce576a0cdeb1de36ce3df6f6d5338d6..93f94f8875d377c02c065d7dbf1cf16a8559b18b 100644 (file)
--- a/io/fts.h
+++ b/io/fts.h
@@ -116,7 +116,7 @@ typedef struct _ftsent {
        u_short fts_instr;              /* fts_set() instructions */
 
        struct stat *fts_statp;         /* stat(2) information */
-       char fts_name[1];               /* file name */
+       char fts_name[1] __attribute__((bnd_variable_size));            /* file name */
 } FTSENT;
 
 __BEGIN_DECLS
index 3142726605dea2cd62ac0fff9459aa8e3b5cd811..8dbb5987a11b993504168be8a970c1b21f60ae50 100644 (file)
@@ -84,7 +84,7 @@ struct __locale_data
     const char *string;
     unsigned int word;         /* Note endian issues vs 64-bit pointers.  */
   }
-  values __flexarr;    /* Items, usually pointers into `filedata'.  */
+  values __flexarr __attribute__((bnd_variable_size)); /* Items, usually pointers into `filedata'.  */
 };
 
 /* We know three kinds of collation sorting rules.  */
@@ -185,7 +185,7 @@ extern const union catnamestr_t
 #include "categories.def"
 #undef DEFINE_CATEGORY
   };
-  char str[0];
+  char str[0] __attribute__((bnd_variable_size));
 } _nl_category_names attribute_hidden;
 extern const uint8_t _nl_category_name_idxs[__LC_LAST] attribute_hidden;
 extern const uint8_t _nl_category_name_sizes[__LC_LAST] attribute_hidden;
index e3b3dfdc0ac0f61681f30b1105835b5ac12a2395..63a776870a79db7bfe9a3dc948c9f64dc1e77061 100644 (file)
@@ -35,7 +35,7 @@ struct qelem
   {
     struct qelem *q_forw;
     struct qelem *q_back;
-    char q_data[1];
+    char q_data[1] __attribute__((bnd_variable_size));
   };
 # endif
 
index 58176ea2d8b6886da4c136886bd0788fa023ce50..a175bb0b05f200906d9f93f37c922ec4e45575d3 100644 (file)
@@ -162,7 +162,7 @@ struct pthread
   };
 
   /* This descriptor's link on the `stack_used' or `__stack_user' list.  */
-  list_t list;
+  list_t list __attribute__((bnd_variable_size));
 
   /* Thread ID - which is also a 'is this thread descriptor (and
      therefore stack) used' flag.  */
@@ -174,7 +174,10 @@ struct pthread
   /* List of robust mutexes the thread is holding.  */
 #ifdef __PTHREAD_MUTEX_HAVE_PREV
   void *robust_prev;
-  struct robust_list_head robust_head;
+  struct robust_list_head robust_head __attribute__((bnd_variable_size));
+  /* sometimes we want to cast pair {robust_prev (void *) and the
+   * first field of struct robust_list_head (void *)}
+   * to __pthread_list_t (struct consists of two pointers: __prev, __next) */
 
   /* The list above is strange.  It is basically a double linked list
      but the pointer to the next/previous element of the list points
@@ -186,7 +189,7 @@ struct pthread
 # define ENQUEUE_MUTEX_BOTH(mutex, val)                                              \
   do {                                                                       \
     __pthread_list_t *next = (__pthread_list_t *)                            \
-      ((((uintptr_t) THREAD_GETMEM (THREAD_SELF, robust_head.list)) & ~1ul)   \
+      ((char *)(((uintptr_t) THREAD_GETMEM (THREAD_SELF, robust_head.list)) & ~1ul)   \
        - QUEUE_PTR_ADJUST);                                                  \
     next->__prev = (void *) &mutex->__data.__list.__next;                    \
     mutex->__data.__list.__next = THREAD_GETMEM (THREAD_SELF,                \
index 28b49bd893179806737c6a603ce0aec05ea603d2..0adb200a675b80509808ae0762b16418c72abe39 100644 (file)
@@ -75,7 +75,7 @@ typedef union pthread_attr_t pthread_attr_t;
 typedef struct __pthread_internal_list
 {
   struct __pthread_internal_list *__prev;
-  struct __pthread_internal_list *__next;
+  struct __pthread_internal_list *__next __attribute__((bnd_variable_size));
 } __pthread_list_t;
 #else
 typedef struct __pthread_internal_slist
index e1d1a351f8fb2bd06588e44bdf6457ae1b0effcc..d76cb6b68df77b1fea0b7ff6d6600f9a7ae1d74a 100644 (file)
@@ -3,7 +3,7 @@ static const union C(codestrs_t_, NOW) {
 #define P(n, s) char MF(__LINE__)[sizeof (s)];
 #include "psiginfo-data.h"
   };
-  char str[0];
+  char str[0] __attribute__((bnd_variable_size));
 } C(codestrs_, NOW) = { {
 #define P(n, s) s,
 #include "psiginfo-data.h"
index 1b6a20b8266f67d84edee588734f575551725af7..eca712223741eeafa7f4fd26250d6fa3b6e5641f 100644 (file)
@@ -96,7 +96,7 @@ struct cu_data
     u_int cu_sendsz;
     char *cu_outbuf;
     u_int cu_recvsz;
-    char cu_inbuf[1];
+    char cu_inbuf[1] __attribute__((bnd_variable_size)) ;
   };
 
 /*
index 136fb4703eb6ca2e8fe26946e3a05178f0c53646..5c2cb0ce5cdac6ae0b73266da65ee72b56ef5885 100644 (file)
@@ -189,7 +189,7 @@ struct icmp
     } id_ip;
     struct icmp_ra_addr id_radv;
     u_int32_t   id_mask;
-    u_int8_t    id_data[1];
+    u_int8_t    id_data[1] __attribute__((bnd_variable_size));
   } icmp_dun;
 #define        icmp_otime      icmp_dun.id_ts.its_otime
 #define        icmp_rtime      icmp_dun.id_ts.its_rtime
index e42dee8e621113293d707b85545427fa06e56ce1..5086380d8c01197fc3660bbd4bd3077f41f35393 100644 (file)
@@ -124,7 +124,7 @@ typedef unsigned long int __cpu_mask;
 /* Data structure to describe CPU mask.  */
 typedef struct
 {
-  __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
+  __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS] __attribute__((bnd_variable_size));
 } cpu_set_t;
 
 /* Access functions for CPU masks.  */
index a0b38f0f9ca51ee9a80877851151b999915b8140..c06424f22de493cebed62e65793bcb2fd7f4aa97 100644 (file)
@@ -51,7 +51,7 @@ typedef __ssize_t ssize_t;
 struct msgbuf
   {
     __syscall_slong_t mtype;   /* type of received/sent message */
-    char mtext[1];             /* text of the message */
+    char mtext[1] __attribute__((bnd_variable_size));          /* text of the message */
   };
 #endif