diff options
author | Liubov Dmitrieva <liubov.dmitrieva@intel.com> | 2012-12-17 13:44:21 +0400 |
---|---|---|
committer | Liubov Dmitrieva <ldmitrie@sourceware.org> | 2013-10-23 19:07:35 +0400 |
commit | f1079a9d27c2c91206f707f4e6b332752cba39d2 (patch) | |
tree | 94442a144caaa60e6087da8758a499a9031bffaa | |
parent | 1ad69ea0d84ca18e834146032178d827ce928729 (diff) | |
download | glibc-f1079a9d27c2c91206f707f4e6b332752cba39d2.tar glibc-f1079a9d27c2c91206f707f4e6b332752cba39d2.tar.gz glibc-f1079a9d27c2c91206f707f4e6b332752cba39d2.tar.bz2 glibc-f1079a9d27c2c91206f707f4e6b332752cba39d2.zip |
Add attribute __bnd_variable_size to make using flexible size arrays Intel MPX complient.
-rw-r--r-- | bits/dirent.h | 4 | ||||
-rw-r--r-- | bits/sched.h | 2 | ||||
-rw-r--r-- | debug/tst-chk1.c | 4 | ||||
-rw-r--r-- | dlfcn/dlfcn.h | 2 | ||||
-rw-r--r-- | include/link.h | 2 | ||||
-rw-r--r-- | inet/netinet/in.h | 4 | ||||
-rw-r--r-- | inet/protocols/routed.h | 4 | ||||
-rw-r--r-- | intl/dcigettext.c | 4 | ||||
-rw-r--r-- | intl/gettextP.h | 2 | ||||
-rw-r--r-- | intl/gmo.h | 2 | ||||
-rw-r--r-- | intl/loadinfo.h | 2 | ||||
-rw-r--r-- | io/fts.h | 2 | ||||
-rw-r--r-- | locale/localeinfo.h | 4 | ||||
-rw-r--r-- | misc/search.h | 2 | ||||
-rw-r--r-- | nptl/descr.h | 9 | ||||
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h | 2 | ||||
-rw-r--r-- | stdio-common/psiginfo-define.h | 2 | ||||
-rw-r--r-- | sunrpc/clnt_udp.c | 2 | ||||
-rw-r--r-- | sysdeps/gnu/netinet/ip_icmp.h | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/bits/sched.h | 2 | ||||
-rw-r--r-- | sysvipc/sys/msg.h | 2 |
21 files changed, 32 insertions, 29 deletions
diff --git a/bits/dirent.h b/bits/dirent.h index 2117a7c0a9..77cae84efa 100644 --- a/bits/dirent.h +++ b/bits/dirent.h @@ -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 diff --git a/bits/sched.h b/bits/sched.h index 0c200a95ec..0a9513ad0e 100644 --- a/bits/sched.h +++ b/bits/sched.h @@ -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. */ diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c index 6ca8d9d85c..9783d3a54a 100644 --- a/debug/tst-chk1.c +++ b/debug/tst-chk1.c @@ -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 diff --git a/dlfcn/dlfcn.h b/dlfcn/dlfcn.h index 1ed47b1d1e..0fab755e96 100644 --- a/dlfcn/dlfcn.h +++ b/dlfcn/dlfcn.h @@ -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 */ diff --git a/include/link.h b/include/link.h index 1682467631..ca253ebd86 100644 --- a/include/link.h +++ b/include/link.h @@ -318,7 +318,7 @@ struct link_map { uintptr_t cookie; unsigned int bindflags; - } l_audit[0]; + } l_audit[0] __attribute__((bnd_variable_size)); }; diff --git a/inet/netinet/in.h b/inet/netinet/in.h index 89e3813d00..12294d08ef 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -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) \ diff --git a/inet/protocols/routed.h b/inet/protocols/routed.h index befd8654d7..457d792693 100644 --- a/inet/protocols/routed.h +++ b/inet/protocols/routed.h @@ -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 diff --git a/intl/dcigettext.c b/intl/dcigettext.c index f4aa215744..9885a13e8f 100644 --- a/intl/dcigettext.c +++ b/intl/dcigettext.c @@ -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 diff --git a/intl/gettextP.h b/intl/gettextP.h index d1ec644cb7..79f0a4ce73 100644 --- a/intl/gettextP.h +++ b/intl/gettextP.h @@ -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 diff --git a/intl/gmo.h b/intl/gmo.h index 7b50597a9b..b4c48cc7e2 100644 --- a/intl/gmo.h +++ b/intl/gmo.h @@ -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, diff --git a/intl/loadinfo.h b/intl/loadinfo.h index 75636247ab..800423335f 100644 --- a/intl/loadinfo.h +++ b/intl/loadinfo.h @@ -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)); }; @@ -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 diff --git a/locale/localeinfo.h b/locale/localeinfo.h index 3142726605..8dbb5987a1 100644 --- a/locale/localeinfo.h +++ b/locale/localeinfo.h @@ -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; diff --git a/misc/search.h b/misc/search.h index e3b3dfdc0a..63a776870a 100644 --- a/misc/search.h +++ b/misc/search.h @@ -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 diff --git a/nptl/descr.h b/nptl/descr.h index 58176ea2d8..a175bb0b05 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -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, \ diff --git a/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h index 28b49bd893..0adb200a67 100644 --- a/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h +++ b/nptl/sysdeps/unix/sysv/linux/x86/bits/pthreadtypes.h @@ -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 diff --git a/stdio-common/psiginfo-define.h b/stdio-common/psiginfo-define.h index e1d1a351f8..d76cb6b68d 100644 --- a/stdio-common/psiginfo-define.h +++ b/stdio-common/psiginfo-define.h @@ -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" diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c index 1b6a20b826..eca7122237 100644 --- a/sunrpc/clnt_udp.c +++ b/sunrpc/clnt_udp.c @@ -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)) ; }; /* diff --git a/sysdeps/gnu/netinet/ip_icmp.h b/sysdeps/gnu/netinet/ip_icmp.h index 136fb4703e..5c2cb0ce5c 100644 --- a/sysdeps/gnu/netinet/ip_icmp.h +++ b/sysdeps/gnu/netinet/ip_icmp.h @@ -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 diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h index e42dee8e62..5086380d8c 100644 --- a/sysdeps/unix/sysv/linux/bits/sched.h +++ b/sysdeps/unix/sysv/linux/bits/sched.h @@ -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. */ diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h index a0b38f0f9c..c06424f22d 100644 --- a/sysvipc/sys/msg.h +++ b/sysvipc/sys/msg.h @@ -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 |