diff options
175 files changed, 1977 insertions, 543 deletions
@@ -18,9 +18,14 @@ Major new features: * On Linux, the pthread_gettid_np function has been added. +* The ISO C2Y family of unsigned abs functions, i.e. + uabs, ulabs, ullabs and uimaxabs, are now supported. + Deprecated and removed features, and other changes affecting compatibility: - [Add deprecations, removals and changes affecting compatibility here] +* The glibc.rtld.execstack now supports a compatibility mode to allow + programs that require an executable stack through dynamic loaded + shared libraries. Changes to build and runtime requirements: diff --git a/conform/data/aio.h-data b/conform/data/aio.h-data index adb291b..7801faa 100644 --- a/conform/data/aio.h-data +++ b/conform/data/aio.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined XPG42 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined XPG42 type {struct aiocb} // Test elements of the AIO control struct. diff --git a/conform/data/arpa/inet.h-data b/conform/data/arpa/inet.h-data index 040b821..c514690 100644 --- a/conform/data/arpa/inet.h-data +++ b/conform/data/arpa/inet.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 // in_port_t should have exactly 16 bits type in_port_t // in_addr_t should have exactly 32 bits diff --git a/conform/data/assert.h-data b/conform/data/assert.h-data index acdfef9..2344ee3 100644 --- a/conform/data/assert.h-data +++ b/conform/data/assert.h-data @@ -1,9 +1,9 @@ macro assert -#ifdef ISO11 +#if defined ISO11 || defined ISO23 macro static_assert #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/complex.h-data b/conform/data/complex.h-data index 4af7757..0c267e4 100644 --- a/conform/data/complex.h-data +++ b/conform/data/complex.h-data @@ -74,7 +74,7 @@ function {long double complex} csqrtl (long double complex) function {long double complex} ctanhl (long double complex) function {long double complex} ctanl (long double complex) -# if defined ISO11 +# if defined ISO11 || defined ISO23 macro-function {double complex} CMPLX (double, double) macro-function {float complex} CMPLXF (float, float) macro-function {long double complex} CMPLXL (long double, long double) diff --git a/conform/data/cpio.h-data b/conform/data/cpio.h-data index ac7d40f..ab91f2c 100644 --- a/conform/data/cpio.h-data +++ b/conform/data/cpio.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX constant C_IRUSR == 0000400 constant C_IWUSR == 0000200 constant C_IXUSR == 0000100 diff --git a/conform/data/ctype.h-data b/conform/data/ctype.h-data index 7e10794..84426f9 100644 --- a/conform/data/ctype.h-data +++ b/conform/data/ctype.h-data @@ -16,7 +16,7 @@ function int toupper (int) function int isblank (int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function int isascii (int) function int toascii (int) @@ -46,6 +46,6 @@ function int toupper_l (int, locale_t) allow is[abcdefghijklmnopqrstuvwxyz]* allow to[abcdefghijklmnopqrstuvwxyz]* -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/dirent.h-data b/conform/data/dirent.h-data index be7ad06..e7acdeb 100644 --- a/conform/data/dirent.h-data +++ b/conform/data/dirent.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type DIR type {struct dirent} diff --git a/conform/data/dlfcn.h-data b/conform/data/dlfcn.h-data index b6658ae..e852889 100644 --- a/conform/data/dlfcn.h-data +++ b/conform/data/dlfcn.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined XPG42 macro RTLD_LAZY macro RTLD_NOW macro RTLD_GLOBAL diff --git a/conform/data/errno.h-data b/conform/data/errno.h-data index 12730ba..c7b5f7f 100644 --- a/conform/data/errno.h-data +++ b/conform/data/errno.h-data @@ -7,7 +7,7 @@ macro-int-constant ERANGE {int} > 0 // variable int errno allow errno -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 macro-int-constant E2BIG {int} > 0 macro-int-constant EACCES {int} > 0 # if !defined POSIX diff --git a/conform/data/fcntl.h-data b/conform/data/fcntl.h-data index ffa4a35..8491ca6 100644 --- a/conform/data/fcntl.h-data +++ b/conform/data/fcntl.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 constant F_DUPFD constant F_GETFD constant F_SETFD diff --git a/conform/data/fenv.h-data b/conform/data/fenv.h-data index 280b728..b3f674c 100644 --- a/conform/data/fenv.h-data +++ b/conform/data/fenv.h-data @@ -30,7 +30,7 @@ function int feholdexcept (fenv_t*) function int fesetenv (const fenv_t*) function int feupdateenv (const fenv_t *) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif #endif diff --git a/conform/data/float.h-data b/conform/data/float.h-data index 7b98fc0..5478424 100644 --- a/conform/data/float.h-data +++ b/conform/data/float.h-data @@ -43,7 +43,7 @@ macro-int-constant DECIMAL_DIG >= 10 macro-int-constant FLT_EVAL_METHOD #endif -#if defined ISO11 +#if defined ISO11 || defined ISO23 macro-int-constant DBL_HAS_SUBNORM macro-int-constant FLT_HAS_SUBNORM macro-int-constant LDBL_HAS_SUBNORM @@ -57,6 +57,6 @@ macro-constant FLT_TRUE_MIN <= 1E-37 macro-constant LDBL_TRUE_MIN <= 1E-37 #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/fmtmsg.h-data b/conform/data/fmtmsg.h-data index c1b18ad..16d0003 100644 --- a/conform/data/fmtmsg.h-data +++ b/conform/data/fmtmsg.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 && !defined XPG4 macro MM_HARD constant MM_HARD diff --git a/conform/data/fnmatch.h-data b/conform/data/fnmatch.h-data index 12a9a4a..e63a469 100644 --- a/conform/data/fnmatch.h-data +++ b/conform/data/fnmatch.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 constant FNM_NOMATCH constant FNM_PATHNAME constant FNM_PERIOD diff --git a/conform/data/ftw.h-data b/conform/data/ftw.h-data index 340334b..5c8568f 100644 --- a/conform/data/ftw.h-data +++ b/conform/data/ftw.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 # ifndef XPG4 type {struct FTW} element {struct FTW} int base diff --git a/conform/data/glob.h-data b/conform/data/glob.h-data index eca8393..3b5a999 100644 --- a/conform/data/glob.h-data +++ b/conform/data/glob.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #ifdef POSIX # define size_t __size_t #endif diff --git a/conform/data/grp.h-data b/conform/data/grp.h-data index 1688444..428329b 100644 --- a/conform/data/grp.h-data +++ b/conform/data/grp.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #ifdef POSIX # define gid_t __gid_t #endif diff --git a/conform/data/iconv.h-data b/conform/data/iconv.h-data index 79fb2d6..8700fc6 100644 --- a/conform/data/iconv.h-data +++ b/conform/data/iconv.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX type iconv_t # if defined XOPEN2K8 || defined POSIX2008 type size_t diff --git a/conform/data/iso646.h-data b/conform/data/iso646.h-data index 9e307f7..713c3a4 100644 --- a/conform/data/iso646.h-data +++ b/conform/data/iso646.h-data @@ -11,7 +11,7 @@ macro or_eq macro xor macro xor_eq -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif #endif diff --git a/conform/data/langinfo.h-data b/conform/data/langinfo.h-data index 6bbb387..4bd90f2 100644 --- a/conform/data/langinfo.h-data +++ b/conform/data/langinfo.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX constant CODESET constant D_T_FMT constant D_FMT diff --git a/conform/data/libgen.h-data b/conform/data/libgen.h-data index e9eb5fa..aee71bb 100644 --- a/conform/data/libgen.h-data +++ b/conform/data/libgen.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 && !defined XPG4 function {char*} basename (char*) function {char*} dirname (char*) diff --git a/conform/data/limits.h-data b/conform/data/limits.h-data index 23114a5..4160f96 100644 --- a/conform/data/limits.h-data +++ b/conform/data/limits.h-data @@ -20,13 +20,13 @@ macro-int-constant UINT_MAX {unsigned int} >= 4294967295U macro-int-constant LONG_MAX {long int} >= 2147483647L macro-int-constant LONG_MIN {long int} <= -2147483647L macro-int-constant ULONG_MAX {unsigned long int} >= 4294967295UL -#if defined ISO99 || defined ISO11 || defined XOPEN2K8 || defined POSIX2008 +#if defined ISO99 || defined ISO11 || defined ISO23 || defined XOPEN2K8 || defined POSIX2008 macro-int-constant LLONG_MIN {long long int} <= -9223372036854775807ll macro-int-constant LLONG_MAX {long long int} >= 9223372036854775807ll macro-int-constant ULLONG_MAX {unsigned long long int} >= 18446744073709551615ull #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 // if these values exist, we should check the minimal value allow AIO_LISTIO_MAX allow AIO_MAX diff --git a/conform/data/locale.h-data b/conform/data/locale.h-data index 266264ac6..df28e44 100644 --- a/conform/data/locale.h-data +++ b/conform/data/locale.h-data @@ -31,7 +31,7 @@ macro-constant NULL == 0 macro-int-constant LC_ALL macro-int-constant LC_COLLATE macro-int-constant LC_CTYPE -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 macro-int-constant LC_MESSAGES #endif macro-int-constant LC_MONETARY @@ -62,7 +62,7 @@ function locale_t uselocale (locale_t) #endif allow LC_[ABCDEFGHIJKLMNOPQRSTUVWXYZ]* -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif #if defined XOPEN2K8 || defined POSIX2008 diff --git a/conform/data/math.h-data b/conform/data/math.h-data index 0c50755..d177e9b 100644 --- a/conform/data/math.h-data +++ b/conform/data/math.h-data @@ -21,7 +21,7 @@ type double_t function int isnan (double) # endif -# if !defined ISO99 && !defined ISO11 && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX2008 constant M_E constant M_LOG2E constant M_LOG10E @@ -104,7 +104,7 @@ function double gamma (double) #endif #if !defined ISO && !defined POSIX function double hypot (double, double) -# if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function double j0 (double) function double j1 (double) function double jn (int, double) @@ -113,7 +113,7 @@ function double lgamma (double) # if !defined XPG4 && !defined XPG42 && !defined UNIX98 function double tgamma (double) # endif -# if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function double y0 (double) function double y1 (double) function double yn (int, double) @@ -157,7 +157,7 @@ function double nan (const char*) # endif # endif -# if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 // variable signgam allow signgam # endif @@ -327,7 +327,7 @@ allow tanl allow tanhl #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif #if !defined ISO && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 diff --git a/conform/data/monetary.h-data b/conform/data/monetary.h-data index 4f0cb9b..7a87041 100644 --- a/conform/data/monetary.h-data +++ b/conform/data/monetary.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX type size_t type ssize_t # if defined XOPEN2K8 || defined POSIX2008 diff --git a/conform/data/mqueue.h-data b/conform/data/mqueue.h-data index 42ccd85..6b5c15d 100644 --- a/conform/data/mqueue.h-data +++ b/conform/data/mqueue.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined XPG42 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined XPG42 // should test for not an array type. type mqd_t diff --git a/conform/data/ndbm.h-data b/conform/data/ndbm.h-data index 2ee7a59..1aa4423 100644 --- a/conform/data/ndbm.h-data +++ b/conform/data/ndbm.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 && !defined XPG4 type datum element datum {void*} dptr element datum size_t dsize diff --git a/conform/data/net/if.h-data b/conform/data/net/if.h-data index 8a4d89c..98e1bd7 100644 --- a/conform/data/net/if.h-data +++ b/conform/data/net/if.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 type {struct if_nameindex} element {struct if_nameindex} {unsigned int} if_index diff --git a/conform/data/netdb.h-data b/conform/data/netdb.h-data index c6d8b70..a6484ac 100644 --- a/conform/data/netdb.h-data +++ b/conform/data/netdb.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 optional-type in_port_t optional-type in_addr_t diff --git a/conform/data/netinet/in.h-data b/conform/data/netinet/in.h-data index ccc74db..ad1d0b3 100644 --- a/conform/data/netinet/in.h-data +++ b/conform/data/netinet/in.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 type in_port_t type in_addr_t diff --git a/conform/data/nl_types.h-data b/conform/data/nl_types.h-data index 67a0d7a..90ba794 100644 --- a/conform/data/nl_types.h-data +++ b/conform/data/nl_types.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX type nl_catd type nl_item diff --git a/conform/data/poll.h-data b/conform/data/poll.h-data index f7ebb91..d99c776 100644 --- a/conform/data/poll.h-data +++ b/conform/data/poll.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 type {struct pollfd} element {struct pollfd} int fd element {struct pollfd} {short int} events diff --git a/conform/data/pthread.h-data b/conform/data/pthread.h-data index 6b10499..09bf527 100644 --- a/conform/data/pthread.h-data +++ b/conform/data/pthread.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined XPG42 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined XPG42 constant PTHREAD_CANCEL_ASYNCHRONOUS constant PTHREAD_CANCEL_ENABLE constant PTHREAD_CANCEL_DEFERRED diff --git a/conform/data/pwd.h-data b/conform/data/pwd.h-data index e86433d..b2f8cbf 100644 --- a/conform/data/pwd.h-data +++ b/conform/data/pwd.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #ifdef POSIX # define uid_t __uid_t # define gid_t __gid_t diff --git a/conform/data/regex.h-data b/conform/data/regex.h-data index 04f9034..602f209 100644 --- a/conform/data/regex.h-data +++ b/conform/data/regex.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type regex_t element regex_t size_t re_nsub diff --git a/conform/data/sched.h-data b/conform/data/sched.h-data index 63e5eb2..639f129 100644 --- a/conform/data/sched.h-data +++ b/conform/data/sched.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined XPG42 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined XPG42 # if defined POSIX || defined UNIX98 # include "time.h-data" # else diff --git a/conform/data/search.h-data b/conform/data/search.h-data index e99f7e6..240be29 100644 --- a/conform/data/search.h-data +++ b/conform/data/search.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 type ENTRY type {struct entry} element {struct entry} {char*} key diff --git a/conform/data/semaphore.h-data b/conform/data/semaphore.h-data index 066c2f7..18afd16 100644 --- a/conform/data/semaphore.h-data +++ b/conform/data/semaphore.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined XPG42 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined XPG42 type sem_t constant SEM_FAILED diff --git a/conform/data/setjmp.h-data b/conform/data/setjmp.h-data index af28ddb..37bd9bd 100644 --- a/conform/data/setjmp.h-data +++ b/conform/data/setjmp.h-data @@ -1,10 +1,10 @@ type jmp_buf -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type sigjmp_buf #endif function void longjmp (jmp_buf, int) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 function void siglongjmp (sigjmp_buf, int) # if !defined POSIX && !defined POSIX2008 function void _longjmp (jmp_buf, int) @@ -12,13 +12,13 @@ function void _longjmp (jmp_buf, int) #endif macro-function int setjmp (jmp_buf) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 macro-function int sigsetjmp (sigjmp_buf, int) # if !defined POSIX && !defined POSIX2008 macro-function int _setjmp (jmp_buf) # endif #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/signal.h-data b/conform/data/signal.h-data index 3b00b76..4beb3d8 100644 --- a/conform/data/signal.h-data +++ b/conform/data/signal.h-data @@ -1,15 +1,15 @@ macro-constant SIG_DFL {void(*)(int)} macro-constant SIG_ERR {void(*)(int)} -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 macro-constant SIG_HOLD {void(*)(int)} #endif macro-constant SIG_IGN {void(*)(int)} type sig_atomic_t -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type sigset_t #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX type pid_t #elif defined POSIX # define pid_t __pid_t @@ -68,7 +68,7 @@ macro-int-constant SIGTERM {int} > 0 function void (*signal (int, void(*)(int)))(int) function int raise (int) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 macro-int-constant SIGALRM {int} > 0 macro-int-constant SIGHUP {int} > 0 macro-int-constant SIGKILL {int} > 0 diff --git a/conform/data/spawn.h-data b/conform/data/spawn.h-data index be69922..47b709b 100644 --- a/conform/data/spawn.h-data +++ b/conform/data/spawn.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 type posix_spawnattr_t type posix_spawn_file_actions_t # if defined XOPEN2K8 || defined POSIX2008 diff --git a/conform/data/stdalign.h-data b/conform/data/stdalign.h-data index edc2310..62eb704 100644 --- a/conform/data/stdalign.h-data +++ b/conform/data/stdalign.h-data @@ -1,4 +1,4 @@ -#if defined ISO11 +#if defined ISO11 || defined ISO23 macro alignas macro alignof macro-int-constant __alignas_is_defined {int} == 1 diff --git a/conform/data/stdarg.h-data b/conform/data/stdarg.h-data index 53addb9..c753745 100644 --- a/conform/data/stdarg.h-data +++ b/conform/data/stdarg.h-data @@ -5,10 +5,10 @@ macro va_start macro va_arg macro va_end -#if defined ISO99 || defined ISO11 || defined XOPEN2K || defined POSIX2008 || defined XOPEN2K8 +#if defined ISO99 || defined ISO11 || defined ISO23 || defined XOPEN2K || defined POSIX2008 || defined XOPEN2K8 macro va_copy #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/stdbool.h-data b/conform/data/stdbool.h-data index a030e9c..2a5a08f 100644 --- a/conform/data/stdbool.h-data +++ b/conform/data/stdbool.h-data @@ -4,7 +4,7 @@ macro-int-constant true {int} == 1 macro-int-constant false {int} == 0 macro-int-constant __bool_true_false_are_defined {int} == 1 -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif #endif diff --git a/conform/data/stddef.h-data b/conform/data/stddef.h-data index 9ded4f1..c7a80a8 100644 --- a/conform/data/stddef.h-data +++ b/conform/data/stddef.h-data @@ -6,10 +6,10 @@ type ptrdiff_t type wchar_t type size_t -#if defined ISO11 +#if defined ISO11 || defined ISO23 type max_align_t #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/stdio.h-data b/conform/data/stdio.h-data index 3ef2460..1be80b4 100644 --- a/conform/data/stdio.h-data +++ b/conform/data/stdio.h-data @@ -6,7 +6,7 @@ macro-int-constant _IOFBF macro-int-constant _IOLBF macro-int-constant _IONBF -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 constant L_ctermid # if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008 # ifdef POSIX @@ -28,7 +28,7 @@ macro-int-constant EOF < 0 macro-constant NULL == 0 -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 constant P_tmpdir #endif @@ -38,7 +38,7 @@ macro stderr {FILE *} type FILE type fpos_t -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX type va_list #else #define va_list __gnuc_va_list @@ -50,7 +50,7 @@ type ssize_t #endif function void clearerr (FILE*) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 function {char*} ctermid (char*) # if defined XPG4 || defined XPG42 || defined UNIX98 function {char*} cuserid (char*) @@ -60,7 +60,7 @@ function {char*} cuserid (char*) function int dprintf (int, const char*, ...) #endif function int fclose (FILE*) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 function {FILE*} fdopen (int, const char*) #endif function int feof (FILE*) @@ -69,7 +69,7 @@ function int fflush (FILE*) function int fgetc (FILE*) function int fgetpos (FILE*, fpos_t*) function {char*} fgets (char*, int, FILE*) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 function int fileno (FILE*) #endif #if defined POSIX || defined UNIX98 || defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008 @@ -112,7 +112,7 @@ function ssize_t getline (char**, size_t*, FILE*) #if defined XPG4 || defined XPG42 || defined UNIX98 function int getopt (int, char *const[], const char *) #endif -#if !defined ISO11 +#if !defined ISO11 && !defined ISO23 function {char*} gets (char*) #endif #if defined XPG4 || defined XPG42 || defined UNIX98 @@ -121,11 +121,11 @@ function int getw (FILE*) #if defined XOPEN2K8 || defined POSIX2008 function {FILE*} open_memstream (char**, size_t*) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 function int pclose (FILE*) #endif function void perror (const char*) -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 function {FILE*} popen (const char*, const char*) #endif function int printf (const char*, ...) @@ -178,7 +178,7 @@ function int vsprintf (char*, const char*, va_list) function int vsscanf (const char*, const char*, va_list) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #if !defined POSIX && !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008 variable {char*} optarg variable int opterr diff --git a/conform/data/stdlib.h-data b/conform/data/stdlib.h-data index 6913828..0f6da09 100644 --- a/conform/data/stdlib.h-data +++ b/conform/data/stdlib.h-data @@ -12,7 +12,7 @@ macro-constant NULL == 0 macro-int-constant RAND_MAX >= 32767 macro MB_CUR_MAX -#if defined ISO99 || defined ISO11 || defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008 +#if defined ISO99 || defined ISO11 || defined ISO23 || defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008 type lldiv_t element lldiv_t {long long} quot element lldiv_t {long long} rem @@ -20,7 +20,7 @@ element lldiv_t {long long} rem type size_t type wchar_t -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX constant WNOHANG constant WUNTRACED @@ -35,16 +35,16 @@ macro WTERMSIG #if !defined ISO && !defined XPG4 && !defined XPG42 && !defined UNIX98 && !defined POSIX function void _Exit (int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function long a64l (const char*) #endif function void abort (void) function int abs (int) -#if defined ISO11 +#if defined ISO11 || defined ISO23 function {void *} aligned_alloc (size_t, size_t) #endif function int atexit (void(*)(void)) -#if defined ISO11 +#if defined ISO11 || defined ISO23 function int at_quick_exit (void (*) (void)) #endif function double atof (const char*) @@ -56,13 +56,13 @@ function {long long} atoll (const char*) function {void*} bsearch (const void*, const void*, size_t, size_t, int(*)(const void*, const void*)) function {void*} calloc (size_t, size_t) function div_t div (int, int) -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function double drand48 (void) #endif #if defined XPG42 || defined UNIX98 || defined XOPEN2K function {char*} ecvt (double, int, int*, int*) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function double erand48 (unsigned short int[3]) #endif function void exit (int) @@ -74,21 +74,21 @@ function void free (void*) function {char*} gcvt (double, int, char*) #endif function {char*} getenv (const char*) -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX function int getsubopt (char**, char *const*, char**) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function int grantpt (int) function {char*} initstate (unsigned int, char*, size_t) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function {long int} jrand48 (unsigned short int[3]) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function {char*} l64a (long) #endif function {long int} labs (long int) -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function void lcong48 (unsigned short int[7]) #endif function ldiv_t ldiv (long int, long int) @@ -96,7 +96,7 @@ function ldiv_t ldiv (long int, long int) function {long long} llabs (long long) function lldiv_t lldiv (long long, long long) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function {long int} lrand48 (void) #endif function {void*} malloc (size_t) @@ -106,13 +106,13 @@ function int mbtowc (wchar_t*, const char*, size_t) #if defined XOPEN2K8 || defined POSIX2008 function {char*} mkdtemp (char*) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined XOPEN2K8 && !defined POSIX2008 function {char*} mktemp (char*) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX function int mkstemp (char*) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function {long int} mrand48 (void) function {long int} nrand48 (unsigned short int[3]) #endif @@ -122,41 +122,41 @@ function int posix_memalign (void**, size_t, size_t) #if defined XOPEN2K || defined XOPEN2K8 function int posix_openpt (int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function {char*} ptsname (int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function int putenv (char*) #endif function void qsort (void*, size_t, size_t, int(*)(const void*, const void*)) -#if defined ISO11 +#if defined ISO11 || defined ISO23 function void quick_exit (int) #endif function int rand (void) #if defined POSIX || defined UNIX98 || defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008 function int rand_r (unsigned int*) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function long random (void) #endif function {void*} realloc (void*, size_t) -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function {char*} realpath (const char*, char*) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function {unsigned short int*} seed48 (unsigned short int[3]) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 function int setenv (const char*, const char*, int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function {char*} setstate (char*) #endif function void srand (unsigned int) -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function void srand48 (long int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function void srandom (unsigned) #endif function double strtod (const char*, char**) @@ -174,10 +174,10 @@ function int system (const char*) #if defined XPG42 || defined UNIX98 function int ttyslot (void) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function int unlockpt (int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 function int unsetenv (const char*) #endif #if defined XPG42 || defined UNIX98 @@ -186,7 +186,7 @@ function {void*} valloc (size_t) function size_t wcstombs (char*, const wchar_t*, size_t) function int wctomb (char*, wchar_t) -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX allow-header stddef.h allow-header limits.h allow-header math.h @@ -194,6 +194,6 @@ allow-header sys/wait.h #endif allow str[abcdefghijklmnopqrstuvwxyz]* -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/stdnoreturn.h-data b/conform/data/stdnoreturn.h-data index 77b9a58..fa83c4f 100644 --- a/conform/data/stdnoreturn.h-data +++ b/conform/data/stdnoreturn.h-data @@ -1,3 +1,3 @@ -#if defined ISO11 +#if defined ISO11 || defined ISO23 macro noreturn #endif diff --git a/conform/data/string.h-data b/conform/data/string.h-data index e06f941..8cda133 100644 --- a/conform/data/string.h-data +++ b/conform/data/string.h-data @@ -5,7 +5,7 @@ type size_t type locale_t #endif -#if !defined ISO && !defined ISO99 & !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 & !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function {void*} memccpy (void*, const void*, int, size_t) #endif function {void*} memchr (const void*, int, size_t) @@ -27,7 +27,7 @@ function int strcoll_l (const char*, const char*, locale_t) #endif function {char*} strcpy (char*, const char*) function size_t strcspn (const char*, const char*) -#if !defined ISO && !defined ISO99 & !defined ISO11 && !defined XPG4 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 & !defined ISO11 && !defined ISO23 && !defined XPG4 && !defined POSIX && !defined POSIX2008 function {char*} strdup (const char*) #endif function {char*} strerror (int) @@ -61,13 +61,13 @@ function size_t strxfrm (char*, const char*, size_t) function size_t strxfrm_l (char*, const char*, size_t, locale_t) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX allow-header stddef.h #endif allow str[abcdefghijklmnopqrstuvwxyz]* allow mem[abcdefghijklmnopqrstuvwxyz]* allow wcs[abcdefghijklmnopqrstuvwxyz]* -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif diff --git a/conform/data/strings.h-data b/conform/data/strings.h-data index 13827eb..b5d352f 100644 --- a/conform/data/strings.h-data +++ b/conform/data/strings.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 # if !defined XOPEN2K8 && !defined POSIX2008 function int bcmp (const void*, const void*, size_t) function void bcopy (const void*, void*, size_t) diff --git a/conform/data/sys/ipc.h-data b/conform/data/sys/ipc.h-data index 1364b07..e157257 100644 --- a/conform/data/sys/ipc.h-data +++ b/conform/data/sys/ipc.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 type {struct ipc_perm} // Bug 23082: uid/gid/cuid/cgid/mode have type unsigned short instead of uid_t and mode_t. diff --git a/conform/data/sys/mman.h-data b/conform/data/sys/mman.h-data index a743883..b742b90 100644 --- a/conform/data/sys/mman.h-data +++ b/conform/data/sys/mman.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined XPG4 constant PROT_READ constant PROT_WRITE constant PROT_EXEC diff --git a/conform/data/sys/msg.h-data b/conform/data/sys/msg.h-data index f5e9f1c..93df6fd 100644 --- a/conform/data/sys/msg.h-data +++ b/conform/data/sys/msg.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 type {struct msqid_ds} type msgqnum_t diff --git a/conform/data/sys/resource.h-data b/conform/data/sys/resource.h-data index cedbee1..ba247e3 100644 --- a/conform/data/sys/resource.h-data +++ b/conform/data/sys/resource.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 && !defined XPG4 constant PRIO_PROCESS constant PRIO_PGRP constant PRIO_USER diff --git a/conform/data/sys/select.h-data b/conform/data/sys/select.h-data index 44d63eb..9406eae 100644 --- a/conform/data/sys/select.h-data +++ b/conform/data/sys/select.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined XPG42 && !defined UNIX98 type time_t type suseconds_t diff --git a/conform/data/sys/sem.h-data b/conform/data/sys/sem.h-data index a36ab1b..f34541c 100644 --- a/conform/data/sys/sem.h-data +++ b/conform/data/sys/sem.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 constant SEM_UNDO constant GETNCNT diff --git a/conform/data/sys/shm.h-data b/conform/data/sys/shm.h-data index 778b194..a9d2539 100644 --- a/conform/data/sys/shm.h-data +++ b/conform/data/sys/shm.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 constant SHM_RDONLY symbol SHMLBA constant SHM_RND diff --git a/conform/data/sys/socket.h-data b/conform/data/sys/socket.h-data index 8796c57..d00504b 100644 --- a/conform/data/sys/socket.h-data +++ b/conform/data/sys/socket.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 type socklen_t type sa_family_t diff --git a/conform/data/sys/stat.h-data b/conform/data/sys/stat.h-data index 03be481..ba80a5a 100644 --- a/conform/data/sys/stat.h-data +++ b/conform/data/sys/stat.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #if !defined POSIX && !defined POSIX2008 && !defined XPG4 && !defined XPG42 type blkcnt_t diff --git a/conform/data/sys/statvfs.h-data b/conform/data/sys/statvfs.h-data index 2a74813..712fbcf 100644 --- a/conform/data/sys/statvfs.h-data +++ b/conform/data/sys/statvfs.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 type {struct statvfs} element {struct statvfs} {unsigned long} f_bsize diff --git a/conform/data/sys/time.h-data b/conform/data/sys/time.h-data index 30523e1..df5b6b9 100644 --- a/conform/data/sys/time.h-data +++ b/conform/data/sys/time.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 && !defined XPG4 type {struct timeval} element {struct timeval} time_t tv_sec diff --git a/conform/data/sys/timeb.h-data b/conform/data/sys/timeb.h-data index 9638f73..a1db569 100644 --- a/conform/data/sys/timeb.h-data +++ b/conform/data/sys/timeb.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined POSIX2008 && !defined XOPEN2K8 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined POSIX2008 && !defined XOPEN2K8 type {struct timeb} element {struct timeb} time_t time diff --git a/conform/data/sys/times.h-data b/conform/data/sys/times.h-data index c93357b..c4c3edf 100644 --- a/conform/data/sys/times.h-data +++ b/conform/data/sys/times.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type {struct tms} element {struct tms} clock_t tms_utime diff --git a/conform/data/sys/types.h-data b/conform/data/sys/types.h-data index cc28eb7..3330f9e 100644 --- a/conform/data/sys/types.h-data +++ b/conform/data/sys/types.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #if !defined POSIX # if !defined XPG4 && !defined XPG42 type blkcnt_t diff --git a/conform/data/sys/uio.h-data b/conform/data/sys/uio.h-data index b9fc661..6da312c 100644 --- a/conform/data/sys/uio.h-data +++ b/conform/data/sys/uio.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined POSIX2008 type {struct iovec} element {struct iovec} {void*} iov_base diff --git a/conform/data/sys/un.h-data b/conform/data/sys/un.h-data index 08bf9bc..8114024 100644 --- a/conform/data/sys/un.h-data +++ b/conform/data/sys/un.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 type {struct sockaddr_un} element {struct sockaddr_un} sa_family_t sun_family diff --git a/conform/data/sys/utsname.h-data b/conform/data/sys/utsname.h-data index 82f7f39..f9045e3 100644 --- a/conform/data/sys/utsname.h-data +++ b/conform/data/sys/utsname.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type {struct utsname} element {struct utsname} char sysname [] diff --git a/conform/data/sys/wait.h-data b/conform/data/sys/wait.h-data index a671346..5998748 100644 --- a/conform/data/sys/wait.h-data +++ b/conform/data/sys/wait.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #ifdef POSIX # define pid_t __pid_t #endif diff --git a/conform/data/syslog.h-data b/conform/data/syslog.h-data index 6604d76..f72734d 100644 --- a/conform/data/syslog.h-data +++ b/conform/data/syslog.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 && !defined XPG4 constant LOG_PID constant LOG_CONS constant LOG_NDELAY diff --git a/conform/data/tar.h-data b/conform/data/tar.h-data index 8477860..43b2d05 100644 --- a/conform/data/tar.h-data +++ b/conform/data/tar.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 macro-str TMAGIC "ustar" macro-int-constant TMAGLEN {int} == 6 macro-str TVERSION "00" diff --git a/conform/data/termios.h-data b/conform/data/termios.h-data index bb2092b..87fbcb9 100644 --- a/conform/data/termios.h-data +++ b/conform/data/termios.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type cc_t type speed_t type tcflag_t diff --git a/conform/data/threads.h-data b/conform/data/threads.h-data index 406e497..a6ba414 100644 --- a/conform/data/threads.h-data +++ b/conform/data/threads.h-data @@ -1,4 +1,4 @@ -#if defined ISO11 +#if defined ISO11 || defined ISO23 macro ONCE_FLAG_INIT macro thread_local diff --git a/conform/data/time.h-data b/conform/data/time.h-data index 9c1c195..3b2846c 100644 --- a/conform/data/time.h-data +++ b/conform/data/time.h-data @@ -1,7 +1,7 @@ macro-constant NULL == 0 macro CLOCKS_PER_SEC {clock_t} -#ifdef ISO11 +#if defined ISO11 || defined ISO23 macro-int-constant TIME_UTC > 0 #endif @@ -38,11 +38,11 @@ function {char*} ctime (const time_t*) function {struct tm*} gmtime (const time_t*) function {struct tm*} localtime (const time_t*) function size_t strftime (char*, size_t, const char*, const struct tm*) -#if defined ISO11 +#if defined ISO11 || defined ISO23 function int timespec_get (struct timespec *, int) #endif -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 # if !defined XOPEN2K && !defined XOPEN2K8 && !defined POSIX2008 symbol CLK_TCK # endif diff --git a/conform/data/uchar.h-data b/conform/data/uchar.h-data index ef27617..14718ad 100644 --- a/conform/data/uchar.h-data +++ b/conform/data/uchar.h-data @@ -1,4 +1,4 @@ -#if defined ISO11 +#if defined ISO11 || defined ISO23 type mbstate_t type size_t type char16_t diff --git a/conform/data/ucontext.h-data b/conform/data/ucontext.h-data index e3dcb30..414635f 100644 --- a/conform/data/ucontext.h-data +++ b/conform/data/ucontext.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined XPG4 && !defined POSIX2008 && !defined XOPEN2K8 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined XPG4 && !defined POSIX2008 && !defined XOPEN2K8 type mcontext_t type ucontext_t diff --git a/conform/data/ulimit.h-data b/conform/data/ulimit.h-data index 1e5e5b4..fbe3ec2 100644 --- a/conform/data/ulimit.h-data +++ b/conform/data/ulimit.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 constant UL_GETFSIZE constant UL_SETFSIZE diff --git a/conform/data/unistd.h-data b/conform/data/unistd.h-data index aa07052..b453186 100644 --- a/conform/data/unistd.h-data +++ b/conform/data/unistd.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #ifdef POSIX # define uid_t __uid_t # define gid_t __gid_t diff --git a/conform/data/utime.h-data b/conform/data/utime.h-data index e320165..2ca26ef 100644 --- a/conform/data/utime.h-data +++ b/conform/data/utime.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 #ifdef POSIX # define time_t __time_t #endif diff --git a/conform/data/utmpx.h-data b/conform/data/utmpx.h-data index cfe2a08..28ad96a 100644 --- a/conform/data/utmpx.h-data +++ b/conform/data/utmpx.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 && !defined XPG4 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 && !defined XPG4 type {struct utmpx} element {struct utmpx} char ut_user [] diff --git a/conform/data/wchar.h-data b/conform/data/wchar.h-data index 2433210..4c8a2e3 100644 --- a/conform/data/wchar.h-data +++ b/conform/data/wchar.h-data @@ -1,11 +1,11 @@ #if !defined ISO && !defined POSIX && !defined XPG4 && !defined XPG42 type wchar_t type wint_t -# if !defined ISO99 && !defined ISO11 && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX2008 type wctype_t # endif type mbstate_t -# if !defined ISO99 && !defined ISO11 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 type FILE # else # define FILE __FILE @@ -15,7 +15,7 @@ type size_t type locale_t # endif tag {struct tm} -# if !defined ISO99 && !defined ISO11 && !defined UNIX98 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined UNIX98 type va_list # else # define va_list __gnuc_va_list @@ -24,7 +24,7 @@ type va_list function wint_t btowc (int) function int fwprintf (FILE*, const wchar_t*, ...) function int fwscanf (FILE*, const wchar_t*, ...) -# if !defined ISO99 && !defined ISO11 && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX2008 function int iswalnum (wint_t) function int iswalpha (wint_t) function int iswcntrl (wint_t) @@ -59,7 +59,7 @@ function wint_t putwc (wchar_t, FILE*) function wint_t putwchar (wchar_t) function int swprintf (wchar_t*, size_t, const wchar_t*, ...) function int swscanf (const wchar_t*, const wchar_t*, ...) -# if !defined ISO99 && !defined ISO11 && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX2008 function wint_t towlower (wint_t) function wint_t towupper (wint_t) # endif @@ -132,7 +132,7 @@ function {unsigned long long int} wcstoull (const wchar_t*, wchar_t**, int) # if defined UNIX98 || defined XOPEN2K function {wchar_t*} wcswcs (const wchar_t*, const wchar_t*) # endif -# if !defined ISO99 && !defined ISO11 && !defined POSIX && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX && !defined POSIX2008 function int wcswidth (const wchar_t*, size_t) # endif function size_t wcsxfrm (wchar_t*, const wchar_t*, size_t) @@ -140,7 +140,7 @@ function size_t wcsxfrm (wchar_t*, const wchar_t*, size_t) function size_t wcsxfrm_l (wchar_t*, const wchar_t*, size_t, locale_t) # endif function int wctob (wint_t) -# if !defined ISO99 && !defined ISO11 && !defined POSIX2008 +# if !defined ISO99 && !defined ISO11 && !defined ISO23 && !defined POSIX2008 function wctype_t wctype (const char*) function int wcwidth (wchar_t) # endif @@ -157,7 +157,7 @@ macro-int-constant WCHAR_MAX {promoted:wchar_t} >= 127 macro-constant WEOF {wint_t} macro-constant NULL == 0 -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow-header ctype.h allow-header stdio.h allow-header stdarg.h @@ -168,7 +168,7 @@ allow-header time.h #endif allow wcs[abcdefghijklmnopqrstuvwxyz]* -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif #endif diff --git a/conform/data/wctype.h-data b/conform/data/wctype.h-data index 944fe6e..f939f3c 100644 --- a/conform/data/wctype.h-data +++ b/conform/data/wctype.h-data @@ -49,7 +49,7 @@ function wctype_t wctype_l (const char*, locale_t) macro-constant WEOF {wint_t} -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow-header ctype.h allow-header stdio.h allow-header stdarg.h @@ -62,7 +62,7 @@ allow-header wchar.h allow is[abcdefghijklmnopqrstuvwxyz]* allow to[abcdefghijklmnopqrstuvwxyz]* -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 allow *_t #endif #endif diff --git a/conform/data/wordexp.h-data b/conform/data/wordexp.h-data index 0d96d68..eed4754 100644 --- a/conform/data/wordexp.h-data +++ b/conform/data/wordexp.h-data @@ -1,4 +1,4 @@ -#if !defined ISO && !defined ISO99 && !defined ISO11 +#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23 type wordexp_t element wordexp_t size_t we_wordc diff --git a/elf/Makefile b/elf/Makefile index 250348c..c3864ca 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -60,6 +60,7 @@ dl-routines = \ dl-deps \ dl-exception \ dl-execstack \ + dl-execstack-tunable \ dl-find_object \ dl-fini \ dl-init \ @@ -572,9 +573,11 @@ tests-execstack-yes = \ tst-execstack \ tst-execstack-needed \ tst-execstack-prog \ + tst-execstack-tunable \ # tests-execstack-yes tests-execstack-static-yes = \ - tst-execstack-prog-static + tst-execstack-prog-static \ + tst-execstack-prog-static-tunable \ # tests-execstack-static-yes ifeq (yes,$(run-built-tests)) tests-execstack-special-yes = \ @@ -2023,6 +2026,14 @@ LDFLAGS-tst-execstack-prog = -Wl,-z,execstack CFLAGS-tst-execstack-prog.c += -Wno-trampolines CFLAGS-tst-execstack-mod.c += -Wno-trampolines +# It expects loading a module with executable stack to work. +CFLAGS-tst-execstack-tunable.c += -DUSE_PTHREADS=0 -DDEFAULT_RWX_STACK=1 +$(objpfx)tst-execstack-tunable.out: $(objpfx)tst-execstack-mod.so +tst-execstack-tunable-ENV = GLIBC_TUNABLES=glibc.rtld.execstack=2 + +LDFLAGS-tst-execstack-prog-static-tunable = -Wl,-z,noexecstack +tst-execstack-prog-static-tunable-ENV = GLIBC_TUNABLES=glibc.rtld.execstack=2 + LDFLAGS-tst-execstack-prog-static = -Wl,-z,execstack ifeq ($(have-no-error-execstack),yes) LDFLAGS-tst-execstack-prog-static += -Wl,--no-error-execstack diff --git a/elf/dl-execstack-tunable.c b/elf/dl-execstack-tunable.c new file mode 100644 index 0000000..6cef1a3 --- /dev/null +++ b/elf/dl-execstack-tunable.c @@ -0,0 +1,39 @@ +/* Stack executability handling for GNU dynamic linker. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <ldsodefs.h> +#include <dl-tunables.h> + +void +_dl_handle_execstack_tunable (void) +{ + switch (TUNABLE_GET (glibc, rtld, execstack, int32_t, NULL)) + { + case stack_tunable_mode_disable: + if ((__glibc_unlikely (GL(dl_stack_flags)) & PF_X)) + _dl_fatal_printf ( +"Fatal glibc error: executable stack is not allowed\n"); + break; + + case stack_tunable_mode_force: + if (_dl_make_stack_executable (&__libc_stack_end) != 0) + _dl_fatal_printf ( +"Fatal glibc error: cannot enable executable stack as tunable requires"); + break; + } +} diff --git a/elf/dl-support.c b/elf/dl-support.c index c7860f3..7b2a1c3 100644 --- a/elf/dl-support.c +++ b/elf/dl-support.c @@ -331,9 +331,7 @@ _dl_non_dynamic_init (void) break; } - if ((__glibc_unlikely (GL(dl_stack_flags)) & PF_X) - && TUNABLE_GET (glibc, rtld, execstack, int32_t, NULL) == 0) - _dl_fatal_printf ("Fatal glibc error: executable stack is not allowed\n"); + _dl_handle_execstack_tunable (); call_function_static_weak (_dl_find_object_init); diff --git a/elf/dl-tunables.list b/elf/dl-tunables.list index 0b6721b..c03c996 100644 --- a/elf/dl-tunables.list +++ b/elf/dl-tunables.list @@ -138,7 +138,7 @@ glibc { execstack { type: INT_32 minval: 0 - maxval: 1 + maxval: 2 default: 1 } } @@ -1622,9 +1622,9 @@ dl_main (const ElfW(Phdr) *phdr, bool has_interp = rtld_setup_main_map (main_map); - if ((__glibc_unlikely (GL(dl_stack_flags)) & PF_X) - && TUNABLE_GET (glibc, rtld, execstack, int32_t, NULL) == 0) - _dl_fatal_printf ("Fatal glibc error: executable stack is not allowed\n"); + /* Handle this after PT_GNU_STACK parse, because it updates dl_stack_flags + if required. */ + _dl_handle_execstack_tunable (); /* If the current libname is different from the SONAME, add the latter as well. */ diff --git a/elf/tst-execstack-prog-static-tunable.c b/elf/tst-execstack-prog-static-tunable.c new file mode 100644 index 0000000..88b0ca1 --- /dev/null +++ b/elf/tst-execstack-prog-static-tunable.c @@ -0,0 +1 @@ +#include <tst-execstack-prog-static.c> diff --git a/elf/tst-execstack-tunable.c b/elf/tst-execstack-tunable.c new file mode 100644 index 0000000..9f03b0f --- /dev/null +++ b/elf/tst-execstack-tunable.c @@ -0,0 +1 @@ +#include <tst-execstack.c> diff --git a/elf/tst-rtld-list-tunables.exp b/elf/tst-rtld-list-tunables.exp index 9f5990f..8df6f59 100644 --- a/elf/tst-rtld-list-tunables.exp +++ b/elf/tst-rtld-list-tunables.exp @@ -13,6 +13,6 @@ glibc.malloc.top_pad: 0x20000 (min: 0x0, max: 0x[f]+) glibc.malloc.trim_threshold: 0x0 (min: 0x0, max: 0x[f]+) glibc.rtld.dynamic_sort: 2 (min: 1, max: 2) glibc.rtld.enable_secure: 0 (min: 0, max: 1) -glibc.rtld.execstack: 1 (min: 0, max: 1) +glibc.rtld.execstack: 1 (min: 0, max: 2) glibc.rtld.nns: 0x4 (min: 0x1, max: 0x10) glibc.rtld.optional_static_tls: 0x200 (min: 0x0, max: 0x[f]+) diff --git a/hurd/Makefile b/hurd/Makefile index cf70b8c..cbc3c23 100644 --- a/hurd/Makefile +++ b/hurd/Makefile @@ -19,6 +19,11 @@ subdir := hurd include ../Makeconfig +tests := test-sig-xstate \ + test-sig-rpc-interrupted +$(objpfx)test-sig-xstate: $(shared-thread-library) +$(objpfx)test-sig-rpc-interrupted: $(shared-thread-library) $(objdir)/hurd/libhurduser.so + headers = \ $(interface-headers) \ hurd.h \ diff --git a/hurd/test-sig-rpc-interrupted.c b/hurd/test-sig-rpc-interrupted.c new file mode 100644 index 0000000..a89d70e --- /dev/null +++ b/hurd/test-sig-rpc-interrupted.c @@ -0,0 +1,185 @@ +/* Test the state save/restore procedures during signal handling when an + interruptible RPC is restarted. + + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + + +#include <assert.h> +#include <pthread.h> +#include <signal.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <mach/message.h> +#include <mach/gnumach.h> +#include <mach/mach_traps.h> +#include <mach/mig_errors.h> +#include <mach-shortcuts.h> +#include <mach_init.h> +#include <hurd/io.h> +#include <hurd/io_reply.h> + +#include <support/check.h> +#include <support/xthread.h> + +#include "test-xstate.h" + +void handler (int signum, siginfo_t *info, void *context) +{ + printf ("signal %d setting a different CPU state\n", signum); + char buf3[XSTATE_BUFFER_SIZE]; + memset (buf3, 0x77, XSTATE_BUFFER_SIZE); + SET_XSTATE (buf3); +} + +static const mach_msg_type_t RetCodeCheck = { + .msgt_name = (unsigned char) MACH_MSG_TYPE_INTEGER_32, + .msgt_size = 32, + .msgt_number = 1, + .msgt_inline = TRUE, + .msgt_longform = FALSE, + .msgt_deallocate = FALSE, + .msgt_unused = 0 +}; + + +/* Helper thread to simulate a proper RPC interruption during dignal handling */ +void* fake_interruptor (void *arg) +{ + int err; + sigset_t ss; + TEST_COMPARE (sigemptyset (&ss), 0); + TEST_COMPARE (sigaddset (&ss, SIGUSR1), 0); + TEST_COMPARE (sigprocmask (SIG_BLOCK, &ss, NULL), 0); + + struct { + mach_msg_header_t Head; + } request; + mach_port_t rxport = *((mach_port_t*)arg); + err = mach_msg (&request.Head, MACH_RCV_MSG, 0, sizeof (request), rxport, + MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + TEST_COMPARE (err, MACH_MSG_SUCCESS); + TEST_COMPARE (request.Head.msgh_bits, 0x1112); + TEST_COMPARE (request.Head.msgh_size, sizeof (request.Head)); + TEST_COMPARE (request.Head.msgh_id, 33000); + + mig_reply_header_t reply; + reply.Head = request.Head; + reply.Head.msgh_id += 100; + reply.RetCodeType = RetCodeCheck; + reply.RetCode = KERN_SUCCESS; + err = mach_msg (&reply.Head, MACH_SEND_MSG, sizeof (reply), 0, MACH_PORT_NULL, + MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + TEST_COMPARE (err, MACH_MSG_SUCCESS); + + return NULL; +} + + +/* Helper thread to send a signal to the main thread in the middle of + * an interruptible rpc */ +void* signal_sender (void *arg) +{ + int err; + sigset_t ss; + TEST_COMPARE (sigemptyset (&ss), 0); + TEST_COMPARE (sigaddset (&ss, SIGUSR1), 0); + TEST_COMPARE (sigprocmask (SIG_BLOCK, &ss, NULL), 0); + + /* Receive the first request, we won't answer to this. */ + struct { + mach_msg_header_t head; + char data[64]; + } m1, m2; + mach_port_t rxport = *((mach_port_t*)arg); + memset (&m1, 0, sizeof (m1)); + memset (&m2, 0, sizeof (m2)); + err = mach_msg (&m1.head, MACH_RCV_MSG, 0, sizeof (m1), rxport, + MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + TEST_COMPARE (err, MACH_MSG_SUCCESS); + + /* interrupt the ongoing rpc with a signal, using the + * interruptible rpc protocol */ + pthread_t thintr = xpthread_create (NULL, fake_interruptor, arg); + TEST_COMPARE (kill (getpid (), SIGUSR1), 0); + xpthread_join (thintr); + + /* Complete the interruption by sending EINTR */ + mig_reply_header_t reply; + reply.Head = m1.head; + reply.Head.msgh_id += 100; + reply.RetCodeType = RetCodeCheck; + reply.RetCode = EINTR; + err = mach_msg (&reply.Head, MACH_SEND_MSG, sizeof (reply), 0, MACH_PORT_NULL, + MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + TEST_COMPARE (err, MACH_MSG_SUCCESS); + + /* Receive the retried rpc, and check that it has the same payload + * as the first one. Port names might still be different. */ + err = mach_msg (&m2.head, MACH_RCV_MSG, 0, sizeof (m2), rxport, + MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + TEST_COMPARE (m1.head.msgh_bits, m2.head.msgh_bits); + TEST_COMPARE (m1.head.msgh_size, m2.head.msgh_size); + TEST_COMPARE (m1.head.msgh_id, m2.head.msgh_id); + TEST_COMPARE_BLOB (m1.data, sizeof (m1.data), m2.data, sizeof (m2.data)); + + /* And finally make the rpc succeed by sending a valid reply */ + err = io_read_reply (m2.head.msgh_remote_port, MACH_MSG_TYPE_MOVE_SEND_ONCE, + KERN_SUCCESS, NULL, 0); + TEST_COMPARE (err, MACH_MSG_SUCCESS); + + return NULL; +} + + +static int do_test (void) +{ +#if ! XSTATE_HELPERS_SUPPORTED + FAIL_UNSUPPORTED ("Test not supported on this arch."); +#endif + + /* Setup signal handling; we need to handle the signal in the main + * thread, the other ones will explicitely block SIGUSR1. */ + struct sigaction act = { 0 }; + act.sa_flags = SA_RESTART; + act.sa_sigaction = &handler; + TEST_COMPARE (sigaction (SIGUSR1, &act, NULL), 0); + + mach_port_t fakeio; + int err; + err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &fakeio); + TEST_COMPARE (err, MACH_MSG_SUCCESS); + + err = mach_port_insert_right (mach_task_self (), fakeio, fakeio, + MACH_MSG_TYPE_MAKE_SEND); + TEST_COMPARE (err, MACH_MSG_SUCCESS); + + pthread_t thsender = xpthread_create (NULL, signal_sender, &fakeio); + + char *buf; + mach_msg_type_number_t n; + TEST_COMPARE (io_read (fakeio, &buf, &n, 1, 2), 0); + + xpthread_join (thsender); + return EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/hurd/test-sig-xstate.c b/hurd/test-sig-xstate.c new file mode 100644 index 0000000..0a68a44 --- /dev/null +++ b/hurd/test-sig-xstate.c @@ -0,0 +1,94 @@ +/* Test the state save/restore procedures during signal handling. + + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + + +#include <assert.h> +#include <pthread.h> +#include <signal.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <mach/message.h> +#include <mach/gnumach.h> +#include <mach/mach_traps.h> +#include <mach-shortcuts.h> +#include <mach_init.h> +#include <hurd/io.h> +#include <hurd/io_reply.h> + +#include <support/check.h> +#include <support/xthread.h> + +#include "test-xstate.h" + +static volatile bool loopflag = true; + +void handler (int signum, siginfo_t *info, void *context) +{ + char buf3[XSTATE_BUFFER_SIZE]; + memset (buf3, 0x77, XSTATE_BUFFER_SIZE); + SET_XSTATE (buf3); + printf ("signal %d setting a different CPU state\n", signum); + loopflag = false; +} + +/* Helper thread to send a signal to the main thread */ +void* signal_sender (void *arg) +{ + sigset_t ss; + assert (! sigemptyset (&ss)); + assert (! sigaddset (&ss, SIGUSR1)); + assert (! sigprocmask (SIG_BLOCK, &ss, NULL)); + + TEST_COMPARE (kill (getpid (), SIGUSR1), 0); + + return NULL; +} + +static int do_test (void) +{ +#if ! XSTATE_HELPERS_SUPPORTED + FAIL_UNSUPPORTED ("Test not supported on this arch."); +#endif + + struct sigaction act = { 0 }; + act.sa_sigaction = &handler; + TEST_COMPARE (sigaction (SIGUSR1, &act, NULL), 0); + + pthread_t thsender = xpthread_create (NULL, signal_sender, NULL); + + char buf1[XSTATE_BUFFER_SIZE], buf2[XSTATE_BUFFER_SIZE]; + memset (buf1, 0x33, XSTATE_BUFFER_SIZE); + + SET_XSTATE (buf1); + + while (loopflag) + ; + + GET_XSTATE (buf2); + TEST_COMPARE_BLOB (buf1, sizeof (buf1), buf2, sizeof (buf2)); + + xpthread_join (thsender); + return EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/hurd/test-xstate.h b/hurd/test-xstate.h new file mode 100644 index 0000000..a8185dc --- /dev/null +++ b/hurd/test-xstate.h @@ -0,0 +1,40 @@ +/* Helpers to test XSTATE during signal handling + + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#ifndef _TEST_XSTATE_H +#define _TEST_XSTATE_H + +#if defined __x86_64__ || defined __i386__ +#define XSTATE_HELPERS_SUPPORTED 1 +#define XSTATE_BUFFER_SIZE 16 +#define SET_XSTATE(b) do { \ + asm volatile ("movups (%0),%%xmm0" :: "r" (b)); \ + } while (0) + +#define GET_XSTATE(b) do { \ + asm volatile ("movups %%xmm0,(%0)" :: "r" (b)); \ + } while (0) + +#else +#define XSTATE_HELPERS_SUPPORTED 0 +#define XSTATE_BUFFER_SIZE 1 +#define SET_XSTATE(b) +#endif + +#endif /* _TEST_XSTATE_H */ diff --git a/libio/Makefile b/libio/Makefile index e143ccd..f020f8e 100644 --- a/libio/Makefile +++ b/libio/Makefile @@ -101,6 +101,8 @@ tests = \ tst-fclose-unopened \ tst-fclose-unopened2 \ tst-fdopen-seek-failure \ + tst-fflush \ + tst-fflush-NULL \ tst-fgetc-after-eof \ tst-fgetwc \ tst-fgetws \ diff --git a/libio/fileops.c b/libio/fileops.c index a59e248..0cce828 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -928,6 +928,16 @@ do_ftell (FILE *fp) if (result == EOF) return result; + if (result == 0 && offset < 0) + { + /* This happens for some character devices that always report + file offset 0 even after some data has been read (instead of + failing with ESPIPE). The fclose path ignores this + error. */ + __set_errno (ESPIPE); + return EOF; + } + result += offset; if (result < 0) diff --git a/libio/tst-fflush-NULL.c b/libio/tst-fflush-NULL.c new file mode 100644 index 0000000..4c8fe7c --- /dev/null +++ b/libio/tst-fflush-NULL.c @@ -0,0 +1,24 @@ +/* Test that fflush (FILE) and fflush (NULL) are semantically equivalent. + This is the `fflush (NULL)` part. + + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define FILE_FLUSH_TYPE 0 +#define S_FLUSH_TYPE "NULL" + +#include "tst-fflush-skeleton.c" diff --git a/libio/tst-fflush-skeleton.c b/libio/tst-fflush-skeleton.c new file mode 100644 index 0000000..6341d3d --- /dev/null +++ b/libio/tst-fflush-skeleton.c @@ -0,0 +1,158 @@ +/* Test that fflush (FILE) and fflush (NULL) are semantically equivalent. + + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +/* A success on this test doesn't imply the effectiveness of fflush as + we can't ensure that the file wasn't already in the expected state + before the call of the function. It only ensures that, if the test + fails, fflush is broken. */ + +#include <assert.h> +#include <fcntl.h> +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + +#include <sys/stat.h> +#include <sys/mman.h> + +#include <support/check.h> +#include <support/support.h> +#include <support/temp_file.h> +#include <support/test-driver.h> +#include <support/xstdio.h> +#include <support/xunistd.h> + +#define CONTENT_SZ_MAX 32 +#define TEST_FILE_COUNT 10 + +struct file_tracking +{ + FILE *file; + char *name; + int fd; + char *mfile; +} files[TEST_FILE_COUNT]; + +static void +file_init (int file) +{ + int fd = -1; + + assert (file < TEST_FILE_COUNT); + + files[file] = (struct file_tracking) { .fd = -1, }; + + xclose (create_temp_file ("tst-fflush", &files[file].name)); + + fd = xopen (files[file].name, O_RDONLY, 0); + files[file].mfile = xmmap (NULL, CONTENT_SZ_MAX, PROT_READ, MAP_SHARED, fd); + xclose (fd); +} + +static void +file_cleanup (int file) +{ + free (files[file].name); + xmunmap (files[file].mfile, CONTENT_SZ_MAX); + files[file] = (struct file_tracking) { .fd = -1, }; +} + +static void +file_changed (int to_check, const char *mode) +{ + struct stat stats = { }; + char expected[CONTENT_SZ_MAX] = { }; + + verbose_printf ("Check that %s (%d) exactly contains the data we put in\n", + files[to_check].name, to_check); + + /* File should contain "N:M" where both N and M are one digit exactly. */ + snprintf (expected, sizeof (expected), "%d:%d", FILE_FLUSH_TYPE, to_check); + TEST_COMPARE_BLOB (files[to_check].mfile, sizeof (expected), + expected, sizeof (expected)); + + TEST_VERIFY (fstat (files[to_check].fd, &stats) >= 0); + TEST_VERIFY (stats.st_size == 3); + /* In read mode we expect to be at position 1, in write mode at position 3 */ + TEST_COMPARE (lseek (files[to_check].fd, 0, SEEK_CUR), + mode[0] == 'r' ? 1 : 3); + + if (support_record_failure_is_failed ()) + FAIL_EXIT1 ("exiting due to previous failure"); + + /* Not reached if the data doesn't match. */ +} + +static void +file_flush (const char *mode) +{ + for (int i = 0; i < TEST_FILE_COUNT; i++) + { + files[i].file = xfopen (files[i].name, mode); + files[i].fd = fileno (files[i].file); + } + + /* Print a unique identifier in each file, that is not too long nor contain + new line to not trigger _IO_OVERFLOW/_IO_SYNC. */ + for (int i = 0; i < TEST_FILE_COUNT; i++) + { + if (mode[0] == 'r') + fgetc (files[i].file); + else + fprintf (files[i].file, "%d:%d", FILE_FLUSH_TYPE, i); + } + + if (!FILE_FLUSH_TYPE) + TEST_VERIFY (fflush (NULL) == 0); + else + for (int i = 0; i < TEST_FILE_COUNT; i++) + TEST_VERIFY (fflush (files[i].file) == 0); + + for (int i = 0; i < TEST_FILE_COUNT; i++) + { + verbose_printf ("Check that file %s has been modified after fflush\n", + files[i].name); + file_changed (i, mode); + } + + for (int i = 0; i < TEST_FILE_COUNT; i++) + xfclose (files[i].file); +} + +static int +do_test (void) +{ + for (int i = 0; i < TEST_FILE_COUNT; i++) + file_init (i); + + verbose_printf ("Checking fflush(" S_FLUSH_TYPE "), WRITE mode\n"); + file_flush ("w"); + + verbose_printf ("Checking fflush(" S_FLUSH_TYPE "), READWRITE mode\n"); + file_flush ("r+"); + + for (int i = 0; i < TEST_FILE_COUNT; i++) + file_cleanup (i); + + return 0; +} + +#include <support/test-driver.c> diff --git a/libio/tst-fflush.c b/libio/tst-fflush.c new file mode 100644 index 0000000..d3a4b78 --- /dev/null +++ b/libio/tst-fflush.c @@ -0,0 +1,24 @@ +/* Test that fflush (FILE) and fflush (NULL) are semantically equivalent. + This is the `fflush (FILE)` part. + + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#define FILE_FLUSH_TYPE 1 +#define S_FLUSH_TYPE "FILE" + +#include "tst-fflush-skeleton.c" diff --git a/malloc/malloc-check.c b/malloc/malloc-check.c index 814a916..c5265ec 100644 --- a/malloc/malloc-check.c +++ b/malloc/malloc-check.c @@ -235,7 +235,7 @@ free_check (void *mem) { /* Mark the chunk as belonging to the library again. */ (void)tag_region (chunk2mem (p), memsize (p)); - _int_free (&main_arena, p, 1); + _int_free_chunk (&main_arena, p, chunksize (p), 1); __libc_lock_unlock (main_arena.mutex); } __set_errno (err); diff --git a/malloc/malloc.c b/malloc/malloc.c index a0bc733..23b9306 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1086,8 +1086,6 @@ typedef struct malloc_chunk* mchunkptr; /* Internal routines. */ static void* _int_malloc(mstate, size_t); -static void _int_free (mstate, mchunkptr, int); -static void _int_free_check (mstate, mchunkptr, INTERNAL_SIZE_T); static void _int_free_chunk (mstate, mchunkptr, INTERNAL_SIZE_T, int); static void _int_free_merge_chunk (mstate, mchunkptr, INTERNAL_SIZE_T); static INTERNAL_SIZE_T _int_free_create_chunk (mstate, @@ -1101,6 +1099,9 @@ static void* _int_memalign(mstate, size_t, size_t); static void* _mid_memalign(size_t, size_t, void *); #endif +#if USE_TCACHE +static void malloc_printerr_tail(const char *str); +#endif static void malloc_printerr(const char *str) __attribute__ ((noreturn)); static void munmap_chunk(mchunkptr p); @@ -1273,7 +1274,6 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ sysmalloc: Returns untagged memory. _int_malloc: Returns untagged memory. - _int_free: Takes untagged memory. _int_memalign: Returns untagged memory. _int_memalign: Returns untagged memory. _mid_memalign: Returns tagged memory. @@ -3163,7 +3163,7 @@ tcache_put (mchunkptr chunk, size_t tc_idx) { tcache_entry *e = (tcache_entry *) chunk2mem (chunk); - /* Mark this chunk as "in the tcache" so the test in _int_free will + /* Mark this chunk as "in the tcache" so the test in __libc_free will detect a double free. */ e->key = tcache_key; @@ -3241,37 +3241,12 @@ tcache_double_free_verify (tcache_entry *e, size_t tc_idx) malloc_printerr ("free(): unaligned chunk detected in tcache 2"); if (tmp == e) malloc_printerr ("free(): double free detected in tcache 2"); - /* If we get here, it was a coincidence. We've wasted a - few cycles, but don't abort. */ } -} - -/* Try to free chunk to the tcache, if success return true. - Caller must ensure that chunk and size are valid. */ -static __always_inline bool -tcache_free (mchunkptr p, INTERNAL_SIZE_T size) -{ - bool done = false; - size_t tc_idx = csize2tidx (size); - if (tcache != NULL && tc_idx < mp_.tcache_bins) - { - /* Check to see if it's already in the tcache. */ - tcache_entry *e = (tcache_entry *) chunk2mem (p); - - /* This test succeeds on double free. However, we don't 100% - trust it (it also matches random payload data at a 1 in - 2^<size_t> chance), so verify it's not an unlikely - coincidence before aborting. */ - if (__glibc_unlikely (e->key == tcache_key)) - tcache_double_free_verify (e, tc_idx); - - if (tcache->counts[tc_idx] < mp_.tcache_count) - { - tcache_put (p, tc_idx); - done = true; - } - } - return done; + /* No double free detected - it might be in a tcache of another thread, + or user data that happens to match the key. Since we are not sure, + clear the key and retry freeing it. */ + e->key = 0; + __libc_free (e); } static void @@ -3316,6 +3291,11 @@ tcache_init(void) if (tcache_shutting_down) return; + /* Check minimum mmap chunk is larger than max tcache size. This means + mmap chunks with their different layout are never added to tcache. */ + if (MAX_TCACHE_SIZE >= GLRO (dl_pagesize) / 2) + malloc_printerr ("max tcache size too large"); + arena_get (ar_ptr, bytes); victim = _int_malloc (ar_ptr, bytes); if (!victim && ar_ptr != NULL) @@ -3361,13 +3341,15 @@ tcache_try_malloc (size_t bytes, void **memptr) size_t tc_idx = csize2tidx (tbytes); - MAYBE_INIT_TCACHE (); - if (tcache_available (tc_idx)) - *memptr = tcache_get (tc_idx); + { + *memptr = tcache_get (tc_idx); + return false; + } else *memptr = NULL; + MAYBE_INIT_TCACHE (); return false; } @@ -3442,7 +3424,6 @@ libc_hidden_def (__libc_malloc) void __libc_free (void *mem) { - mstate ar_ptr; mchunkptr p; /* chunk corresponding to mem */ if (mem == NULL) /* free(0) has no effect */ @@ -3453,37 +3434,41 @@ __libc_free (void *mem) if (__glibc_unlikely (mtag_enabled)) *(volatile char *)mem; - int err = errno; - p = mem2chunk (mem); - if (chunk_is_mmapped (p)) /* release mmapped memory. */ - { - /* See if the dynamic brk/mmap threshold needs adjusting. - Dumped fake mmapped chunks do not affect the threshold. */ - if (!mp_.no_dyn_threshold - && chunksize_nomask (p) > mp_.mmap_threshold - && chunksize_nomask (p) <= DEFAULT_MMAP_THRESHOLD_MAX) - { - mp_.mmap_threshold = chunksize (p); - mp_.trim_threshold = 2 * mp_.mmap_threshold; - LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2, - mp_.mmap_threshold, mp_.trim_threshold); - } - munmap_chunk (p); - } - else + /* Mark the chunk as belonging to the library again. */ + tag_region (chunk2mem (p), memsize (p)); + + INTERNAL_SIZE_T size = chunksize (p); + + if (__glibc_unlikely (misaligned_chunk (p))) + return malloc_printerr_tail ("free(): invalid pointer"); + + check_inuse_chunk (arena_for_chunk (p), p); + +#if USE_TCACHE + size_t tc_idx = csize2tidx (size); + + if (__glibc_likely (tcache != NULL && tc_idx < mp_.tcache_bins)) { - MAYBE_INIT_TCACHE (); + /* Check to see if it's already in the tcache. */ + tcache_entry *e = (tcache_entry *) chunk2mem (p); - /* Mark the chunk as belonging to the library again. */ - (void)tag_region (chunk2mem (p), memsize (p)); + /* Check for double free - verify if the key matches. */ + if (__glibc_unlikely (e->key == tcache_key)) + return tcache_double_free_verify (e, tc_idx); - ar_ptr = arena_for_chunk (p); - _int_free (ar_ptr, p, 0); + if (__glibc_likely (tcache->counts[tc_idx] < mp_.tcache_count)) + return tcache_put (p, tc_idx); } +#endif - __set_errno (err); + /* Check size >= MINSIZE and p + size does not overflow. */ + if (__glibc_unlikely (__builtin_add_overflow_p ((uintptr_t) p, size - MINSIZE, + (uintptr_t) 0))) + return malloc_printerr_tail ("free(): invalid size"); + + _int_free_chunk (arena_for_chunk (p), p, size, 0); } libc_hidden_def (__libc_free) @@ -3696,8 +3681,6 @@ _mid_memalign (size_t alignment, size_t bytes, void *address) } size_t tc_idx = csize2tidx (tbytes); - MAYBE_INIT_TCACHE (); - if (tcache_available (tc_idx)) { /* The tcache itself isn't encoded, but the chain is. */ @@ -3714,6 +3697,7 @@ _mid_memalign (size_t alignment, size_t bytes, void *address) return tag_new_usable (victim); } } + MAYBE_INIT_TCACHE (); } #endif @@ -4560,24 +4544,6 @@ _int_malloc (mstate av, size_t bytes) ------------------------------ free ------------------------------ */ -static __always_inline void -_int_free_check (mstate av, mchunkptr p, INTERNAL_SIZE_T size) -{ - /* Little security check which won't hurt performance: the - allocator never wraps around at the end of the address space. - Therefore we can exclude some size values which might appear - here by accident or by "design" from some intruder. */ - if (__builtin_expect ((uintptr_t) p > (uintptr_t) -size, 0) - || __builtin_expect (misaligned_chunk (p), 0)) - malloc_printerr ("free(): invalid pointer"); - /* We know that each chunk is at least MINSIZE bytes in size or a - multiple of MALLOC_ALIGNMENT. */ - if (__glibc_unlikely (size < MINSIZE || !aligned_OK (size))) - malloc_printerr ("free(): invalid size"); - - check_inuse_chunk (av, p); -} - /* Free chunk P of SIZE bytes to the arena. HAVE_LOCK indicates where the arena for P has already been locked. Caller must ensure chunk and size are valid. */ @@ -4669,6 +4635,9 @@ _int_free_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size, int have_lock) else if (!chunk_is_mmapped(p)) { + /* Preserve errno in case block merging results in munmap. */ + int err = errno; + /* If we're single-threaded, don't lock the arena. */ if (SINGLE_THREAD_P) have_lock = true; @@ -4680,35 +4649,34 @@ _int_free_chunk (mstate av, mchunkptr p, INTERNAL_SIZE_T size, int have_lock) if (!have_lock) __libc_lock_unlock (av->mutex); + + __set_errno (err); } /* If the chunk was allocated via mmap, release via munmap(). */ else { - munmap_chunk (p); - } -} -/* Free chunk P to its arena AV. HAVE_LOCK indicates where the arena for - P has already been locked. It will perform sanity check, then try the - fast path to free into tcache. If the attempt not success, free the - chunk to arena. */ -static __always_inline void -_int_free (mstate av, mchunkptr p, int have_lock) -{ - INTERNAL_SIZE_T size; /* its size */ - - size = chunksize (p); + /* Preserve errno in case munmap sets it. */ + int err = errno; - _int_free_check (av, p, size); + /* See if the dynamic brk/mmap threshold needs adjusting. + Dumped fake mmapped chunks do not affect the threshold. */ + if (!mp_.no_dyn_threshold + && chunksize_nomask (p) > mp_.mmap_threshold + && chunksize_nomask (p) <= DEFAULT_MMAP_THRESHOLD_MAX) + { + mp_.mmap_threshold = chunksize (p); + mp_.trim_threshold = 2 * mp_.mmap_threshold; + LIBC_PROBE (memory_mallopt_free_dyn_thresholds, 2, + mp_.mmap_threshold, mp_.trim_threshold); + } -#if USE_TCACHE - if (tcache_free (p, size)) - return; -#endif + munmap_chunk (p); - _int_free_chunk (av, p, size, have_lock); + __set_errno (err); + } } /* Try to merge chunk P of SIZE bytes with its neighbors. Put the @@ -5845,6 +5813,17 @@ malloc_printerr (const char *str) __builtin_unreachable (); } +#if USE_TCACHE +static __attribute_noinline__ void +malloc_printerr_tail (const char *str) +{ + /* Ensure this cannot be a no-return function. */ + if (!__malloc_initialized) + return; + malloc_printerr (str); +} +#endif + #if IS_IN (libc) /* We need a wrapper function for one of the additions of POSIX. */ int diff --git a/manual/arith.texi b/manual/arith.texi index 034d9d2..d500dcf 100644 --- a/manual/arith.texi +++ b/manual/arith.texi @@ -1233,25 +1233,33 @@ whose imaginary part is @var{y}, the absolute value is @w{@code{sqrt @pindex math.h @pindex stdlib.h -Prototypes for @code{abs}, @code{labs} and @code{llabs} are in @file{stdlib.h}; -@code{imaxabs} is declared in @file{inttypes.h}; +Prototypes for @code{abs}, @code{labs}, @code{llabs}, +@code{uabs}, @code{ulabs} and @code{ullabs} are in @file{stdlib.h}; +@code{imaxabs} and @code{uimaxabs} are declared in @file{inttypes.h}; the @code{fabs} functions are declared in @file{math.h}; the @code{cabs} functions are declared in @file{complex.h}. @deftypefun int abs (int @var{number}) @deftypefunx {long int} labs (long int @var{number}) @deftypefunx {long long int} llabs (long long int @var{number}) +@deftypefunx {unsigned int} uabs (int @var{number}) +@deftypefunx {unsigned long int} ulabs (long int @var{number}) +@deftypefunx {unsigned long long int} ullabs (long long int @var{number}) @deftypefunx intmax_t imaxabs (intmax_t @var{number}) +@deftypefunx uintmax_t uimaxabs (intmax_t @var{number}) @standards{ISO, stdlib.h} @standardsx{imaxabs, ISO, inttypes.h} +@standardsx{uimaxabs, ISO, inttypes.h} @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} These functions return the absolute value of @var{number}. Most computers use a two's complement integer representation, in which the absolute value of @code{INT_MIN} (the smallest possible @code{int}) cannot be represented; thus, @w{@code{abs (INT_MIN)}} is not defined. +Using @code{uabs} avoids this. @code{llabs} and @code{imaxdiv} are new to @w{ISO C99}. +@code{uabs}, @code{ulabs}, @code{ullabs} and @code{uimaxabs} are new to @w{ISO C2Y}. See @ref{Integers} for a description of the @code{intmax_t} type. diff --git a/manual/stdio.texi b/manual/stdio.texi index 01b9f47..29ed720 100644 --- a/manual/stdio.texi +++ b/manual/stdio.texi @@ -1231,17 +1231,18 @@ convenient to have functions to read a line of text from a stream. Standard C has functions to do this, but they aren't very safe: null characters and even (for @code{gets}) long lines can confuse them. So -@theglibc{} provides the nonstandard @code{getline} function that -makes it easy to read lines reliably. +@theglibc{} provides the @code{getline} function that makes it easy to +read lines reliably. -Another GNU extension, @code{getdelim}, generalizes @code{getline}. It -reads a delimited record, defined as everything through the next -occurrence of a specified delimiter character. +The @code{getdelim} function is a generalized version of @code{getline}. +It reads a delimited record, defined as everything through the next +occurrence of a specified delimiter character. These functions were +both GNU extensions until standardized by POSIX.1-2008. All these functions are declared in @file{stdio.h}. -@deftypefun ssize_t getline (char **@var{lineptr}, size_t *@var{n}, FILE *@var{stream}) -@standards{GNU, stdio.h} +@deftypefun ssize_t getline (char **restrict @var{lineptr}, size_t *restrict @var{n}, FILE *restrict @var{stream}) +@standards{POSIX.1-2008, stdio.h} @safety{@prelim{}@mtsafe{}@asunsafe{@asucorrupt{} @ascuheap{}}@acunsafe{@aculock{} @acucorrupt{} @acsmem{}}} @c Besides the usual possibility of getting an inconsistent stream in a @c signal handler or leaving it inconsistent in case of cancellation, @@ -1274,15 +1275,15 @@ read (including the newline, but not including the terminating null). This value enables you to distinguish null characters that are part of the line from the null character inserted as a terminator. -This function is a GNU extension, but it is the recommended way to read -lines from a stream. The alternative standard functions are unreliable. +This function was originally a GNU extension, but was added in +POSIX.1-2008. If an error occurs or end of file is reached without any bytes read, @code{getline} returns @code{-1}. @end deftypefun -@deftypefun ssize_t getdelim (char **@var{lineptr}, size_t *@var{n}, int @var{delimiter}, FILE *@var{stream}) -@standards{GNU, stdio.h} +@deftypefun ssize_t getdelim (char **restrict @var{lineptr}, size_t *restrict @var{n}, int @var{delimiter}, FILE *restrict @var{stream}) +@standards{POSIX.1-2008, stdio.h} @safety{@prelim{}@mtsafe{}@asunsafe{@asucorrupt{} @ascuheap{}}@acunsafe{@aculock{} @acucorrupt{} @acsmem{}}} @c See the getline @acucorrupt note. This function is like @code{getline} except that the character which @@ -1294,6 +1295,9 @@ The text is stored in @var{lineptr}, including the delimiter character and a terminating null. Like @code{getline}, @code{getdelim} makes @var{lineptr} bigger if it isn't big enough. +This function was originally a GNU extension, but was added in +POSIX.1-2008. + @code{getline} is in fact implemented in terms of @code{getdelim}, just like this: diff --git a/manual/time.texi b/manual/time.texi index 04c97f5..6b89b85 100644 --- a/manual/time.texi +++ b/manual/time.texi @@ -148,7 +148,8 @@ and pass them to the functions that convert them to broken-down time On POSIX-conformant systems, @code{time_t} is an integer type and its values represent the number of seconds elapsed since the @dfn{POSIX Epoch}, which is January 1, 1970, at 00:00:00 Coordinated Universal Time (UTC)@. -The count of seconds ignores leap seconds. +The count of seconds ignores leap seconds. Additionally, POSIX.1-2024 +added the requirement that @code{time_t} be at least 64 bits wide. @Theglibc{} additionally guarantees that @code{time_t} is a signed type, and that all of its functions operate correctly on negative diff --git a/manual/tunables.texi b/manual/tunables.texi index 7f0246c..d11ca7e 100644 --- a/manual/tunables.texi +++ b/manual/tunables.texi @@ -365,8 +365,11 @@ change the main stack permission if kernel starts with a non-executable stack. The @code{glibc.rtld.execstack} can be used to control whether an executable stack is allowed from the main program. Setting the value to @code{0} disables the ABI auto-negotiation (meaning no executable stacks even if the ABI or ELF -header requires it), while @code{1} enables auto-negotiation (although the -program might not need an executable stack). +header requires it), @code{1} enables auto-negotiation (although the program +might not need an executable stack), while @code{2} forces an executable +stack at process start. This is provided for compatibility reasons, when +the program dynamically loads modules with @code{dlopen} which require +an executable stack. When executable stacks are not allowed, and if the main program requires it, the loader will fail with an error message. @@ -380,7 +383,8 @@ of hardware capabilities and kernel configuration. @strong{NB:} Trying to load a dynamic shared library with @code{dlopen} or @code{dlmopen} that requires an executable stack will always fail if the main program does not require an executable stack at loading time. This -is enforced regardless of the tunable value. +can be worked around by setting the tunable to @code{2}, where the stack is +always executable. @end deftp @node Elision Tunables diff --git a/math/test-fesetexcept-traps.c b/math/test-fesetexcept-traps.c index bfd5517..441cb9d 100644 --- a/math/test-fesetexcept-traps.c +++ b/math/test-fesetexcept-traps.c @@ -48,7 +48,7 @@ do_test (void) _Static_assert (!(EXCEPTION_SET_FORCES_TRAP && !EXCEPTION_TESTS(float)), "EXCEPTION_SET_FORCES_TRAP only makes sense if the " - "architecture suports exceptions"); + "architecture supports exceptions"); { int exc_before = fegetexcept (); ret = fesetexcept (FE_ALL_EXCEPT); diff --git a/math/test-fexcept-traps.c b/math/test-fexcept-traps.c index 67e8fc1..f832705 100644 --- a/math/test-fexcept-traps.c +++ b/math/test-fexcept-traps.c @@ -72,7 +72,7 @@ do_test (void) _Static_assert (!(EXCEPTION_SET_FORCES_TRAP && !EXCEPTION_TESTS(float)), "EXCEPTION_SET_FORCES_TRAP only makes sense if the " - "architecture suports exceptions"); + "architecture supports exceptions"); { int exc_before = fegetexcept (); ret = fesetexceptflag (&saved, FE_ALL_EXCEPT); diff --git a/posix/tst-truncate-common.c b/posix/tst-truncate-common.c index 19c96b7..20ce168 100644 --- a/posix/tst-truncate-common.c +++ b/posix/tst-truncate-common.c @@ -36,7 +36,7 @@ static int temp_fd; static void do_prepare (void) { - temp_fd = create_temp_file ("tst-trucate.", &temp_filename); + temp_fd = create_temp_file ("tst-truncate.", &temp_filename); if (temp_fd == -1) { printf ("cannot create temporary file: %m\n"); diff --git a/stdio-common/Makefile b/stdio-common/Makefile index 3709222..64b3575 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -262,6 +262,7 @@ tests := \ tst-bz11319-fortify2 \ tst-cookie \ tst-dprintf-length \ + tst-fclose-devzero \ tst-fclose-offset \ tst-fdopen \ tst-fdopen2 \ diff --git a/stdio-common/tst-fclose-devzero.c b/stdio-common/tst-fclose-devzero.c new file mode 100644 index 0000000..1c7b39a --- /dev/null +++ b/stdio-common/tst-fclose-devzero.c @@ -0,0 +1,50 @@ +/* Test that always-zero lseek does not cause fclose failure after fread. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <stdio.h> +#include <string.h> + +#include <support/check.h> +#include <support/xstdio.h> + +int +do_test (void) +{ + for (int do_ftello = 0; do_ftello < 2; ++do_ftello) + { + FILE *fp = xfopen ("/dev/zero", "r"); + char buf[17]; + memset (buf, 0xcc, sizeof (buf)); + xfread (buf, 1, sizeof (buf), fp); + static const char zeros[sizeof (buf)] = { 0 }; + TEST_COMPARE_BLOB (buf, sizeof (buf), zeros, sizeof (zeros)); + if (do_ftello) + { + errno = 0; + TEST_COMPARE (ftello (fp), -1); + TEST_COMPARE (errno, ESPIPE); + } + /* Do not use xfclose because it flushes first. */ + TEST_COMPARE (fclose (fp), 0); + } + + return 0; +} + +#include <support/test-driver.c> diff --git a/stdio-common/tst-setvbuf2.c b/stdio-common/tst-setvbuf2.c index 6cc8335..84d8b43 100644 --- a/stdio-common/tst-setvbuf2.c +++ b/stdio-common/tst-setvbuf2.c @@ -240,6 +240,21 @@ typedef struct { /* It's OK if this is static, we only run one at a time. */ ThreadData thread_data; +static void +end_thread (pthread_t *ptid) +{ + if (*ptid) + { + pthread_cancel (*ptid); + xpthread_join (*ptid); + /* The descriptor was passed in, or the helper thread made + sufficient progress and opened the file. */ + if (thread_data.fd >= 0) + xclose (thread_data.fd); + *ptid = 0; + } +} + static void * writer_thread_proc (void *closure) { @@ -306,7 +321,7 @@ static void start_writer_thread_n (const char *fname) { debug; - thread_data.fd = 0; + thread_data.fd = -1; thread_data.fname = fname; writer_thread_tid = xpthread_create (NULL, writer_thread_proc, (void *)&thread_data); @@ -316,13 +331,7 @@ static void end_writer_thread (void) { debug; - if (writer_thread_tid) - { - pthread_cancel (writer_thread_tid); - xpthread_join (writer_thread_tid); - xclose (thread_data.fd); - writer_thread_tid = 0; - } + end_thread (&writer_thread_tid); } static void @@ -339,7 +348,7 @@ static void start_reader_thread_n (const char *fname) { debug; - thread_data.fd = 0; + thread_data.fd = -1; thread_data.fname = fname; reader_thread_tid = xpthread_create (NULL, reader_thread_proc, (void *)&thread_data); @@ -349,13 +358,7 @@ static void end_reader_thread (void) { debug; - if (reader_thread_tid) - { - pthread_cancel (reader_thread_tid); - xpthread_join (reader_thread_tid); - xclose (thread_data.fd); - reader_thread_tid = 0; - } + end_thread (&reader_thread_tid); } /*------------------------------------------------------------*/ @@ -852,7 +855,7 @@ do_second_part (FILE *fp, } - fclose (fp); + xfclose (fp); return rv; } @@ -939,7 +942,7 @@ recurse (FILE *fp, break; default: /* parent */ - fclose (fp); + xfclose (fp); xwaitpid (pid, &status, 0); if (WIFEXITED (status) && WEXITSTATUS (status) == 0) diff --git a/stdlib/Makefile b/stdlib/Makefile index 513445b..1c80e49 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -211,6 +211,9 @@ routines := \ strtoull_l \ swapcontext \ system \ + uabs \ + ulabs \ + ullabs \ wcstombs \ wctomb \ xpg_basename \ @@ -363,6 +366,10 @@ tests := \ tst-swapcontext2 \ tst-thread-quick_exit \ tst-tininess \ + tst-uabs \ + tst-uimaxabs \ + tst-ulabs \ + tst-ullabs \ tst-unsetenv1 \ tst-width \ tst-width-stdint \ @@ -412,6 +419,11 @@ CFLAGS-tst-abs.c += -fno-builtin CFLAGS-tst-labs.c += -fno-builtin CFLAGS-tst-llabs.c += -fno-builtin +CFLAGS-tst-uabs.c += -fno-builtin +CFLAGS-tst-uimaxabs.c += -fno-builtin +CFLAGS-tst-ulabs.c += -fno-builtin +CFLAGS-tst-ullabs.c += -fno-builtin + CFLAGS-tst-stdbit-Wconversion.c += -Wconversion -Werror CFLAGS-tst-stdc_trailing_zeros.c += -fno-builtin CFLAGS-tst-stdc_trailing_ones.c += -fno-builtin diff --git a/stdlib/Versions b/stdlib/Versions index ea2265b..6d02400 100644 --- a/stdlib/Versions +++ b/stdlib/Versions @@ -223,6 +223,12 @@ libc { stdc_bit_ceil_ul; stdc_bit_ceil_ull; } + GLIBC_2.42 { + uabs; + uimaxabs; + ulabs; + ullabs; + } GLIBC_PRIVATE { # functions which have an additional interface since they are # are cancelable. diff --git a/stdlib/inttypes.h b/stdlib/inttypes.h index 95324f0..9726abf 100644 --- a/stdlib/inttypes.h +++ b/stdlib/inttypes.h @@ -350,6 +350,11 @@ typedef struct /* Compute absolute value of N. */ extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__)); + +#if __GLIBC_USE (ISOC2Y) +extern uintmax_t uimaxabs (intmax_t __n) __THROW __attribute__ ((__const__)); +#endif + /* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */ extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom) __THROW __attribute__ ((__const__)); diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h index 975f5ae..cd4503c 100644 --- a/stdlib/stdlib.h +++ b/stdlib/stdlib.h @@ -985,6 +985,12 @@ __extension__ extern long long int llabs (long long int __x) __THROW __attribute__ ((__const__)) __wur; #endif +#if __GLIBC_USE (ISOC2Y) +extern unsigned int uabs (int __x) __THROW __attribute__ ((__const__)) __wur; +extern unsigned long int ulabs (long int __x) __THROW __attribute__ ((__const__)) __wur; +__extension__ extern unsigned long long int ullabs (long long int __x) + __THROW __attribute__ ((__const__)) __wur; +#endif /* Return the `div_t', `ldiv_t' or `lldiv_t' representation of the value of NUMER over DENOM. */ diff --git a/stdlib/tst-uabs.c b/stdlib/tst-uabs.c new file mode 100644 index 0000000..13c9f58 --- /dev/null +++ b/stdlib/tst-uabs.c @@ -0,0 +1,45 @@ +/* Basic tests for uabs. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <stdlib.h> + +#include <support/check.h> + +#define LARGE_PRIME 49999 + +static int do_test (void) +{ + int i; + + TEST_COMPARE (uabs (INT_MAX), INT_MAX); + TEST_COMPARE (uabs (INT_MIN), (unsigned int)INT_MAX + 1); + TEST_COMPARE (uabs (-1), 1); + TEST_COMPARE (uabs (0), 0); + TEST_COMPARE (uabs (1), 1); + + for (i = INT_MIN + 1; i < 0; i += LARGE_PRIME) + TEST_COMPARE (uabs (i), -i); + + for (i = 0; i < INT_MAX - LARGE_PRIME; i += LARGE_PRIME) + TEST_COMPARE (uabs (i), i); + + return EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/stdlib/tst-uimaxabs.c b/stdlib/tst-uimaxabs.c new file mode 100644 index 0000000..4500ec1 --- /dev/null +++ b/stdlib/tst-uimaxabs.c @@ -0,0 +1,51 @@ +/* Basic tests for uimaxabs. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <inttypes.h> +#include <limits.h> +#include <stdlib.h> + +#include <support/check.h> + +#define LARGE_PRIME 49999 + +static int do_test (void) +{ + intmax_t i; + + TEST_COMPARE (uimaxabs (INTMAX_MIN), (uintmax_t)INTMAX_MAX + 1); + TEST_COMPARE (uimaxabs (-1), 1); + TEST_COMPARE (uimaxabs (0), 0); + TEST_COMPARE (uimaxabs (1), 1); + + for (i = INTMAX_MIN + 1; i < INTMAX_MIN + INT_MAX; i += LARGE_PRIME) + TEST_COMPARE (uimaxabs (i), -i); + + for (i = INTMAX_MAX - INT_MAX; i < INTMAX_MAX - LARGE_PRIME; i += LARGE_PRIME) + TEST_COMPARE (uimaxabs (i), i); + + for (i = INT_MIN + 1; i < 0; i += LARGE_PRIME) + TEST_COMPARE (uimaxabs (i), -i); + + for (i = 0; i < INT_MAX; i += LARGE_PRIME) + TEST_COMPARE (uimaxabs (i), i); + + return EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/stdlib/tst-ulabs.c b/stdlib/tst-ulabs.c new file mode 100644 index 0000000..3b5323e --- /dev/null +++ b/stdlib/tst-ulabs.c @@ -0,0 +1,52 @@ +/* Basic tests for ulabs. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <stdlib.h> + +#include <support/check.h> + +#define LARGE_PRIME 49999 + +static int do_test (void) +{ + long int i; + + TEST_COMPARE (ulabs (LONG_MAX), LONG_MAX); + TEST_COMPARE (ulabs (LONG_MIN), (unsigned long int)LONG_MAX + 1); + TEST_COMPARE (ulabs (-1), 1); + TEST_COMPARE (ulabs (0), 0); + TEST_COMPARE (ulabs (1), 1); + + for (i = LONG_MIN + 1; i < LONG_MIN + INT_MAX; i += LARGE_PRIME) + TEST_COMPARE (ulabs (i), -i); + + for (i = LONG_MAX - INT_MAX; i < LONG_MAX - LARGE_PRIME; + i += LARGE_PRIME) + TEST_COMPARE (ulabs (i), i); + + for (i = INT_MIN + 1; i < 0; i += LARGE_PRIME) + TEST_COMPARE (ulabs (i), -i); + + for (i = 0; i <= INT_MAX - LARGE_PRIME; i += LARGE_PRIME) + TEST_COMPARE (ulabs (i), i); + + return EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/stdlib/tst-ullabs.c b/stdlib/tst-ullabs.c new file mode 100644 index 0000000..ac34ec7 --- /dev/null +++ b/stdlib/tst-ullabs.c @@ -0,0 +1,55 @@ +/* Basic tests for ullabs. + Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <stdlib.h> + +#include <support/check.h> + +#define LARGE_PRIME 49999 + +static int do_test (void) +{ + long long int i; + + TEST_COMPARE (ullabs (LLONG_MAX), LLONG_MAX); + TEST_COMPARE (ullabs (LLONG_MIN), (unsigned long long int)LLONG_MAX + 1); + TEST_COMPARE (ullabs (0x00000000ffffffffL), 0x00000000ffffffffL); + TEST_COMPARE (ullabs (0x0000000100000000L), 0x0000000100000000L); + TEST_COMPARE (ullabs (0x80000000ffffffffL), 0x7fffffff00000001L); + TEST_COMPARE (ullabs (0x8000000100000000L), 0x7fffffff00000000L); + TEST_COMPARE (ullabs (-1), 1); + TEST_COMPARE (ullabs (0), 0); + TEST_COMPARE (ullabs (1), 1); + + for (i = LLONG_MIN + 1; i < LLONG_MIN + INT_MAX; i += LARGE_PRIME) + TEST_COMPARE (ullabs (i), -i); + + for (i = LLONG_MAX - INT_MAX; i < LLONG_MAX - LARGE_PRIME; i += LARGE_PRIME) + TEST_COMPARE (ullabs (i), i); + + for (i = INT_MIN + 1; i < 0; i += LARGE_PRIME) + TEST_COMPARE (ullabs (i), -i); + + for (i = 0; i < INT_MAX; i += LARGE_PRIME) + TEST_COMPARE (ullabs (i), i); + + return EXIT_SUCCESS; +} + +#include <support/test-driver.c> diff --git a/stdlib/uabs.c b/stdlib/uabs.c new file mode 100644 index 0000000..72aea5f --- /dev/null +++ b/stdlib/uabs.c @@ -0,0 +1,28 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <stdlib.h> + +#undef uabs + +/* Return the absolute value of I. */ +unsigned int +uabs (int i) +{ + unsigned int j = i; + return i < 0 ? -j : i; +} diff --git a/stdlib/ulabs.c b/stdlib/ulabs.c new file mode 100644 index 0000000..c2ccfb8 --- /dev/null +++ b/stdlib/ulabs.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <stdlib.h> + +#undef ulabs + +/* Return the absolute value of I. */ +unsigned long int +ulabs (long int i) +{ + unsigned long int j = i; + return i < 0 ? -j : i; +} + +#if ULONG_MAX != UINT_MAX +weak_alias (ulabs, uimaxabs) +#endif diff --git a/stdlib/ullabs.c b/stdlib/ullabs.c new file mode 100644 index 0000000..11268c2 --- /dev/null +++ b/stdlib/ullabs.c @@ -0,0 +1,33 @@ +/* Copyright (C) 2025 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <https://www.gnu.org/licenses/>. */ + +#include <limits.h> +#include <stdlib.h> + +#undef ullabs + +/* Return the absolute value of I. */ +unsigned long long int +ullabs (long long int i) +{ + unsigned long long int j = i; + return i < 0 ? -j : i; +} + +#if ULONG_MAX == UINT_MAX +weak_alias (ullabs, uimaxabs) +#endif diff --git a/sysdeps/aarch64/multiarch/memcpy_oryon1.S b/sysdeps/aarch64/multiarch/memcpy_oryon1.S index e86d8b0..cc267db 100644 --- a/sysdeps/aarch64/multiarch/memcpy_oryon1.S +++ b/sysdeps/aarch64/multiarch/memcpy_oryon1.S @@ -152,6 +152,46 @@ L(copy96): .p2align 6 L(copy_long): + /* On oryon1 cores, large memcpy's are helped by using ldnp/stnp. + This loop is identical to the one below it but using ldnp/stnp + instructions. For loops that are less than 32768 bytes, + the ldnp/stnp instructions will not help and will cause a slow + down so only use the ldnp/stnp loop for the largest sizes. */ + + cmp count, #32768 + b.lo L(copy_long_without_nontemp) + and tmp1, dstin, 15 + bic dst, dstin, 15 + ldnp D_l, D_h, [src] + sub src, src, tmp1 + add count, count, tmp1 /* Count is now 16 too large. */ + ldnp A_l, A_h, [src, 16] + stnp D_l, D_h, [dstin] + ldnp B_l, B_h, [src, 32] + ldnp C_l, C_h, [src, 48] + ldnp D_l, D_h, [src, 64] + add src, src, #64 + subs count, count, 128 + 16 /* Test and readjust count. */ + +L(nontemp_loop64): + tbz src, #6, 1f +1: + stnp A_l, A_h, [dst, 16] + ldnp A_l, A_h, [src, 16] + stnp B_l, B_h, [dst, 32] + ldnp B_l, B_h, [src, 32] + stnp C_l, C_h, [dst, 48] + ldnp C_l, C_h, [src, 48] + stnp D_l, D_h, [dst, 64] + ldnp D_l, D_h, [src, 64] + add src, src, #64 + add dst, dst, #64 + subs count, count, 64 + b.hi L(nontemp_loop64) + b L(last64) + +L(copy_long_without_nontemp): + and tmp1, dstin, 15 bic dst, dstin, 15 ldp D_l, D_h, [src] diff --git a/sysdeps/aarch64/multiarch/memset_oryon1.S b/sysdeps/aarch64/multiarch/memset_oryon1.S index 0f9b718..88f4ef4 100644 --- a/sysdeps/aarch64/multiarch/memset_oryon1.S +++ b/sysdeps/aarch64/multiarch/memset_oryon1.S @@ -90,6 +90,8 @@ L(set_long): cmp count, 256 ccmp valw, 0, 0, cs b.eq L(try_zva) + cmp count, #32768 + b.hi L(set_long_with_nontemp) /* Small-size or non-zero memset does not use DC ZVA. */ sub count, dstend, dst @@ -112,6 +114,30 @@ L(set_long): stp val, val, [dstend, -16] ret +L(set_long_with_nontemp): + /* Small-size or non-zero memset does not use DC ZVA. */ + sub count, dstend, dst + + /* Adjust count and bias for loop. By subtracting extra 1 from count, + it is easy to use tbz instruction to check whether loop tailing + count is less than 33 bytes, so as to bypass 2 unnecessary stps. */ + sub count, count, 64+16+1 + +1: stnp val, val, [dst, 16] + stnp val, val, [dst, 32] + stnp val, val, [dst, 48] + stnp val, val, [dst, 64] + add dst, dst, #64 + subs count, count, 64 + b.hs 1b + + tbz count, 5, 1f /* Remaining count is less than 33 bytes? */ + stnp val, val, [dst, 16] + stnp val, val, [dst, 32] +1: stnp val, val, [dstend, -32] + stnp val, val, [dstend, -16] + ret + L(try_zva): /* Write the first and last 64 byte aligned block using stp rather than using DC ZVA as it is faster. */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 5b12a41..b5d5b31 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -717,6 +717,19 @@ extern const ElfW(Phdr) *_dl_phdr; extern size_t _dl_phnum; #endif +/* Possible values for the glibc.rtld.execstack tunable. */ +enum stack_tunable_mode + { + /* Do not allow executable stacks, even if program requires it. */ + stack_tunable_mode_disable = 0, + /* Follows either ABI requirement, or the PT_GNU_STACK value. */ + stack_tunable_mode_enable = 1, + /* Always enable an executable stack. */ + stack_tunable_mode_force = 2 + }; + +void _dl_handle_execstack_tunable (void) attribute_hidden; + /* This function changes the permission of the memory region pointed by STACK_ENDP to executable and update the internal memory protection flags for future thread stack creation. */ diff --git a/sysdeps/ieee754/ldbl-128/e_expl.c b/sysdeps/ieee754/ldbl-128/e_expl.c index 25b45c7..4855c6b 100644 --- a/sysdeps/ieee754/ldbl-128/e_expl.c +++ b/sysdeps/ieee754/ldbl-128/e_expl.c @@ -79,7 +79,7 @@ L(-11433.4627433362978788372438434526231), /* 3x2^96 */ #define THREEp96 C[2] - L(59421121885698253195157962752.0), + L(237684487542793012780631851008.0), /* 3x2^103 */ #define THREEp103 C[3] diff --git a/sysdeps/mach/hurd/dup3.c b/sysdeps/mach/hurd/dup3.c index 22af45b..49545ae 100644 --- a/sysdeps/mach/hurd/dup3.c +++ b/sysdeps/mach/hurd/dup3.c @@ -69,6 +69,7 @@ __dup3 (int fd, int fd2, int flags) { /* Get a hold of the destination descriptor. */ struct hurd_fd *d2; + error_t err; __mutex_lock (&_hurd_dtable_lock); @@ -107,22 +108,51 @@ __dup3 (int fd, int fd2, int flags) } else { - /* Give the ports each a user ref for the new descriptor. */ - __mach_port_mod_refs (__mach_task_self (), port, - MACH_PORT_RIGHT_SEND, 1); - if (ctty != MACH_PORT_NULL) - __mach_port_mod_refs (__mach_task_self (), ctty, - MACH_PORT_RIGHT_SEND, 1); - - /* Install the ports and flags in the new descriptor slot. */ - __spin_lock (&d2->port.lock); - if (flags & O_CLOEXEC) - d2->flags = d_flags | FD_CLOEXEC; - else - /* dup clears FD_CLOEXEC. */ - d2->flags = d_flags & ~FD_CLOEXEC; - _hurd_port_set (&d2->ctty, ctty); - _hurd_port_locked_set (&d2->port, port); /* Unlocks D2. */ + /* Give the io server port a user ref for the new descriptor. */ + err = __mach_port_mod_refs (__mach_task_self (), port, + MACH_PORT_RIGHT_SEND, 1); + + if (err == KERN_UREFS_OVERFLOW) + fd2 = __hurd_fail (EMFILE); + else if (err) + fd2 = __hurd_fail (EINVAL); + else if (ctty != MACH_PORT_NULL) + { + /* We have confirmed the io server port has got a user ref + count, now give ctty port a user ref for the new + descriptor. */ + err = __mach_port_mod_refs (__mach_task_self (), ctty, + MACH_PORT_RIGHT_SEND, 1); + + if (err) + { + /* In this case the io server port has got a ref count + but the ctty port failed to get one, so we need to + clean the ref count we just assigned. */ + __mach_port_mod_refs (__mach_task_self (), port, + MACH_PORT_RIGHT_SEND, -1); + + if (err == KERN_UREFS_OVERFLOW) + fd2 = __hurd_fail (EMFILE); + else + fd2 = __hurd_fail (EINVAL); + } + } + + if (!err) + { + /* The ref counts of the ports are incremented + successfully. */ + /* Install the ports and flags in the new descriptor slot. */ + __spin_lock (&d2->port.lock); + if (flags & O_CLOEXEC) + d2->flags = d_flags | FD_CLOEXEC; + else + /* dup clears FD_CLOEXEC. */ + d2->flags = d_flags & ~FD_CLOEXEC; + _hurd_port_set (&d2->ctty, ctty); + _hurd_port_locked_set (&d2->port, port); /* Unlocks D2. */ + } } } diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c index a65c190..de576af 100644 --- a/sysdeps/mach/hurd/fcntl.c +++ b/sysdeps/mach/hurd/fcntl.c @@ -83,18 +83,47 @@ __libc_fcntl (int fd, int cmd, ...) result = -1; else { - /* Give the ports each a user ref for the new descriptor. */ - __mach_port_mod_refs (__mach_task_self (), port, - MACH_PORT_RIGHT_SEND, 1); - if (ctty != MACH_PORT_NULL) - __mach_port_mod_refs (__mach_task_self (), ctty, - MACH_PORT_RIGHT_SEND, 1); - - /* Install the ports and flags in the new descriptor. */ - if (ctty != MACH_PORT_NULL) - _hurd_port_set (&new->ctty, ctty); - new->flags = flags; - _hurd_port_locked_set (&new->port, port); /* Unlocks NEW. */ + /* Give the io server port a user ref for the new descriptor. */ + err = __mach_port_mod_refs (__mach_task_self (), port, + MACH_PORT_RIGHT_SEND, 1); + + if (err == KERN_UREFS_OVERFLOW) + result = __hurd_fail (EMFILE); + else if (err) + result = __hurd_fail (EINVAL); + else if (ctty != MACH_PORT_NULL) + { + /* We have confirmed the io server port has got a user ref + count, now give ctty port a user ref for the new + descriptor. */ + err = __mach_port_mod_refs (__mach_task_self (), ctty, + MACH_PORT_RIGHT_SEND, 1); + + if (err) + { + /* In this case the io server port has got a ref count + but the ctty port fails to get one, so we need to clean + the ref count we just assigned. */ + __mach_port_mod_refs (__mach_task_self (), port, + MACH_PORT_RIGHT_SEND, -1); + + if (err == KERN_UREFS_OVERFLOW) + result = __hurd_fail (EMFILE); + else + result = __hurd_fail (EINVAL); + } + } + + if (!err) + { + /* The ref counts of the ports are incremented successfully. */ + /* Install the ports and flags in the new descriptor. */ + if (ctty != MACH_PORT_NULL) + _hurd_port_set (&new->ctty, ctty); + new->flags = flags; + /* Unlocks NEW. */ + _hurd_port_locked_set (&new->port, port); + } } HURD_CRITICAL_END; diff --git a/sysdeps/mach/hurd/futimens.c b/sysdeps/mach/hurd/futimens.c index 30ef0a6..1212529 100644 --- a/sysdeps/mach/hurd/futimens.c +++ b/sysdeps/mach/hurd/futimens.c @@ -32,7 +32,9 @@ __futimens (int fd, const struct timespec tsp[2]) struct timespec atime, mtime; error_t err; - utime_ts_from_tspec (tsp, &atime, &mtime); + err = utime_ts_from_tspec (tsp, &atime, &mtime); + if (err) + return err; err = HURD_DPORT_USE (fd, __file_utimens (port, atime, mtime)); @@ -40,7 +42,9 @@ __futimens (int fd, const struct timespec tsp[2]) { time_value_t atim, mtim; - utime_tvalue_from_tspec (tsp, &atim, &mtim); + err = utime_tvalue_from_tspec (tsp, &atim, &mtim); + if (err) + return err; err = HURD_DPORT_USE (fd, __file_utimes (port, atim, mtim)); } diff --git a/sysdeps/mach/hurd/futimes.c b/sysdeps/mach/hurd/futimes.c index 20f47f3..97385d7 100644 --- a/sysdeps/mach/hurd/futimes.c +++ b/sysdeps/mach/hurd/futimes.c @@ -32,7 +32,9 @@ __futimes (int fd, const struct timeval tvp[2]) struct timespec atime, mtime; error_t err; - utime_ts_from_tval (tvp, &atime, &mtime); + err = utime_ts_from_tval (tvp, &atime, &mtime); + if (err) + return err; err = HURD_DPORT_USE (fd, __file_utimens (port, atime, mtime)); @@ -40,7 +42,9 @@ __futimes (int fd, const struct timeval tvp[2]) { time_value_t atim, mtim; - utime_tvalue_from_tval (tvp, &atim, &mtim); + err = utime_tvalue_from_tval (tvp, &atim, &mtim); + if (err) + return err; err = HURD_DPORT_USE (fd, __file_utimes (port, atim, mtim)); } diff --git a/sysdeps/mach/hurd/i386/bits/sigcontext.h b/sysdeps/mach/hurd/i386/bits/sigcontext.h index 6e5e220..c44e4de 100644 --- a/sysdeps/mach/hurd/i386/bits/sigcontext.h +++ b/sysdeps/mach/hurd/i386/bits/sigcontext.h @@ -88,6 +88,8 @@ struct sigcontext struct i386_fp_save sc_fpsave; struct i386_fp_regs sc_fpregs; int sc_fpexcsr; /* FPSR including exception bits. */ + + struct i386_xfloat_state *xstate; }; /* Traditional BSD names for some members. */ diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 0b963dc..3e183f5 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -2614,6 +2614,10 @@ GLIBC_2.42 pthread_rwlockattr_destroy F GLIBC_2.42 pthread_rwlockattr_getpshared F GLIBC_2.42 pthread_rwlockattr_init F GLIBC_2.42 pthread_rwlockattr_setpshared F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/mach/hurd/i386/sigreturn.c b/sysdeps/mach/hurd/i386/sigreturn.c index ce8df8d..dc57d61 100644 --- a/sysdeps/mach/hurd/i386/sigreturn.c +++ b/sysdeps/mach/hurd/i386/sigreturn.c @@ -21,6 +21,8 @@ #include <stdlib.h> #include <string.h> +#include <cpuid.h> + /* This is run on the thread stack after restoring it, to be able to unlock SS off sigstack. */ static void @@ -123,10 +125,35 @@ __sigreturn (struct sigcontext *scp) if (scp->sc_onstack) ss->sigaltstack.ss_flags &= ~SS_ONSTACK; - if (scp->sc_fpused) - /* Restore the FPU state. Mach conveniently stores the state - in the format the i387 `frstor' instruction uses to restore it. */ - asm volatile ("frstor %0" : : "m" (scp->sc_fpsave)); +#ifdef i386_XFLOAT_STATE + if (scp->xstate) + { + if (scp->xstate->initialized) + { + unsigned eax, ebx, ecx, edx; + __cpuid_count(0xd, 0, eax, ebx, ecx, edx); + switch (scp->xstate->fp_save_kind) + { + case 0: // FNSAVE + asm volatile("frstor %0" : : "m" (scp->xstate->hw_state)); + break; + case 1: // FXSAVE + asm volatile("fxrstor %0" : : "m" (scp->xstate->hw_state), \ + "a" (eax), "d" (edx)); + break; + default: // XSAVE, XSAVEOPT, XSAVEC, XSAVES + asm volatile("xrstor %0" : : "m" (scp->xstate->hw_state), \ + "a" (eax), "d" (edx)); + break; + } + } + } + else +#endif + if (scp->sc_fpused) + /* Restore the FPU state. Mach conveniently stores the state + in the format the i387 `frstor' instruction uses to restore it. */ + asm volatile ("frstor %0" : : "m" (scp->sc_fpsave)); { /* There are convenient instructions to pop state off the stack, so we diff --git a/sysdeps/mach/hurd/utime-helper.c b/sysdeps/mach/hurd/utime-helper.c index d88bccd..6afa871 100644 --- a/sysdeps/mach/hurd/utime-helper.c +++ b/sysdeps/mach/hurd/utime-helper.c @@ -21,8 +21,14 @@ #include <stddef.h> #include <sys/time.h> +static inline bool +check_tval (const struct timeval *tvp) +{ + return tvp->tv_usec >= 0 && tvp->tv_usec < USEC_PER_SEC; +} + /* Initializes atime/mtime timespec structures from an array of timeval. */ -static inline void +static inline error_t utime_ts_from_tval (const struct timeval tvp[2], struct timespec *atime, struct timespec *mtime) { @@ -37,13 +43,19 @@ utime_ts_from_tval (const struct timeval tvp[2], } else { + if (!check_tval (&tvp[0])) + return EINVAL; + if (!check_tval (&tvp[1])) + return EINVAL; + TIMEVAL_TO_TIMESPEC (&tvp[0], atime); TIMEVAL_TO_TIMESPEC (&tvp[1], mtime); } + return 0; } /* Initializes atime/mtime time_value_t structures from an array of timeval. */ -static inline void +static inline error_t utime_tvalue_from_tval (const struct timeval tvp[2], time_value_t *atime, time_value_t *mtime) { @@ -53,11 +65,17 @@ utime_tvalue_from_tval (const struct timeval tvp[2], atime->microseconds = mtime->microseconds = -1; else { + if (!check_tval (&tvp[0])) + return EINVAL; + if (!check_tval (&tvp[1])) + return EINVAL; + atime->seconds = tvp[0].tv_sec; atime->microseconds = tvp[0].tv_usec; mtime->seconds = tvp[1].tv_sec; mtime->microseconds = tvp[1].tv_usec; } + return 0; } /* Changes the access time of the file behind PORT using a timeval array. */ @@ -67,7 +85,9 @@ hurd_futimes (const file_t port, const struct timeval tvp[2]) error_t err; struct timespec atime, mtime; - utime_ts_from_tval (tvp, &atime, &mtime); + err = utime_ts_from_tval (tvp, &atime, &mtime); + if (err) + return err; err = __file_utimens (port, atime, mtime); @@ -75,7 +95,9 @@ hurd_futimes (const file_t port, const struct timeval tvp[2]) { time_value_t atim, mtim; - utime_tvalue_from_tval (tvp, &atim, &mtim); + err = utime_tvalue_from_tval (tvp, &atim, &mtim); + if (err) + return err; err = __file_utimes (port, atim, mtim); } @@ -83,8 +105,16 @@ hurd_futimes (const file_t port, const struct timeval tvp[2]) return err; } +static inline bool +check_tspec (const struct timespec *tsp) +{ + return tsp->tv_nsec == UTIME_NOW + || tsp->tv_nsec == UTIME_OMIT + || tsp->tv_nsec >= 0 && tsp->tv_nsec < NSEC_PER_SEC; +} + /* Initializes atime/mtime timespec structures from an array of timespec. */ -static inline void +static inline error_t utime_ts_from_tspec (const struct timespec tsp[2], struct timespec *atime, struct timespec *mtime) { @@ -99,13 +129,19 @@ utime_ts_from_tspec (const struct timespec tsp[2], } else { + if (!check_tspec (&tsp[0])) + return EINVAL; + if (!check_tspec (&tsp[1])) + return EINVAL; + *atime = tsp[0]; *mtime = tsp[1]; } + return 0; } /* Initializes atime/mtime time_value_t structures from an array of timespec. */ -static inline void +static inline error_t utime_tvalue_from_tspec (const struct timespec tsp[2], time_value_t *atime, time_value_t *mtime) { @@ -115,6 +151,11 @@ utime_tvalue_from_tspec (const struct timespec tsp[2], atime->microseconds = mtime->microseconds = -1; else { + if (!check_tspec (&tsp[0])) + return EINVAL; + if (!check_tspec (&tsp[1])) + return EINVAL; + if (tsp[0].tv_nsec == UTIME_NOW) atime->microseconds = -1; else if (tsp[0].tv_nsec == UTIME_OMIT) @@ -128,6 +169,7 @@ utime_tvalue_from_tspec (const struct timespec tsp[2], else TIMESPEC_TO_TIME_VALUE (mtime, &(tsp[1])); } + return 0; } /* Changes the access time of the file behind PORT using a timespec array. */ @@ -137,7 +179,9 @@ hurd_futimens (const file_t port, const struct timespec tsp[2]) error_t err; struct timespec atime, mtime; - utime_ts_from_tspec (tsp, &atime, &mtime); + err = utime_ts_from_tspec (tsp, &atime, &mtime); + if (err) + return err; err = __file_utimens (port, atime, mtime); @@ -145,7 +189,9 @@ hurd_futimens (const file_t port, const struct timespec tsp[2]) { time_value_t atim, mtim; - utime_tvalue_from_tspec (tsp, &atim, &mtim); + err = utime_tvalue_from_tspec (tsp, &atim, &mtim); + if (err) + return err; err = __file_utimes (port, atim, mtim); } diff --git a/sysdeps/mach/hurd/x86/trampoline.c b/sysdeps/mach/hurd/x86/trampoline.c index 8e2890f..6f23c56 100644 --- a/sysdeps/mach/hurd/x86/trampoline.c +++ b/sysdeps/mach/hurd/x86/trampoline.c @@ -26,7 +26,11 @@ #include "hurdfault.h" #include <intr-msg.h> #include <sys/ucontext.h> - +#ifdef __x86_64__ +#include <mach/x86_64/mach_i386.h> +#else +#include <mach/i386/mach_i386.h> +#endif /* Fill in a siginfo_t structure for SA_SIGINFO-enabled handlers. */ static void fill_siginfo (siginfo_t *si, int signo, @@ -106,6 +110,7 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action void firewall (void); void *sigsp; struct sigcontext *scp; + vm_size_t xstate_size; struct { union @@ -145,6 +150,14 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action struct hurd_userlink link; ucontext_t ucontext; siginfo_t siginfo; +#ifdef __x86_64__ + char _pad2[56]; +#else + char _pad2[20]; +#endif + char xstate[]; + /* Don't add anything after xstate, as it's dynamically + sized. */ } *stackframe; #ifdef __x86_64__ @@ -170,6 +183,17 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action if (! machine_get_basic_state (ss->thread, state)) return NULL; + /* Initialize the size of the CPU extended state, to be saved during + * signal handling */ +#ifdef i386_XFLOAT_STATE + _Static_assert ((sizeof(*stackframe) + sizeof(struct i386_xfloat_state)) % 64 == 0, + "stackframe size must be multiple of 64-byte minus " + "sizeof(struct i386_xfloat_state), please adjust _pad2"); + + if (__i386_get_xstate_size(__mach_host_self(), &xstate_size)) +#endif + xstate_size = 0; + /* Save the original SP in the gratuitous `esp' slot. We may need to reset the SP (the `uesp' slot) to avoid clobbering an interrupted RPC frame. */ @@ -196,14 +220,21 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action #endif } - /* Push the arguments to call `trampoline' on the stack. */ - sigsp -= sizeof (*stackframe); -#ifdef __x86_64__ - /* Align SP at 16 bytes. Coupled with the fact that sigreturn_addr is - 16-byte aligned within the stackframe struct, this ensures that it ends - up on a 16-byte aligned address, as required by the ABI. */ - sigsp = (void *) ((uintptr_t) sigsp & ~15UL); -#endif + /* Push the arguments to call `trampoline' on the stack. + * The extended state might have a variable size depending on the platform, + * so we dynamically allocate it on the stack frame.*/ + sigsp -= sizeof (*stackframe) + xstate_size; + + /* Align SP at 64 bytes. This is needed for two reasons: + * - sigreturn_addr is 16-byte aligned within the stackframe + * struct, and this ensures that it ends up on a 16-byte aligned + * address, as required by the ABI. + * - the XSAVE state needs to be aligned at 64 bytes (on both i386 and + * x86_64), so we align the stackframe also at 64 bytes and add the + * required padding at the end, see the _pad2 field. + */ + sigsp = (void *) ((uintptr_t) sigsp & ~63UL); + stackframe = sigsp; if (_hurdsig_catch_memory_fault (stackframe)) @@ -248,14 +279,40 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action memcpy (&scp->sc_i386_thread_state, &state->basic, sizeof (state->basic)); - /* struct sigcontext is laid out so that starting at sc_fpkind mimics - a struct i386_float_state. */ - _Static_assert (offsetof (struct sigcontext, sc_i386_float_state) - % __alignof__ (struct i386_float_state) == 0, - "sc_i386_float_state layout mismatch"); - ok = machine_get_state (ss->thread, state, i386_FLOAT_STATE, - &state->fpu, &scp->sc_i386_float_state, - sizeof (state->fpu)); + scp->xstate = NULL; +#ifdef i386_XFLOAT_STATE + if (xstate_size > 0) + { + mach_msg_type_number_t got = (xstate_size / sizeof (int)); + + ok = (! __thread_get_state (ss->thread, i386_XFLOAT_STATE, + (thread_state_t) stackframe->xstate, &got) + && got == (xstate_size / sizeof (int))); + + if (ok && ((struct i386_xfloat_state*) stackframe->xstate)->fp_save_kind > 5) + /* We support up to XSAVES */ + ok = 0; + + if (ok) + { + scp->xstate = (struct i386_xfloat_state*) stackframe->xstate; + assert((uintptr_t)scp->xstate->hw_state % 64 == 0); + } + } + else +#endif + ok = 0; + if (!ok) + { + /* struct sigcontext is laid out so that starting at sc_fpkind mimics + a struct i386_float_state. */ + _Static_assert (offsetof (struct sigcontext, sc_i386_float_state) + % __alignof__ (struct i386_float_state) == 0, + "sc_i386_float_state layout mismatch"); + ok = machine_get_state (ss->thread, state, i386_FLOAT_STATE, + &state->fpu, &scp->sc_i386_float_state, + sizeof (state->fpu)); + } /* Set up the arguments for the signal handler. */ stackframe->signo = signo; @@ -404,7 +461,10 @@ _hurd_setup_sighandler (struct hurd_sigstate *ss, const struct sigaction *action - in gdb: gdb/i386-gnu-tdep.c gnu_sigtramp_code. */ #ifdef __x86_64__ -asm ("rpc_wait_trampoline:\n" +asm ("trampoline:\n" + "fnclex\n" /* Clear any pending exception. */ + "jmp _trampoline\n" + "rpc_wait_trampoline:\n" /* This is the entry point when we have an RPC reply message to receive before running the handler. The MACH_MSG_SEND bit has already been cleared in the OPTION argument in our %rsi. The interrupted user @@ -423,7 +483,7 @@ asm ("rpc_wait_trampoline:\n" /* Switch to the signal stack. */ "movq %rbx, %rsp\n" - "trampoline:\n" + "_trampoline:\n" /* Entry point for running the handler normally. The arguments to the handler function are on the top of the stack, same as in the i386 version: @@ -449,7 +509,10 @@ asm ("rpc_wait_trampoline:\n" "movq 16(%rsp), %rdi\n" "ret"); #else -asm ("rpc_wait_trampoline:\n"); +asm ("trampoline:\n" + "fnclex\n" /* Clear any pending exception. */ + "jmp _trampoline\n" + "rpc_wait_trampoline:\n"); /* This is the entry point when we have an RPC reply message to receive before running the handler. The MACH_MSG_SEND bit has already been cleared in the OPTION argument on our stack. The interrupted user @@ -469,7 +532,7 @@ asm (/* Retry the interrupted mach_msg system call. */ /* Switch to the signal stack. */ "movl %ebx, %esp\n"); - asm ("trampoline:\n"); +asm ("_trampoline:\n"); /* Entry point for running the handler normally. The arguments to the handler function are already on the top of the stack: diff --git a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h index 7bac881..d83795f 100644 --- a/sysdeps/mach/hurd/x86_64/bits/sigcontext.h +++ b/sysdeps/mach/hurd/x86_64/bits/sigcontext.h @@ -96,6 +96,8 @@ struct sigcontext struct i386_fp_save sc_fpsave; struct i386_fp_regs sc_fpregs; int sc_fpexcsr; /* FPSR including exception bits. */ + + struct i386_xfloat_state *xstate; }; /* Traditional BSD names for some members. */ diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist index b9e9349..688ee26 100644 --- a/sysdeps/mach/hurd/x86_64/libc.abilist +++ b/sysdeps/mach/hurd/x86_64/libc.abilist @@ -2297,6 +2297,10 @@ GLIBC_2.42 pthread_rwlockattr_destroy F GLIBC_2.42 pthread_rwlockattr_getpshared F GLIBC_2.42 pthread_rwlockattr_init F GLIBC_2.42 pthread_rwlockattr_setpshared F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F HURD_CTHREADS_0.3 __cthread_getspecific F HURD_CTHREADS_0.3 __cthread_keycreate F HURD_CTHREADS_0.3 __cthread_setspecific F diff --git a/sysdeps/mach/hurd/x86_64/sigreturn.c b/sysdeps/mach/hurd/x86_64/sigreturn.c index 81a2d3b..773c00f 100644 --- a/sysdeps/mach/hurd/x86_64/sigreturn.c +++ b/sysdeps/mach/hurd/x86_64/sigreturn.c @@ -20,6 +20,8 @@ #include <hurd/msg.h> #include <stdlib.h> +#include <cpuid.h> + /* This is run on the thread stack after restoring it, to be able to unlock SS off sigstack. */ void @@ -116,10 +118,35 @@ __sigreturn (struct sigcontext *scp) if (scp->sc_onstack) ss->sigaltstack.ss_flags &= ~SS_ONSTACK; - if (scp->sc_fpused) - /* Restore the FPU state. Mach conveniently stores the state - in the format the i387 `frstor' instruction uses to restore it. */ - asm volatile ("frstor %0" : : "m" (scp->sc_fpsave)); +#ifdef i386_XFLOAT_STATE + if (scp->xstate) + { + if (scp->xstate->initialized) + { + unsigned eax, ebx, ecx, edx; + __cpuid_count(0xd, 0, eax, ebx, ecx, edx); + switch (scp->xstate->fp_save_kind) + { + case 0: // FNSAVE + asm volatile("frstor %0" : : "m" (scp->xstate->hw_state)); + break; + case 1: // FXSAVE + asm volatile("fxrstor %0" : : "m" (scp->xstate->hw_state), \ + "a" (eax), "d" (edx)); + break; + default: // XSAVE, XSAVEOPT, XSAVEC, XSAVES + asm volatile("xrstor %0" : : "m" (scp->xstate->hw_state), \ + "a" (eax), "d" (edx)); + break; + } + } + } + else +#endif + if (scp->sc_fpused) + /* Restore the FPU state. Mach conveniently stores the state + in the format the i387 `frstor' instruction uses to restore it. */ + asm volatile ("frstor %0" : : "m" (scp->sc_fpsave)); /* Copy the registers onto the user's stack, to be able to release the altstack (by unlocking sigstate). Note that unless an altstack is used, diff --git a/sysdeps/powerpc/powerpc64/dl-machine.h b/sysdeps/powerpc/powerpc64/dl-machine.h index d8d7c8b..89e26bb 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.h +++ b/sysdeps/powerpc/powerpc64/dl-machine.h @@ -363,7 +363,6 @@ elf_machine_runtime_setup (struct link_map *map, struct r_scope_elem *scope[], / sizeof (Elf64_Rela)); Elf64_Addr l_addr = map->l_addr; Elf64_Dyn **info = map->l_info; - char *p; extern void _dl_runtime_resolve (void); extern void _dl_profile_resolve (void); @@ -435,20 +434,6 @@ elf_machine_runtime_setup (struct link_map *map, struct r_scope_elem *scope[], offset += PLT_ENTRY_WORDS; glink_offset += GLINK_ENTRY_WORDS (i); } - - /* Now, we've modified data. We need to write the changes from - the data cache to a second-level unified cache, then make - sure that stale data in the instruction cache is removed. - (In a multiprocessor system, the effect is more complex.) - Most of the PLT shouldn't be in the instruction cache, but - there may be a little overlap at the start and the end. - - Assumes that dcbst and icbi apply to lines of 16 bytes or - more. Current known line sizes are 16, 32, and 128 bytes. */ - - for (p = (char *) plt; p < (char *) &plt[offset]; p += 16) - PPC_DCBST (p); - PPC_SYNC; } } return lazy; diff --git a/sysdeps/pthread/tst-stdio2.c b/sysdeps/pthread/tst-stdio2.c index 08948cb..0876ed6 100644 --- a/sysdeps/pthread/tst-stdio2.c +++ b/sysdeps/pthread/tst-stdio2.c @@ -75,7 +75,7 @@ do_test (void) exit (1); } - puts ("join returned succsefully"); + puts ("join returned successfully"); return 0; } diff --git a/sysdeps/unix/sysv/linux/aarch64/libc.abilist b/sysdeps/unix/sysv/linux/aarch64/libc.abilist index 41f8f39..aa6bf48 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc.abilist +++ b/sysdeps/unix/sysv/linux/aarch64/libc.abilist @@ -2753,3 +2753,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/alpha/libc.abilist b/sysdeps/unix/sysv/linux/alpha/libc.abilist index 34efc96..d5df965 100644 --- a/sysdeps/unix/sysv/linux/alpha/libc.abilist +++ b/sysdeps/unix/sysv/linux/alpha/libc.abilist @@ -3100,6 +3100,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/arc/libc.abilist b/sysdeps/unix/sysv/linux/arc/libc.abilist index de7c618..c46c08d 100644 --- a/sysdeps/unix/sysv/linux/arc/libc.abilist +++ b/sysdeps/unix/sysv/linux/arc/libc.abilist @@ -2514,3 +2514,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/arm/be/libc.abilist b/sysdeps/unix/sysv/linux/arm/be/libc.abilist index 96f0314..4df150c 100644 --- a/sysdeps/unix/sysv/linux/arm/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/be/libc.abilist @@ -2806,6 +2806,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/arm/le/libc.abilist b/sysdeps/unix/sysv/linux/arm/le/libc.abilist index 635468f..be29478 100644 --- a/sysdeps/unix/sysv/linux/arm/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/arm/le/libc.abilist @@ -2803,6 +2803,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/csky/libc.abilist b/sysdeps/unix/sysv/linux/csky/libc.abilist index 490694d..f123757 100644 --- a/sysdeps/unix/sysv/linux/csky/libc.abilist +++ b/sysdeps/unix/sysv/linux/csky/libc.abilist @@ -2790,3 +2790,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/hppa/libc.abilist b/sysdeps/unix/sysv/linux/hppa/libc.abilist index b1905da..2dc85b9 100644 --- a/sysdeps/unix/sysv/linux/hppa/libc.abilist +++ b/sysdeps/unix/sysv/linux/hppa/libc.abilist @@ -2827,6 +2827,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/i386/libc.abilist b/sysdeps/unix/sysv/linux/i386/libc.abilist index 424ef34..1e38217 100644 --- a/sysdeps/unix/sysv/linux/i386/libc.abilist +++ b/sysdeps/unix/sysv/linux/i386/libc.abilist @@ -3010,6 +3010,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist index 420471e..927fc21 100644 --- a/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist +++ b/sysdeps/unix/sysv/linux/loongarch/lp64/libc.abilist @@ -2274,3 +2274,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist index 95a68c7..74da49d 100644 --- a/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist @@ -2786,6 +2786,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist index 442e82b..e5d6781 100644 --- a/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist +++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist @@ -2953,6 +2953,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist index 20f7712..4dbd4b6 100644 --- a/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/be/libc.abilist @@ -2839,3 +2839,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist index f61ed3b..c5965bb 100644 --- a/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/microblaze/le/libc.abilist @@ -2836,3 +2836,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist index 381120c..10715e0 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist @@ -2914,6 +2914,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist index 2f51146..3d229b9 100644 --- a/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist @@ -2912,6 +2912,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist index e6071be..e4cb452 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist @@ -2920,6 +2920,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist index f41e209..8a32d25 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist @@ -2822,6 +2822,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/or1k/libc.abilist b/sysdeps/unix/sysv/linux/or1k/libc.abilist index bbcdb31..64dac95 100644 --- a/sysdeps/unix/sysv/linux/or1k/libc.abilist +++ b/sysdeps/unix/sysv/linux/or1k/libc.abilist @@ -2264,3 +2264,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist index e0ea22b..cc5e93c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist @@ -3143,6 +3143,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist index 16b9a77..9814997 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist @@ -3188,6 +3188,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist index 070f6f5..7f46295 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/be/libc.abilist @@ -2897,6 +2897,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist index 4378d1d..f24f81b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/le/libc.abilist @@ -2973,3 +2973,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist index 48c6e26..9330c7a 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv32/libc.abilist @@ -2517,3 +2517,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist index a8b0c6a..ea4555d 100644 --- a/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist +++ b/sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist @@ -2717,3 +2717,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist index 6c00b84..3e625fa 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist @@ -3141,6 +3141,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist index f866e5d..46b4a04 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist +++ b/sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist @@ -2934,6 +2934,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sh/be/libc.abilist b/sysdeps/unix/sysv/linux/sh/be/libc.abilist index 4f2db8c..36a94c9 100644 --- a/sysdeps/unix/sysv/linux/sh/be/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/be/libc.abilist @@ -2833,6 +2833,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index a73473e..f79aba6 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -2830,6 +2830,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist index dc7e27d..4a6acc0 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist @@ -3162,6 +3162,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist index 2ee97f4..931109d 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist @@ -2798,6 +2798,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist index a7ada1e..7ab9073 100644 --- a/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/64/libc.abilist @@ -2749,6 +2749,10 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F GLIBC_2.5 __readlinkat_chk F GLIBC_2.5 inet6_opt_append F GLIBC_2.5 inet6_opt_find F diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist index f41ab77..e11876f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist +++ b/sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist @@ -2768,3 +2768,7 @@ GLIBC_2.41 sched_setattr F GLIBC_2.42 __inet_ntop_chk F GLIBC_2.42 __inet_pton_chk F GLIBC_2.42 pthread_gettid_np F +GLIBC_2.42 uabs F +GLIBC_2.42 uimaxabs F +GLIBC_2.42 ulabs F +GLIBC_2.42 ullabs F diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 9d136e4..e50f1d6 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -502,8 +502,8 @@ _Static_assert (((index_arch_Fast_Unaligned_Load "Incorrect index_arch_Fast_Unaligned_Load"); -/* Intel Family-6 microarch list. */ -enum +/* Intel microarch list. */ +enum intel_microarch { /* Atom processors. */ INTEL_ATOM_BONNELL, @@ -512,6 +512,7 @@ enum INTEL_ATOM_GOLDMONT, INTEL_ATOM_GOLDMONT_PLUS, INTEL_ATOM_SIERRAFOREST, + INTEL_ATOM_CLEARWATERFOREST, INTEL_ATOM_GRANDRIDGE, INTEL_ATOM_TREMONT, @@ -539,7 +540,9 @@ enum INTEL_BIGCORE_METEORLAKE, INTEL_BIGCORE_LUNARLAKE, INTEL_BIGCORE_ARROWLAKE, + INTEL_BIGCORE_PANTHERLAKE, INTEL_BIGCORE_GRANITERAPIDS, + INTEL_BIGCORE_DIAMONDRAPIDS, /* Mixed (bigcore + atom SOC). */ INTEL_MIXED_LAKEFIELD, @@ -553,7 +556,7 @@ enum INTEL_UNKNOWN, }; -static unsigned int +static enum intel_microarch intel_get_fam6_microarch (unsigned int model, __attribute__ ((unused)) unsigned int stepping) { @@ -584,6 +587,8 @@ intel_get_fam6_microarch (unsigned int model, return INTEL_ATOM_GOLDMONT_PLUS; case 0xAF: return INTEL_ATOM_SIERRAFOREST; + case 0xDD: + return INTEL_ATOM_CLEARWATERFOREST; case 0xB6: return INTEL_ATOM_GRANDRIDGE; case 0x86: @@ -691,8 +696,12 @@ intel_get_fam6_microarch (unsigned int model, return INTEL_BIGCORE_METEORLAKE; case 0xbd: return INTEL_BIGCORE_LUNARLAKE; + case 0xb5: + case 0xc5: case 0xc6: return INTEL_BIGCORE_ARROWLAKE; + case 0xCC: + return INTEL_BIGCORE_PANTHERLAKE; case 0xAD: case 0xAE: return INTEL_BIGCORE_GRANITERAPIDS; @@ -756,133 +765,20 @@ init_cpu_features (struct cpu_features *cpu_features) cpu_features->preferred[index_arch_Avoid_Non_Temporal_Memset] &= ~bit_arch_Avoid_Non_Temporal_Memset; + enum intel_microarch microarch = INTEL_UNKNOWN; if (family == 0x06) { model += extended_model; - unsigned int microarch - = intel_get_fam6_microarch (model, stepping); + microarch = intel_get_fam6_microarch (model, stepping); + /* Disable TSX on some processors to avoid TSX on kernels that + weren't updated with the latest microcode package (which + disables broken feature by default). */ switch (microarch) { - /* Atom / KNL tuning. */ - case INTEL_ATOM_BONNELL: - /* BSF is slow on Bonnell. */ - cpu_features->preferred[index_arch_Slow_BSF] - |= bit_arch_Slow_BSF; - break; - - /* Unaligned load versions are faster than SSSE3 - on Airmont, Silvermont, Goldmont, and Goldmont Plus. */ - case INTEL_ATOM_AIRMONT: - case INTEL_ATOM_SILVERMONT: - case INTEL_ATOM_GOLDMONT: - case INTEL_ATOM_GOLDMONT_PLUS: - - /* Knights Landing. Enable Silvermont optimizations. */ - case INTEL_KNIGHTS_LANDING: - - cpu_features->preferred[index_arch_Fast_Unaligned_Load] - |= (bit_arch_Fast_Unaligned_Load - | bit_arch_Fast_Unaligned_Copy - | bit_arch_Prefer_PMINUB_for_stringop - | bit_arch_Slow_SSE4_2); - break; - - case INTEL_ATOM_TREMONT: - /* Enable rep string instructions, unaligned load, unaligned - copy, pminub and avoid SSE 4.2 on Tremont. */ - cpu_features->preferred[index_arch_Fast_Rep_String] - |= (bit_arch_Fast_Rep_String - | bit_arch_Fast_Unaligned_Load - | bit_arch_Fast_Unaligned_Copy - | bit_arch_Prefer_PMINUB_for_stringop - | bit_arch_Slow_SSE4_2); - break; - - /* - Default tuned Knights microarch. - case INTEL_KNIGHTS_MILL: - */ - - /* - Default tuned atom microarch. - case INTEL_ATOM_SIERRAFOREST: - case INTEL_ATOM_GRANDRIDGE: - */ - - /* Bigcore/Default Tuning. */ default: - default_tuning: - /* Unknown family 0x06 processors. Assuming this is one - of Core i3/i5/i7 processors if AVX is available. */ - if (!CPU_FEATURES_CPU_P (cpu_features, AVX)) - break; - - enable_modern_features: - /* Rep string instructions, unaligned load, unaligned copy, - and pminub are fast on Intel Core i3, i5 and i7. */ - cpu_features->preferred[index_arch_Fast_Rep_String] - |= (bit_arch_Fast_Rep_String - | bit_arch_Fast_Unaligned_Load - | bit_arch_Fast_Unaligned_Copy - | bit_arch_Prefer_PMINUB_for_stringop); break; - case INTEL_BIGCORE_NEHALEM: - case INTEL_BIGCORE_WESTMERE: - /* Older CPUs prefer non-temporal stores at lower threshold. */ - cpu_features->cachesize_non_temporal_divisor = 8; - goto enable_modern_features; - - /* Older Bigcore microarch (smaller non-temporal store - threshold). */ - case INTEL_BIGCORE_SANDYBRIDGE: - case INTEL_BIGCORE_IVYBRIDGE: - case INTEL_BIGCORE_HASWELL: - case INTEL_BIGCORE_BROADWELL: - cpu_features->cachesize_non_temporal_divisor = 8; - goto default_tuning; - - /* Newer Bigcore microarch (larger non-temporal store - threshold). */ - case INTEL_BIGCORE_SKYLAKE_AVX512: - case INTEL_BIGCORE_CANNONLAKE: - /* Benchmarks indicate non-temporal memset is not - necessarily profitable on SKX (and in some cases much - worse). This is likely unique to SKX due its it unique - mesh interconnect (not present on ICX or BWD). Disable - non-temporal on all Skylake servers. */ - cpu_features->preferred[index_arch_Avoid_Non_Temporal_Memset] - |= bit_arch_Avoid_Non_Temporal_Memset; - /* fallthrough */ - case INTEL_BIGCORE_COMETLAKE: - case INTEL_BIGCORE_SKYLAKE: - case INTEL_BIGCORE_KABYLAKE: - case INTEL_BIGCORE_ICELAKE: - case INTEL_BIGCORE_TIGERLAKE: - case INTEL_BIGCORE_ROCKETLAKE: - case INTEL_BIGCORE_RAPTORLAKE: - case INTEL_BIGCORE_METEORLAKE: - case INTEL_BIGCORE_LUNARLAKE: - case INTEL_BIGCORE_ARROWLAKE: - case INTEL_BIGCORE_SAPPHIRERAPIDS: - case INTEL_BIGCORE_EMERALDRAPIDS: - case INTEL_BIGCORE_GRANITERAPIDS: - cpu_features->cachesize_non_temporal_divisor = 2; - goto default_tuning; - - /* Default tuned Mixed (bigcore + atom SOC). */ - case INTEL_MIXED_LAKEFIELD: - case INTEL_MIXED_ALDERLAKE: - cpu_features->cachesize_non_temporal_divisor = 2; - goto default_tuning; - } - - /* Disable TSX on some processors to avoid TSX on kernels that - weren't updated with the latest microcode package (which - disables broken feature by default). */ - switch (microarch) - { case INTEL_BIGCORE_SKYLAKE_AVX512: /* 0x55 (Skylake-avx512) && stepping <= 5 disable TSX. */ if (stepping <= 5) @@ -891,38 +787,163 @@ init_cpu_features (struct cpu_features *cpu_features) case INTEL_BIGCORE_KABYLAKE: /* NB: Although the errata documents that for model == 0x8e - (kabylake skylake client), only 0xb stepping or lower are - impacted, the intention of the errata was to disable TSX on - all client processors on all steppings. Include 0xc - stepping which is an Intel Core i7-8665U, a client mobile - processor. */ + (kabylake skylake client), only 0xb stepping or lower are + impacted, the intention of the errata was to disable TSX on + all client processors on all steppings. Include 0xc + stepping which is an Intel Core i7-8665U, a client mobile + processor. */ if (stepping > 0xc) break; /* Fall through. */ case INTEL_BIGCORE_SKYLAKE: - /* Disable Intel TSX and enable RTM_ALWAYS_ABORT for - processors listed in: - -https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html - */ - disable_tsx: - CPU_FEATURE_UNSET (cpu_features, HLE); - CPU_FEATURE_UNSET (cpu_features, RTM); - CPU_FEATURE_SET (cpu_features, RTM_ALWAYS_ABORT); - break; + /* Disable Intel TSX and enable RTM_ALWAYS_ABORT for + processors listed in: + + https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html + */ +disable_tsx: + CPU_FEATURE_UNSET (cpu_features, HLE); + CPU_FEATURE_UNSET (cpu_features, RTM); + CPU_FEATURE_SET (cpu_features, RTM_ALWAYS_ABORT); + break; case INTEL_BIGCORE_HASWELL: - /* Xeon E7 v3 (model == 0x3f) with stepping >= 4 has working - TSX. Haswell also include other model numbers that have - working TSX. */ - if (model == 0x3f && stepping >= 4) + /* Xeon E7 v3 (model == 0x3f) with stepping >= 4 has working + TSX. Haswell also includes other model numbers that have + working TSX. */ + if (model == 0x3f && stepping >= 4) break; - CPU_FEATURE_UNSET (cpu_features, RTM); - break; + CPU_FEATURE_UNSET (cpu_features, RTM); + break; } } + else if (family == 19) + switch (model) + { + case 0x01: + microarch = INTEL_BIGCORE_DIAMONDRAPIDS; + break; + default: + break; + } + + switch (microarch) + { + /* Atom / KNL tuning. */ + case INTEL_ATOM_BONNELL: + /* BSF is slow on Bonnell. */ + cpu_features->preferred[index_arch_Slow_BSF] + |= bit_arch_Slow_BSF; + break; + + /* Unaligned load versions are faster than SSSE3 + on Airmont, Silvermont, Goldmont, and Goldmont Plus. */ + case INTEL_ATOM_AIRMONT: + case INTEL_ATOM_SILVERMONT: + case INTEL_ATOM_GOLDMONT: + case INTEL_ATOM_GOLDMONT_PLUS: + + /* Knights Landing. Enable Silvermont optimizations. */ + case INTEL_KNIGHTS_LANDING: + + cpu_features->preferred[index_arch_Fast_Unaligned_Load] + |= (bit_arch_Fast_Unaligned_Load + | bit_arch_Fast_Unaligned_Copy + | bit_arch_Prefer_PMINUB_for_stringop + | bit_arch_Slow_SSE4_2); + break; + + case INTEL_ATOM_TREMONT: + /* Enable rep string instructions, unaligned load, unaligned + copy, pminub and avoid SSE 4.2 on Tremont. */ + cpu_features->preferred[index_arch_Fast_Rep_String] + |= (bit_arch_Fast_Rep_String + | bit_arch_Fast_Unaligned_Load + | bit_arch_Fast_Unaligned_Copy + | bit_arch_Prefer_PMINUB_for_stringop + | bit_arch_Slow_SSE4_2); + break; + + /* + Default tuned Knights microarch. + case INTEL_KNIGHTS_MILL: + */ + + /* + Default tuned atom microarch. + case INTEL_ATOM_SIERRAFOREST: + case INTEL_ATOM_GRANDRIDGE: + case INTEL_ATOM_CLEARWATERFOREST: + */ + + /* Bigcore/Default Tuning. */ + default: + default_tuning: + /* Unknown Intel processors. Assuming this is one of Core + i3/i5/i7 processors if AVX is available. */ + if (!CPU_FEATURES_CPU_P (cpu_features, AVX)) + break; + + enable_modern_features: + /* Rep string instructions, unaligned load, unaligned copy, + and pminub are fast on Intel Core i3, i5 and i7. */ + cpu_features->preferred[index_arch_Fast_Rep_String] + |= (bit_arch_Fast_Rep_String + | bit_arch_Fast_Unaligned_Load + | bit_arch_Fast_Unaligned_Copy + | bit_arch_Prefer_PMINUB_for_stringop); + break; + + case INTEL_BIGCORE_NEHALEM: + case INTEL_BIGCORE_WESTMERE: + /* Older CPUs prefer non-temporal stores at lower threshold. */ + cpu_features->cachesize_non_temporal_divisor = 8; + goto enable_modern_features; + + /* Older Bigcore microarch (smaller non-temporal store + threshold). */ + case INTEL_BIGCORE_SANDYBRIDGE: + case INTEL_BIGCORE_IVYBRIDGE: + case INTEL_BIGCORE_HASWELL: + case INTEL_BIGCORE_BROADWELL: + cpu_features->cachesize_non_temporal_divisor = 8; + goto default_tuning; + + /* Newer Bigcore microarch (larger non-temporal store + threshold). */ + case INTEL_BIGCORE_SKYLAKE_AVX512: + case INTEL_BIGCORE_CANNONLAKE: + /* Benchmarks indicate non-temporal memset is not + necessarily profitable on SKX (and in some cases much + worse). This is likely unique to SKX due to its unique + mesh interconnect (not present on ICX or BWD). Disable + non-temporal on all Skylake servers. */ + cpu_features->preferred[index_arch_Avoid_Non_Temporal_Memset] + |= bit_arch_Avoid_Non_Temporal_Memset; + /* fallthrough */ + case INTEL_BIGCORE_COMETLAKE: + case INTEL_BIGCORE_SKYLAKE: + case INTEL_BIGCORE_KABYLAKE: + case INTEL_BIGCORE_ICELAKE: + case INTEL_BIGCORE_TIGERLAKE: + case INTEL_BIGCORE_ROCKETLAKE: + case INTEL_BIGCORE_RAPTORLAKE: + case INTEL_BIGCORE_METEORLAKE: + case INTEL_BIGCORE_LUNARLAKE: + case INTEL_BIGCORE_ARROWLAKE: + case INTEL_BIGCORE_PANTHERLAKE: + case INTEL_BIGCORE_SAPPHIRERAPIDS: + case INTEL_BIGCORE_EMERALDRAPIDS: + case INTEL_BIGCORE_GRANITERAPIDS: + case INTEL_BIGCORE_DIAMONDRAPIDS: + /* Default tuned Mixed (bigcore + atom SOC). */ + case INTEL_MIXED_LAKEFIELD: + case INTEL_MIXED_ALDERLAKE: + cpu_features->cachesize_non_temporal_divisor = 2; + goto default_tuning; + } /* Since AVX512ER is unique to Xeon Phi, set Prefer_No_VZEROUPPER if AVX512ER is available. Don't use AVX512 to avoid lower CPU diff --git a/timezone/tst-bz28707.c b/timezone/tst-bz28707.c index a5723f4..a03cd1f 100644 --- a/timezone/tst-bz28707.c +++ b/timezone/tst-bz28707.c @@ -15,10 +15,11 @@ License along with the GNU C Library; if not, see <https://www.gnu.org/licenses/>. */ -#include <time.h> +#include <errno.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> +#include <support/check.h> +#include <time.h> /* Test that we can use a truncated timezone-file, where the time-type at index 0 is not indexed by the transition-types array (and the @@ -28,19 +29,24 @@ static int do_test (void) { - if (setenv ("TZ", "XT5", 1)) - { - puts ("setenv failed."); - return 1; - } + if (setenv ("TZ", "XT5", 1) != 0) + FAIL_EXIT1 ("setenv: %m"); + errno = 0; tzset (); - - return - /* Sanity-check that we got the right abbreviation for DST. For - normal time, we're likely to get "-00" (the "unspecified" marker), - even though the POSIX timezone string says "-04". Let's not test - that. */ - !(strcmp (tzname[1], "-03") == 0); + if (errno != 0) + /* This is not a test failure because checking errno this way is + not a documented way for determining tzset success. We do this + only to gather additional diagnostics. */ + printf ("warning: tzset set errno to %d (%m)", errno); + + /* Sanity-check that we got the right abbreviation for DST. For + normal time, we're likely to get "-00" (the "unspecified" marker), + even though the POSIX timezone string says "-04". Let's not test + that. */ + TEST_COMPARE_STRING (tzname[1], "-03"); + + return 0; } + #include <support/test-driver.c> |