1 diff --git a/NEWS b/NEWS
2 index 485b8ddffa..f278041512 100644
5 @@ -5,6 +5,25 @@ See the end for copying conditions.
6 Please send GNU C library bug reports via <https://sourceware.org/bugzilla/>
7 using `glibc' in the "product" field.
9 +The following bugs are resolved with this release:
11 + [20019] NULL pointer dereference in libc.so.6 IFUNC due to uninitialized GOT
12 + [26224] iconv hangs when converting some invalid inputs from several IBM
13 + character sets (CVE-2020-27618)
14 + [26534] libm.so 2.32 SIGILL in pow() due to FMA4 instruction on non-FMA4
16 + [26555] string: strerrorname_np does not return the documented value
17 + [26600] Transaction ID collisions cause slow DNS lookups in getaddrinfo
18 + [26636] libc: 32-bit shmctl(IPC_INFO) crashes when shminfo struct is
19 + at the end of a memory mapping
20 + [26637] libc: semctl SEM_STAT_ANY fails to pass the buffer specified
21 + by the caller to the kernel
22 + [26639] libc: msgctl IPC_INFO and MSG_INFO return garbage
23 + [26853] aarch64: Missing unwind information in statically linked startup code
24 + [26932] libc: sh: Multiple floating point functions defined as stubs only
25 + [27130] "rep movsb" performance issue
26 + [27177] GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on doesn't work
31 @@ -185,6 +204,10 @@ Security related changes:
32 Dytrych of the Cisco Security Assessment and Penetration Team (See
35 + CVE-2020-27618: An infinite loop has been fixed in the iconv program when
36 + invoked with input containing redundant shift sequences in the IBM1364,
37 + IBM1371, IBM1388, IBM1390, or IBM1399 character sets.
39 The following bugs are resolved with this release:
41 [9809] localedata: ckb_IQ: new Kurdish Sorani locale
42 diff --git a/Rules b/Rules
43 index 8b771f6095..beab969fde 100644
46 @@ -155,6 +155,7 @@ xtests: tests $(xtests-special)
48 tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \
49 $(tests-container:%=$(objpfx)%.out) \
50 + $(tests-mcheck:%=$(objpfx)%-mcheck.out) \
51 $(tests-special) $(tests-printers-out)
52 xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
54 @@ -165,7 +166,7 @@ ifeq ($(run-built-tests),no)
57 tests-expected = $(tests) $(tests-internal) $(tests-printers) \
59 + $(tests-container) $(tests-mcheck:%=%-mcheck)
62 $(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
63 @@ -191,6 +192,7 @@ else
65 binaries-pie-notests =
67 +binaries-mcheck-tests = $(tests-mcheck:%=%-mcheck)
69 binaries-all-notests =
70 binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs)
71 @@ -200,6 +202,7 @@ binaries-static-tests =
74 binaries-pie-notests =
75 +binaries-mcheck-tests =
78 binaries-pie = $(binaries-pie-tests) $(binaries-pie-notests)
79 @@ -223,6 +226,14 @@ $(addprefix $(objpfx),$(binaries-shared-tests)): %: %.o \
83 +ifneq "$(strip $(binaries-mcheck-tests))" ""
84 +$(addprefix $(objpfx),$(binaries-mcheck-tests)): %-mcheck: %.o \
85 + $(link-extra-libs-tests) \
86 + $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
87 + $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
91 ifneq "$(strip $(binaries-pie-tests))" ""
92 $(addprefix $(objpfx),$(binaries-pie-tests)): %: %.o \
93 $(link-extra-libs-tests) \
94 @@ -253,6 +264,12 @@ $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \
98 +# All mcheck tests will be run with MALLOC_CHECK_=3
100 +$(1)-mcheck-ENV = MALLOC_CHECK_=3
102 +$(foreach t,$(tests-mcheck),$(eval $(call mcheck-ENVS,$(t))))
104 ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" ""
105 # These are the implicit rules for making test outputs
106 # from the test programs and whatever input files are present.
107 diff --git a/debug/Makefile b/debug/Makefile
108 index 3a60d7af7a..0036edd187 100644
111 @@ -51,7 +51,7 @@ routines = backtrace backtracesyms backtracesymsfd noophooks \
113 stack_chk_fail fortify_fail \
114 $(static-only-routines)
115 -static-only-routines := warning-nop stack_chk_fail_local
116 +static-only-routines := stack_chk_fail_local
118 # Don't add stack_chk_fail_local.o to libc.a since __stack_chk_fail_local
119 # is an alias of __stack_chk_fail in stack_chk_fail.o.
120 diff --git a/debug/warning-nop.c b/debug/warning-nop.c
121 deleted file mode 100644
122 index 4ab7e182b7..0000000000
123 --- a/debug/warning-nop.c
126 -/* Dummy nop functions to elicit link-time warnings.
127 - Copyright (C) 2005-2020 Free Software Foundation, Inc.
128 - This file is part of the GNU C Library.
130 - The GNU C Library is free software; you can redistribute it and/or
131 - modify it under the terms of the GNU Lesser General Public
132 - License as published by the Free Software Foundation; either
133 - version 2.1 of the License, or (at your option) any later version.
135 - In addition to the permissions in the GNU Lesser General Public
136 - License, the Free Software Foundation gives you unlimited
137 - permission to link the compiled version of this file with other
138 - programs, and to distribute those programs without any restriction
139 - coming from the use of this file. (The GNU Lesser General Public
140 - License restrictions do apply in other respects; for example, they
141 - cover modification of the file, and distribution when not linked
142 - into another program.)
144 - Note that people who make modified versions of this file are not
145 - obligated to grant this special exception for their modified
146 - versions; it is their choice whether to do so. The GNU Lesser
147 - General Public License gives permission to release a modified
148 - version without this exception; this exception also makes it
149 - possible to release a modified version which carries forward this
152 - The GNU C Library is distributed in the hope that it will be useful,
153 - but WITHOUT ANY WARRANTY; without even the implied warranty of
154 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
155 - Lesser General Public License for more details.
157 - You should have received a copy of the GNU Lesser General Public
158 - License along with the GNU C Library; if not, see
159 - <https://www.gnu.org/licenses/>. */
161 -#include <sys/cdefs.h>
164 -__attribute__ ((used))
169 -/* Don't insert any other #include's before this #undef! */
172 -#define __warndecl(name, msg) \
173 - extern void name (void) __attribute__ ((alias ("nop"))) attribute_hidden; \
174 - link_warning (name, msg)
176 -#undef __USE_FORTIFY_LEVEL
177 -#define __USE_FORTIFY_LEVEL 99
179 -/* Following here we need an #include for each public header file
180 - that uses __warndecl. */
182 -/* Define away to avoid warnings with compilers that do not have these
184 -#define __builtin___memcpy_chk(dest, src, len, bos) NULL
185 -#define __builtin___memmove_chk(dest, src, len, bos) NULL
186 -#define __builtin___mempcpy_chk(dest, src, len, bos) NULL
187 -#define __builtin___memset_chk(dest, ch, len, bos) NULL
188 -#define __builtin___stpcpy_chk(dest, src, bos) NULL
189 -#define __builtin___strcat_chk(dest, src, bos) NULL
190 -#define __builtin___strcpy_chk(dest, src, bos) NULL
191 -#define __builtin___strncat_chk(dest, src, len, bos) NULL
192 -#define __builtin___strncpy_chk(dest, src, len, bos) NULL
193 -#define __builtin_object_size(bos, level) 0
196 diff --git a/elf/Makefile b/elf/Makefile
197 index 0b78721848..355e70037b 100644
200 @@ -1381,6 +1381,8 @@ CFLAGS-ifuncmain7pie.c += $(pie-ccflag)
201 CFLAGS-ifuncmain9pie.c += $(pie-ccflag)
202 CFLAGS-tst-ifunc-textrel.c += $(pic-ccflag)
204 +LDFLAGS-ifuncmain6pie = -Wl,-z,lazy
206 $(objpfx)ifuncmain1pie: $(objpfx)ifuncmod1.so
207 $(objpfx)ifuncmain1staticpie: $(objpfx)ifuncdep1pic.o
208 $(objpfx)ifuncmain1vispie: $(objpfx)ifuncmod1.so
209 diff --git a/elf/dl-load.c b/elf/dl-load.c
210 index e39980fb19..71867e7c1a 100644
213 @@ -855,10 +855,12 @@ lose (int code, int fd, const char *name, char *realname, struct link_map *l,
215 /* Process PT_GNU_PROPERTY program header PH in module L after
216 PT_LOAD segments are mapped. Only one NT_GNU_PROPERTY_TYPE_0
217 - note is handled which contains processor specific properties. */
218 + note is handled which contains processor specific properties.
219 + FD is -1 for the kernel mapped main executable otherwise it is
220 + the fd used for loading module L. */
223 -_dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph)
224 +_dl_process_pt_gnu_property (struct link_map *l, int fd, const ElfW(Phdr) *ph)
226 const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr);
227 const ElfW(Addr) size = ph->p_memsz;
228 @@ -905,7 +907,7 @@ _dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph)
231 /* Target specific property processing. */
232 - if (_dl_process_gnu_property (l, type, datasz, ptr) == 0)
233 + if (_dl_process_gnu_property (l, fd, type, datasz, ptr) == 0)
236 /* Check the next property item. */
237 @@ -1251,21 +1253,6 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
238 maplength, has_holes, loader);
239 if (__glibc_unlikely (errstring != NULL))
242 - /* Process program headers again after load segments are mapped in
243 - case processing requires accessing those segments. Scan program
244 - headers backward so that PT_NOTE can be skipped if PT_GNU_PROPERTY
246 - for (ph = &phdr[l->l_phnum]; ph != phdr; --ph)
247 - switch (ph[-1].p_type)
250 - _dl_process_pt_note (l, &ph[-1]);
252 - case PT_GNU_PROPERTY:
253 - _dl_process_pt_gnu_property (l, &ph[-1]);
259 @@ -1377,6 +1364,21 @@ cannot enable executable stack as shared object requires");
260 if (l->l_tls_initimage != NULL)
261 l->l_tls_initimage = (char *) l->l_tls_initimage + l->l_addr;
263 + /* Process program headers again after load segments are mapped in
264 + case processing requires accessing those segments. Scan program
265 + headers backward so that PT_NOTE can be skipped if PT_GNU_PROPERTY
267 + for (ph = &l->l_phdr[l->l_phnum]; ph != l->l_phdr; --ph)
268 + switch (ph[-1].p_type)
271 + _dl_process_pt_note (l, fd, &ph[-1]);
273 + case PT_GNU_PROPERTY:
274 + _dl_process_pt_gnu_property (l, fd, &ph[-1]);
278 /* We are done mapping in the file. We no longer need the descriptor. */
279 if (__glibc_unlikely (__close_nocancel (fd) != 0))
281 diff --git a/elf/ifuncmain6pie.c b/elf/ifuncmain6pie.c
282 index 04faeb86ef..4a01906836 100644
283 --- a/elf/ifuncmain6pie.c
284 +++ b/elf/ifuncmain6pie.c
286 #include "ifunc-sel.h"
288 typedef int (*foo_p) (void);
289 -extern foo_p foo_ptr;
293 @@ -28,20 +27,17 @@ foo_ifunc (void)
296 extern int foo (void);
297 -extern foo_p get_foo (void);
298 +extern int call_foo (void);
299 extern foo_p get_foo_p (void);
301 -foo_p my_foo_ptr = foo;
302 +foo_p foo_ptr = foo;
312 - if ((*p) () != -30)
313 + if (call_foo () != -30)
317 @@ -52,12 +48,8 @@ main (void)
321 - if (my_foo_ptr != foo)
323 if ((*foo_ptr) () != -30)
325 - if ((*my_foo_ptr) () != -30)
330 diff --git a/elf/ifuncmod6.c b/elf/ifuncmod6.c
331 index 2e16c1d06d..2f6d0715e6 100644
332 --- a/elf/ifuncmod6.c
333 +++ b/elf/ifuncmod6.c
334 @@ -4,7 +4,7 @@ extern int foo (void);
336 typedef int (*foo_p) (void);
338 -foo_p foo_ptr = foo;
339 +extern foo_p foo_ptr;
343 @@ -12,8 +12,8 @@ get_foo_p (void)
355 diff --git a/elf/rtld.c b/elf/rtld.c
356 index 5b882163fa..14a42ed00a 100644
359 @@ -1534,10 +1534,10 @@ of this helper program; chances are you did not intend to run this program.\n\
360 switch (ph[-1].p_type)
363 - _dl_process_pt_note (main_map, &ph[-1]);
364 + _dl_process_pt_note (main_map, -1, &ph[-1]);
366 case PT_GNU_PROPERTY:
367 - _dl_process_pt_gnu_property (main_map, &ph[-1]);
368 + _dl_process_pt_gnu_property (main_map, -1, &ph[-1]);
372 diff --git a/iconv/Versions b/iconv/Versions
373 index 8a5f4cf780..d51af52fa3 100644
376 @@ -6,7 +6,9 @@ libc {
378 # functions shared with iconv program
379 __gconv_get_alias_db; __gconv_get_cache; __gconv_get_modules_db;
380 - __gconv_open; __gconv_create_spec;
382 + # functions used elsewhere in glibc
383 + __gconv_open; __gconv_create_spec; __gconv_destroy_spec;
385 # function used by the gconv modules
386 __gconv_transliterate;
387 diff --git a/iconv/gconv_charset.c b/iconv/gconv_charset.c
388 index 6ccd0773cc..4ba0aa99f5 100644
389 --- a/iconv/gconv_charset.c
390 +++ b/iconv/gconv_charset.c
391 @@ -216,3 +216,13 @@ out:
394 libc_hidden_def (__gconv_create_spec)
398 +__gconv_destroy_spec (struct gconv_spec *conv_spec)
400 + free (conv_spec->fromcode);
401 + free (conv_spec->tocode);
404 +libc_hidden_def (__gconv_destroy_spec)
405 diff --git a/iconv/gconv_charset.h b/iconv/gconv_charset.h
406 index b39b09aea1..e9c122cf7e 100644
407 --- a/iconv/gconv_charset.h
408 +++ b/iconv/gconv_charset.h
410 #define GCONV_IGNORE_ERRORS_SUFFIX "IGNORE"
413 -/* This function accepts the charset names of the source and destination of the
414 - conversion and populates *conv_spec with an equivalent conversion
415 - specification that may later be used by __gconv_open. The charset names
416 - might contain options in the form of suffixes that alter the conversion,
417 - e.g. "ISO-10646/UTF-8/TRANSLIT". It processes the charset names, ignoring
418 - and truncating any suffix options in fromcode, and processing and truncating
419 - any suffix options in tocode. Supported suffix options ("TRANSLIT" or
420 - "IGNORE") when found in tocode lead to the corresponding flag in *conv_spec
421 - to be set to true. Unrecognized suffix options are silently discarded. If
422 - the function succeeds, it returns conv_spec back to the caller. It returns
423 - NULL upon failure. */
425 -__gconv_create_spec (struct gconv_spec *conv_spec, const char *fromcode,
426 - const char *tocode);
427 -libc_hidden_proto (__gconv_create_spec)
430 -/* This function frees all heap memory allocated by __gconv_create_spec. */
431 -static void __attribute__ ((unused))
432 -gconv_destroy_spec (struct gconv_spec *conv_spec)
434 - free (conv_spec->fromcode);
435 - free (conv_spec->tocode);
440 /* This function copies in-order, characters from the source 's' that are
441 either alpha-numeric or one in one of these: "_-.,:/" - into the destination
442 'wp' while dropping all other characters. In the process, it converts all
443 diff --git a/iconv/gconv_int.h b/iconv/gconv_int.h
444 index e86938dae7..f721ce30ff 100644
445 --- a/iconv/gconv_int.h
446 +++ b/iconv/gconv_int.h
447 @@ -152,6 +152,27 @@ extern int __gconv_open (struct gconv_spec *conv_spec,
448 __gconv_t *handle, int flags);
449 libc_hidden_proto (__gconv_open)
451 +/* This function accepts the charset names of the source and destination of the
452 + conversion and populates *conv_spec with an equivalent conversion
453 + specification that may later be used by __gconv_open. The charset names
454 + might contain options in the form of suffixes that alter the conversion,
455 + e.g. "ISO-10646/UTF-8/TRANSLIT". It processes the charset names, ignoring
456 + and truncating any suffix options in fromcode, and processing and truncating
457 + any suffix options in tocode. Supported suffix options ("TRANSLIT" or
458 + "IGNORE") when found in tocode lead to the corresponding flag in *conv_spec
459 + to be set to true. Unrecognized suffix options are silently discarded. If
460 + the function succeeds, it returns conv_spec back to the caller. It returns
461 + NULL upon failure. */
462 +extern struct gconv_spec *
463 +__gconv_create_spec (struct gconv_spec *conv_spec, const char *fromcode,
464 + const char *tocode);
465 +libc_hidden_proto (__gconv_create_spec)
467 +/* This function frees all heap memory allocated by __gconv_create_spec. */
469 +__gconv_destroy_spec (struct gconv_spec *conv_spec);
470 +libc_hidden_proto (__gconv_destroy_spec)
472 /* Free resources associated with transformation descriptor CD. */
473 extern int __gconv_close (__gconv_t cd)
475 diff --git a/iconv/iconv_open.c b/iconv/iconv_open.c
476 index dd54bc12e0..5b30055c04 100644
477 --- a/iconv/iconv_open.c
478 +++ b/iconv/iconv_open.c
479 @@ -39,7 +39,7 @@ iconv_open (const char *tocode, const char *fromcode)
481 int res = __gconv_open (&conv_spec, &cd, 0);
483 - gconv_destroy_spec (&conv_spec);
484 + __gconv_destroy_spec (&conv_spec);
486 if (__builtin_expect (res, __GCONV_OK) != __GCONV_OK)
488 diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
489 index b4334faa57..d59979759c 100644
490 --- a/iconv/iconv_prog.c
491 +++ b/iconv/iconv_prog.c
492 @@ -184,7 +184,7 @@ main (int argc, char *argv[])
493 /* Let's see whether we have these coded character sets. */
494 res = __gconv_open (&conv_spec, &cd, 0);
496 - gconv_destroy_spec (&conv_spec);
497 + __gconv_destroy_spec (&conv_spec);
499 if (res != __GCONV_OK)
501 diff --git a/iconv/tst-iconv_prog.sh b/iconv/tst-iconv_prog.sh
502 index 8298136b7f..d8db7b335c 100644
503 --- a/iconv/tst-iconv_prog.sh
504 +++ b/iconv/tst-iconv_prog.sh
505 @@ -102,12 +102,16 @@ hangarray=(
506 "\x00\x80;-c;IBM1161;UTF-8//TRANSLIT//IGNORE"
507 "\x00\xdb;-c;IBM1162;UTF-8//TRANSLIT//IGNORE"
508 "\x00\x70;-c;IBM12712;UTF-8//TRANSLIT//IGNORE"
509 -# These are known hangs that are yet to be fixed:
510 -# "\x00\x0f;-c;IBM1364;UTF-8"
511 -# "\x00\x0f;-c;IBM1371;UTF-8"
512 -# "\x00\x0f;-c;IBM1388;UTF-8"
513 -# "\x00\x0f;-c;IBM1390;UTF-8"
514 -# "\x00\x0f;-c;IBM1399;UTF-8"
515 +"\x00\x0f;-c;IBM1364;UTF-8"
516 +"\x0e\x0e;-c;IBM1364;UTF-8"
517 +"\x00\x0f;-c;IBM1371;UTF-8"
518 +"\x0e\x0e;-c;IBM1371;UTF-8"
519 +"\x00\x0f;-c;IBM1388;UTF-8"
520 +"\x0e\x0e;-c;IBM1388;UTF-8"
521 +"\x00\x0f;-c;IBM1390;UTF-8"
522 +"\x0e\x0e;-c;IBM1390;UTF-8"
523 +"\x00\x0f;-c;IBM1399;UTF-8"
524 +"\x0e\x0e;-c;IBM1399;UTF-8"
525 "\x00\x53;-c;IBM16804;UTF-8//TRANSLIT//IGNORE"
526 "\x00\x41;-c;IBM274;UTF-8//TRANSLIT//IGNORE"
527 "\x00\x41;-c;IBM275;UTF-8//TRANSLIT//IGNORE"
528 diff --git a/iconvdata/Makefile b/iconvdata/Makefile
529 index 4ec2741cdc..4eef07557e 100644
530 --- a/iconvdata/Makefile
531 +++ b/iconvdata/Makefile
532 @@ -73,7 +73,8 @@ modules.so := $(addsuffix .so, $(modules))
533 ifeq (yes,$(build-shared))
534 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
535 tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
536 - bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4
537 + bug-iconv10 bug-iconv11 bug-iconv12 tst-iconv-big5-hkscs-to-2ucs4 \
538 + bug-iconv13 bug-iconv14
539 ifeq ($(have-thread-library),yes)
542 @@ -321,6 +322,8 @@ $(objpfx)bug-iconv10.out: $(objpfx)gconv-modules \
543 $(addprefix $(objpfx),$(modules.so))
544 $(objpfx)bug-iconv12.out: $(objpfx)gconv-modules \
545 $(addprefix $(objpfx),$(modules.so))
546 +$(objpfx)bug-iconv14.out: $(objpfx)gconv-modules \
547 + $(addprefix $(objpfx),$(modules.so))
549 $(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
550 $(addprefix $(objpfx),$(modules.so)) \
551 diff --git a/iconvdata/bug-iconv13.c b/iconvdata/bug-iconv13.c
553 index 0000000000..87aaff398e
555 +++ b/iconvdata/bug-iconv13.c
557 +/* bug 24973: Test EUC-KR module
558 + Copyright (C) 2020 Free Software Foundation, Inc.
559 + This file is part of the GNU C Library.
561 + The GNU C Library is free software; you can redistribute it and/or
562 + modify it under the terms of the GNU Lesser General Public
563 + License as published by the Free Software Foundation; either
564 + version 2.1 of the License, or (at your option) any later version.
566 + The GNU C Library is distributed in the hope that it will be useful,
567 + but WITHOUT ANY WARRANTY; without even the implied warranty of
568 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
569 + Lesser General Public License for more details.
571 + You should have received a copy of the GNU Lesser General Public
572 + License along with the GNU C Library; if not, see
573 + <https://www.gnu.org/licenses/>. */
578 +#include <support/check.h>
583 + iconv_t cd = iconv_open ("UTF-8//IGNORE", "EUC-KR");
584 + TEST_VERIFY_EXIT (cd != (iconv_t) -1);
586 + /* 0xfe (->0x7e : row 94) and 0xc9 (->0x49 : row 41) are user-defined
587 + areas, which are not allowed and should be skipped over due to
588 + //IGNORE. The trailing 0xfe also is an incomplete sequence, which
589 + should be checked first. */
590 + char input[4] = { '\xc9', '\xa1', '\0', '\xfe' };
591 + char *inptr = input;
592 + size_t insize = sizeof (input);
594 + char *outptr = output;
595 + size_t outsize = sizeof (output);
597 + /* This used to crash due to buffer overrun. */
598 + TEST_VERIFY (iconv (cd, &inptr, &insize, &outptr, &outsize) == (size_t) -1);
599 + TEST_VERIFY (errno == EINVAL);
600 + /* The conversion should produce one character, the converted null
602 + TEST_VERIFY (sizeof (output) - outsize == 1);
604 + TEST_VERIFY_EXIT (iconv_close (cd) != -1);
609 +#include <support/test-driver.c>
610 diff --git a/iconvdata/bug-iconv14.c b/iconvdata/bug-iconv14.c
612 index 0000000000..902f140fa9
614 +++ b/iconvdata/bug-iconv14.c
616 +/* Assertion in ISO-2022-JP-3 due to two-character sequence (bug 27256).
617 + Copyright (C) 2021 Free Software Foundation, Inc.
618 + This file is part of the GNU C Library.
620 + The GNU C Library is free software; you can redistribute it and/or
621 + modify it under the terms of the GNU Lesser General Public
622 + License as published by the Free Software Foundation; either
623 + version 2.1 of the License, or (at your option) any later version.
625 + The GNU C Library is distributed in the hope that it will be useful,
626 + but WITHOUT ANY WARRANTY; without even the implied warranty of
627 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
628 + Lesser General Public License for more details.
630 + You should have received a copy of the GNU Lesser General Public
631 + License along with the GNU C Library; if not, see
632 + <https://www.gnu.org/licenses/>. */
637 +#include <support/check.h>
639 +/* Use an escape sequence to return to the initial state. */
641 +with_escape_sequence (void)
643 + iconv_t c = iconv_open ("UTF-8", "ISO-2022-JP-3");
644 + TEST_VERIFY_EXIT (c != (iconv_t) -1);
646 + char in[] = "\e$(O+D\e(B";
648 + size_t inleft = strlen (in);
649 + char out[3]; /* Space for one output character. */
654 + outleft = sizeof (out);
655 + TEST_COMPARE (iconv (c, &inbuf, &inleft, &outbuf, &outleft), (size_t) -1);
656 + TEST_COMPARE (errno, E2BIG);
657 + TEST_COMPARE (inleft, 3);
658 + TEST_COMPARE (inbuf - in, strlen (in) - 3);
659 + TEST_COMPARE (outleft, sizeof (out) - 2);
660 + TEST_COMPARE (outbuf - out, 2);
661 + TEST_COMPARE (out[0] & 0xff, 0xc3);
662 + TEST_COMPARE (out[1] & 0xff, 0xa6);
664 + /* Return to the initial shift state, producing the pending
667 + outleft = sizeof (out);
668 + TEST_COMPARE (iconv (c, &inbuf, &inleft, &outbuf, &outleft), 0);
669 + TEST_COMPARE (inleft, 0);
670 + TEST_COMPARE (inbuf - in, strlen (in));
671 + TEST_COMPARE (outleft, sizeof (out) - 2);
672 + TEST_COMPARE (outbuf - out, 2);
673 + TEST_COMPARE (out[0] & 0xff, 0xcc);
674 + TEST_COMPARE (out[1] & 0xff, 0x80);
676 + /* Nothing should be flushed the second time. */
678 + outleft = sizeof (out);
679 + TEST_COMPARE (iconv (c, NULL, 0, &outbuf, &outleft), 0);
680 + TEST_COMPARE (outleft, sizeof (out));
681 + TEST_COMPARE (outbuf - out, 0);
682 + TEST_COMPARE (out[0] & 0xff, 0xcc);
683 + TEST_COMPARE (out[1] & 0xff, 0x80);
685 + TEST_COMPARE (iconv_close (c), 0);
688 +/* Use an explicit flush to return to the initial state. */
692 + iconv_t c = iconv_open ("UTF-8", "ISO-2022-JP-3");
693 + TEST_VERIFY_EXIT (c != (iconv_t) -1);
695 + char in[] = "\e$(O+D";
697 + size_t inleft = strlen (in);
698 + char out[3]; /* Space for one output character. */
703 + outleft = sizeof (out);
704 + TEST_COMPARE (iconv (c, &inbuf, &inleft, &outbuf, &outleft), (size_t) -1);
705 + TEST_COMPARE (errno, E2BIG);
706 + TEST_COMPARE (inleft, 0);
707 + TEST_COMPARE (inbuf - in, strlen (in));
708 + TEST_COMPARE (outleft, sizeof (out) - 2);
709 + TEST_COMPARE (outbuf - out, 2);
710 + TEST_COMPARE (out[0] & 0xff, 0xc3);
711 + TEST_COMPARE (out[1] & 0xff, 0xa6);
713 + /* Flush the pending character. */
715 + outleft = sizeof (out);
716 + TEST_COMPARE (iconv (c, NULL, 0, &outbuf, &outleft), 0);
717 + TEST_COMPARE (outleft, sizeof (out) - 2);
718 + TEST_COMPARE (outbuf - out, 2);
719 + TEST_COMPARE (out[0] & 0xff, 0xcc);
720 + TEST_COMPARE (out[1] & 0xff, 0x80);
722 + /* Nothing should be flushed the second time. */
724 + outleft = sizeof (out);
725 + TEST_COMPARE (iconv (c, NULL, 0, &outbuf, &outleft), 0);
726 + TEST_COMPARE (outleft, sizeof (out));
727 + TEST_COMPARE (outbuf - out, 0);
728 + TEST_COMPARE (out[0] & 0xff, 0xcc);
729 + TEST_COMPARE (out[1] & 0xff, 0x80);
731 + TEST_COMPARE (iconv_close (c), 0);
737 + with_escape_sequence ();
742 +#include <support/test-driver.c>
743 diff --git a/iconvdata/euc-kr.c b/iconvdata/euc-kr.c
744 index b0d56cf3ee..1045bae926 100644
745 --- a/iconvdata/euc-kr.c
746 +++ b/iconvdata/euc-kr.c
747 @@ -80,11 +80,7 @@ euckr_from_ucs4 (uint32_t ch, unsigned char *cp)
751 - /* 0xfe(->0x7e : row 94) and 0xc9(->0x59 : row 41) are \
752 - user-defined areas. */ \
753 - else if (__builtin_expect (ch == 0xa0, 0) \
754 - || __builtin_expect (ch > 0xfe, 0) \
755 - || __builtin_expect (ch == 0xc9, 0)) \
756 + else if (__glibc_unlikely (ch == 0xa0)) \
758 /* This is illegal. */ \
759 STANDARD_FROM_LOOP_ERR_HANDLER (1); \
760 diff --git a/iconvdata/ibm1364.c b/iconvdata/ibm1364.c
761 index 49e7267ab4..521f0825b7 100644
762 --- a/iconvdata/ibm1364.c
763 +++ b/iconvdata/ibm1364.c
764 @@ -158,24 +158,14 @@ enum
766 if (__builtin_expect (ch, 0) == SO) \
768 - /* Shift OUT, change to DBCS converter. */ \
771 - result = __GCONV_ILLEGAL_INPUT; \
774 + /* Shift OUT, change to DBCS converter (redundant escape okay). */ \
779 if (__builtin_expect (ch, 0) == SI) \
781 - /* Shift IN, change to SBCS converter. */ \
784 - result = __GCONV_ILLEGAL_INPUT; \
787 + /* Shift IN, change to SBCS converter (redundant escape okay). */ \
791 diff --git a/iconvdata/iso-2022-jp-3.c b/iconvdata/iso-2022-jp-3.c
792 index 8c3b7e627e..62cbc54a11 100644
793 --- a/iconvdata/iso-2022-jp-3.c
794 +++ b/iconvdata/iso-2022-jp-3.c
795 @@ -67,23 +67,34 @@ enum
796 CURRENT_SEL_MASK = 7 << 3
799 -/* During UCS-4 to ISO-2022-JP-3 conversion, the COUNT element of the state
800 - also contains the last two bytes to be output, shifted by 6 bits, and a
801 - one-bit indicator whether they must be preceded by the shift sequence,
803 +/* During UCS-4 to ISO-2022-JP-3 conversion, the COUNT element of the
804 + state also contains the last two bytes to be output, shifted by 6
805 + bits, and a one-bit indicator whether they must be preceded by the
806 + shift sequence, in bit 22. During ISO-2022-JP-3 to UCS-4
807 + conversion, COUNT may also contain a non-zero pending wide
808 + character, shifted by six bits. This happens for certain inputs in
809 + JISX0213_1_2004_set and JISX0213_2_set if the second wide character
810 + in a combining sequence cannot be written because the buffer is
813 /* Since this is a stateful encoding we have to provide code which resets
814 the output state to the initial state. This has to be done during the
816 #define EMIT_SHIFT_TO_INIT \
817 - if ((data->__statep->__count & ~7) != ASCII_set) \
818 + if (data->__statep->__count != ASCII_set) \
820 if (FROM_DIRECTION) \
822 - /* It's easy, we don't have to emit anything, we just reset the \
823 - state for the input. */ \
824 - data->__statep->__count &= 7; \
825 - data->__statep->__count |= ASCII_set; \
826 + if (__glibc_likely (outbuf + 4 <= outend)) \
828 + /* Write out the last character. */ \
829 + *((uint32_t *) outbuf) = data->__statep->__count >> 6; \
830 + outbuf += sizeof (uint32_t); \
831 + data->__statep->__count = ASCII_set; \
834 + /* We don't have enough room in the output buffer. */ \
835 + status = __GCONV_FULL_OUTPUT; \
839 @@ -151,7 +162,21 @@ enum
840 #define LOOPFCT FROM_LOOP
843 - uint32_t ch = *inptr; \
846 + /* Output any pending character. */ \
848 + if (__glibc_unlikely (ch != 0)) \
850 + put32 (outptr, ch); \
852 + /* Remove the pending character, but preserve state bits. */ \
853 + set &= (1 << 6) - 1; \
857 + /* Otherwise read the next input byte. */ \
860 /* Recognize escape sequences. */ \
861 if (__glibc_unlikely (ch == ESC)) \
862 @@ -297,21 +322,25 @@ enum
863 uint32_t u1 = __jisx0213_to_ucs_combining[ch - 1][0]; \
864 uint32_t u2 = __jisx0213_to_ucs_combining[ch - 1][1]; \
868 + put32 (outptr, u1); \
871 /* See whether we have room for two characters. */ \
872 - if (outptr + 8 <= outend) \
873 + if (outptr + 4 <= outend) \
876 - put32 (outptr, u1); \
878 put32 (outptr, u2); \
884 - result = __GCONV_FULL_OUTPUT; \
888 + /* Otherwise store only the first character now, and \
889 + put the second one into the queue. */ \
891 + /* Tell the caller why we terminate the loop. */ \
892 + result = __GCONV_FULL_OUTPUT; \
897 diff --git a/iconvdata/ksc5601.h b/iconvdata/ksc5601.h
898 index d3eb3a4ff8..f5cdc72797 100644
899 --- a/iconvdata/ksc5601.h
900 +++ b/iconvdata/ksc5601.h
901 @@ -50,15 +50,15 @@ ksc5601_to_ucs4 (const unsigned char **s, size_t avail, unsigned char offset)
908 /* row 94(0x7e) and row 41(0x49) are user-defined area in KS C 5601 */
910 if (ch < offset || (ch - offset) <= 0x20 || (ch - offset) >= 0x7e
911 || (ch - offset) == 0x49)
912 return __UNKNOWN_10646_CHAR;
918 if (ch2 < offset || (ch2 - offset) <= 0x20 || (ch2 - offset) >= 0x7f)
919 return __UNKNOWN_10646_CHAR;
920 diff --git a/intl/dcigettext.c b/intl/dcigettext.c
921 index 2e7c662bc7..bd332e71da 100644
922 --- a/intl/dcigettext.c
923 +++ b/intl/dcigettext.c
924 @@ -1120,15 +1120,18 @@ _nl_find_msg (struct loaded_l10nfile *domain_file,
928 - struct gconv_spec conv_spec
929 - = { .fromcode = norm_add_slashes (charset, ""),
930 - .tocode = norm_add_slashes (outcharset, ""),
931 - /* We always want to use transliteration. */
935 + struct gconv_spec conv_spec;
937 + __gconv_create_spec (&conv_spec, charset, outcharset);
939 + /* We always want to use transliteration. */
940 + conv_spec.translit = true;
942 int r = __gconv_open (&conv_spec, &convd->conv,
945 + __gconv_destroy_spec (&conv_spec);
947 if (__builtin_expect (r != __GCONV_OK, 0))
949 /* If the output encoding is the same there is
950 diff --git a/intl/tst-codeset.c b/intl/tst-codeset.c
951 index fd70432eca..e9f6e5e09f 100644
952 --- a/intl/tst-codeset.c
953 +++ b/intl/tst-codeset.c
958 +#include <support/check.h>
966 unsetenv ("LANGUAGE");
967 unsetenv ("OUTPUT_CHARSET");
968 setlocale (LC_ALL, "de_DE.ISO-8859-1");
969 @@ -36,25 +34,21 @@ do_test (void)
970 bindtextdomain ("codeset", OBJPFX "domaindir");
972 /* Here we expect output in ISO-8859-1. */
973 - s = gettext ("cheese");
974 - if (strcmp (s, "K\344se"))
976 - printf ("call 1 returned: %s\n", s);
979 + TEST_COMPARE_STRING (gettext ("cheese"), "K\344se");
981 + /* Here we expect output in UTF-8. */
982 bind_textdomain_codeset ("codeset", "UTF-8");
983 + TEST_COMPARE_STRING (gettext ("cheese"), "K\303\244se");
985 - /* Here we expect output in UTF-8. */
986 - s = gettext ("cheese");
987 - if (strcmp (s, "K\303\244se"))
989 - printf ("call 2 returned: %s\n", s);
994 + /* `a with umlaut' is transliterated to `ae'. */
995 + bind_textdomain_codeset ("codeset", "ASCII//TRANSLIT");
996 + TEST_COMPARE_STRING (gettext ("cheese"), "Kaese");
998 + /* Transliteration also works by default even if not set. */
999 + bind_textdomain_codeset ("codeset", "ASCII");
1000 + TEST_COMPARE_STRING (gettext ("cheese"), "Kaese");
1005 -#define TEST_FUNCTION do_test ()
1006 -#include "../test-skeleton.c"
1007 +#include <support/test-driver.c>
1008 diff --git a/malloc/Makefile b/malloc/Makefile
1009 index e22cbde22d..5093e8730e 100644
1010 --- a/malloc/Makefile
1011 +++ b/malloc/Makefile
1012 @@ -62,6 +62,16 @@ endif
1013 tests += $(tests-static)
1014 test-srcs = tst-mtrace
1016 +# These tests either are run with MALLOC_CHECK_=3 by default or do not work
1017 +# with MALLOC_CHECK_=3 because they expect a specific failure.
1018 +tests-exclude-mcheck = tst-mcheck tst-malloc-usable \
1019 + tst-interpose-nothread tst-interpose-static-nothread \
1020 + tst-interpose-static-thread tst-malloc-too-large \
1021 + tst-mxfast tst-safe-linking
1023 +# Run all tests with MALLOC_CHECK_=3
1024 +tests-mcheck = $(filter-out $(tests-exclude-mcheck),$(tests))
1026 routines = malloc morecore mcheck mtrace obstack reallocarray \
1027 scratch_buffer_grow scratch_buffer_grow_preserve \
1028 scratch_buffer_set_array_size \
1029 @@ -100,6 +110,11 @@ $(objpfx)tst-malloc-thread-exit: $(shared-thread-library)
1030 $(objpfx)tst-malloc-thread-fail: $(shared-thread-library)
1031 $(objpfx)tst-malloc-fork-deadlock: $(shared-thread-library)
1032 $(objpfx)tst-malloc-stats-cancellation: $(shared-thread-library)
1033 +$(objpfx)tst-malloc-backtrace-mcheck: $(shared-thread-library)
1034 +$(objpfx)tst-malloc-thread-exit-mcheck: $(shared-thread-library)
1035 +$(objpfx)tst-malloc-thread-fail-mcheck: $(shared-thread-library)
1036 +$(objpfx)tst-malloc-fork-deadlock-mcheck: $(shared-thread-library)
1037 +$(objpfx)tst-malloc-stats-cancellation-mcheck: $(shared-thread-library)
1039 # Export the __malloc_initialize_hook variable to libc.so.
1040 LDFLAGS-tst-mallocstate = -rdynamic
1041 @@ -239,6 +254,8 @@ $(tests:%=$(objpfx)%.o): CPPFLAGS += -DTEST_NO_MALLOPT
1042 $(objpfx)tst-interpose-nothread: $(objpfx)tst-interpose-aux-nothread.o
1043 $(objpfx)tst-interpose-thread: \
1044 $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
1045 +$(objpfx)tst-interpose-thread-mcheck: \
1046 + $(objpfx)tst-interpose-aux-thread.o $(shared-thread-library)
1047 $(objpfx)tst-interpose-static-nothread: $(objpfx)tst-interpose-aux-nothread.o
1048 $(objpfx)tst-interpose-static-thread: \
1049 $(objpfx)tst-interpose-aux-thread.o $(static-thread-library)
1050 @@ -256,3 +273,6 @@ $(objpfx)tst-dynarray-fail-mem.out: $(objpfx)tst-dynarray-fail.out
1051 $(objpfx)tst-malloc-tcache-leak: $(shared-thread-library)
1052 $(objpfx)tst-malloc_info: $(shared-thread-library)
1053 $(objpfx)tst-mallocfork2: $(shared-thread-library)
1054 +$(objpfx)tst-malloc-tcache-leak-mcheck: $(shared-thread-library)
1055 +$(objpfx)tst-malloc_info-mcheck: $(shared-thread-library)
1056 +$(objpfx)tst-mallocfork2-mcheck: $(shared-thread-library)
1057 diff --git a/manual/tunables.texi b/manual/tunables.texi
1058 index 23ef0d40e7..d72d7a5ec0 100644
1059 --- a/manual/tunables.texi
1060 +++ b/manual/tunables.texi
1061 @@ -432,7 +432,11 @@ set shared cache size in bytes for use in memory and string routines.
1063 @deftp Tunable glibc.cpu.x86_non_temporal_threshold
1064 The @code{glibc.cpu.x86_non_temporal_threshold} tunable allows the user
1065 -to set threshold in bytes for non temporal store.
1066 +to set threshold in bytes for non temporal store. Non temporal stores
1067 +give a hint to the hardware to move data directly to memory without
1068 +displacing other data from the cache. This tunable is used by some
1069 +platforms to determine when to use non temporal stores in operations
1070 +like memmove and memcpy.
1072 This tunable is specific to i386 and x86-64.
1074 diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
1075 index 19d9cc5cfe..38221d0b2a 100644
1076 --- a/misc/sys/cdefs.h
1077 +++ b/misc/sys/cdefs.h
1078 @@ -124,13 +124,10 @@
1079 #define __bos0(ptr) __builtin_object_size (ptr, 0)
1081 #if __GNUC_PREREQ (4,3)
1082 -# define __warndecl(name, msg) \
1083 - extern void name (void) __attribute__((__warning__ (msg)))
1084 # define __warnattr(msg) __attribute__((__warning__ (msg)))
1085 # define __errordecl(name, msg) \
1086 extern void name (void) __attribute__((__error__ (msg)))
1088 -# define __warndecl(name, msg) extern void name (void)
1089 # define __warnattr(msg)
1090 # define __errordecl(name, msg) extern void name (void)
1092 diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c
1093 index 88c69d1e9c..381aa721ef 100644
1094 --- a/nscd/netgroupcache.c
1095 +++ b/nscd/netgroupcache.c
1096 @@ -248,7 +248,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
1098 ndomain = (ndomain ? newbuf + ndomaindiff
1101 + *tofreep = buffer = newbuf;
1104 nhost = memcpy (buffer + bufused,
1105 @@ -319,7 +319,7 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req,
1106 else if (status == NSS_STATUS_TRYAGAIN && e == ERANGE)
1109 - buffer = xrealloc (buffer, buflen);
1110 + *tofreep = buffer = xrealloc (buffer, buflen);
1112 else if (status == NSS_STATUS_RETURN
1113 || status == NSS_STATUS_NOTFOUND
1114 diff --git a/resolv/Makefile b/resolv/Makefile
1115 index b61c0c3e0c..dbd8f8bf4f 100644
1116 --- a/resolv/Makefile
1117 +++ b/resolv/Makefile
1118 @@ -61,6 +61,11 @@ tests += \
1120 tst-resolv-trailing \
1122 +# This test calls __res_context_send directly, which is not exported
1124 +tests-internal += tst-resolv-txnid-collision
1125 +tests-static += tst-resolv-txnid-collision
1127 # These tests need libdl.
1128 ifeq (yes,$(build-shared))
1130 @@ -191,6 +196,8 @@ $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library)
1131 $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library)
1132 $(objpfx)tst-resolv-threads: \
1133 $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
1134 +$(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \
1135 + $(static-thread-library)
1136 $(objpfx)tst-resolv-canonname: \
1137 $(libdl) $(objpfx)libresolv.so $(shared-thread-library)
1138 $(objpfx)tst-resolv-trustad: $(objpfx)libresolv.so $(shared-thread-library)
1139 diff --git a/resolv/res_send.c b/resolv/res_send.c
1140 index 7e5fec6646..70e5066031 100644
1141 --- a/resolv/res_send.c
1142 +++ b/resolv/res_send.c
1143 @@ -1342,15 +1342,6 @@ send_dg(res_state statp,
1145 return close_and_return_error (statp, resplen2);
1147 - if ((recvresp1 || hp->id != anhp->id)
1148 - && (recvresp2 || hp2->id != anhp->id)) {
1150 - * response from old query, ignore it.
1151 - * XXX - potential security hazard could
1152 - * be detected here.
1157 /* Paranoia check. Due to the connected UDP socket,
1158 the kernel has already filtered invalid addresses
1159 @@ -1360,15 +1351,24 @@ send_dg(res_state statp,
1161 /* Check for the correct header layout and a matching
1163 - if ((recvresp1 || !res_queriesmatch(buf, buf + buflen,
1167 - && (recvresp2 || !res_queriesmatch(buf2, buf2 + buflen2,
1172 + int matching_query = 0; /* Default to no matching query. */
1174 + && anhp->id == hp->id
1175 + && res_queriesmatch (buf, buf + buflen,
1176 + *thisansp, *thisansp + *thisanssizp))
1177 + matching_query = 1;
1179 + && anhp->id == hp2->id
1180 + && res_queriesmatch (buf2, buf2 + buflen2,
1181 + *thisansp, *thisansp + *thisanssizp))
1182 + matching_query = 2;
1183 + if (matching_query == 0)
1184 + /* Spurious UDP packet. Drop it and continue
1187 + need_recompute = 1;
1191 if (anhp->rcode == SERVFAIL ||
1192 anhp->rcode == NOTIMP ||
1193 @@ -1383,7 +1383,7 @@ send_dg(res_state statp,
1194 /* No data from the first reply. */
1196 /* We are waiting for a possible second reply. */
1197 - if (hp->id == anhp->id)
1198 + if (matching_query == 1)
1202 @@ -1414,7 +1414,7 @@ send_dg(res_state statp,
1205 /* Mark which reply we received. */
1206 - if (recvresp1 == 0 && hp->id == anhp->id)
1207 + if (matching_query == 1)
1211 diff --git a/resolv/tst-resolv-txnid-collision.c b/resolv/tst-resolv-txnid-collision.c
1212 new file mode 100644
1213 index 0000000000..189b76f126
1215 +++ b/resolv/tst-resolv-txnid-collision.c
1217 +/* Test parallel queries with transaction ID collisions.
1218 + Copyright (C) 2020 Free Software Foundation, Inc.
1219 + This file is part of the GNU C Library.
1221 + The GNU C Library is free software; you can redistribute it and/or
1222 + modify it under the terms of the GNU Lesser General Public
1223 + License as published by the Free Software Foundation; either
1224 + version 2.1 of the License, or (at your option) any later version.
1226 + The GNU C Library is distributed in the hope that it will be useful,
1227 + but WITHOUT ANY WARRANTY; without even the implied warranty of
1228 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1229 + Lesser General Public License for more details.
1231 + You should have received a copy of the GNU Lesser General Public
1232 + License along with the GNU C Library; if not, see
1233 + <https://www.gnu.org/licenses/>. */
1235 +#include <arpa/nameser.h>
1236 +#include <array_length.h>
1237 +#include <resolv-internal.h>
1238 +#include <resolv_context.h>
1239 +#include <stdbool.h>
1241 +#include <string.h>
1242 +#include <support/check.h>
1243 +#include <support/check_nss.h>
1244 +#include <support/resolv_test.h>
1245 +#include <support/support.h>
1246 +#include <support/test-driver.h>
1248 +/* Result of parsing a DNS question name.
1250 + A question name has the form reorder-N-M-rcode-C.example.net, where
1251 + N and M are either 0 and 1, corresponding to the reorder member,
1252 + and C is a number that will be stored in the rcode field.
1254 + Also see parse_qname below. */
1255 +struct parsed_qname
1257 + /* The DNS response code requested from the first server. The
1258 + second server always responds with RCODE zero. */
1261 + /* Indicates whether to perform reordering in the responses from the
1262 + respective server. */
1266 +/* Fills *PARSED based on QNAME. */
1268 +parse_qname (struct parsed_qname *parsed, const char *qname)
1274 + if (sscanf (qname, "reorder-%d-%d.rcode-%d.%ms",
1275 + &reorder0, &reorder1, &rcode, &suffix) == 4)
1277 + if (reorder0 != 0)
1278 + TEST_COMPARE (reorder0, 1);
1279 + if (reorder1 != 0)
1280 + TEST_COMPARE (reorder1, 1);
1281 + TEST_VERIFY (rcode >= 0 && rcode <= 15);
1282 + TEST_COMPARE_STRING (suffix, "example.net");
1285 + parsed->rcode = rcode;
1286 + parsed->reorder[0] = reorder0;
1287 + parsed->reorder[1] = reorder1;
1290 + FAIL_EXIT1 ("unexpected query: %s", qname);
1293 +/* Used to construct a response. The first server responds with an
1294 + error, the second server succeeds. */
1296 +build_response (const struct resolv_response_context *ctx,
1297 + struct resolv_response_builder *b,
1298 + const char *qname, uint16_t qclass, uint16_t qtype)
1300 + struct parsed_qname parsed;
1301 + parse_qname (&parsed, qname);
1303 + switch (ctx->server_index)
1307 + struct resolv_response_flags flags = { 0 };
1308 + if (parsed.rcode == 0)
1309 + /* Simulate a delegation in case a NODATA (RCODE zero)
1310 + response is requested. */
1311 + flags.clear_ra = true;
1313 + flags.rcode = parsed.rcode;
1315 + resolv_response_init (b, flags);
1316 + resolv_response_add_question (b, qname, qclass, qtype);
1322 + struct resolv_response_flags flags = { 0, };
1323 + resolv_response_init (b, flags);
1324 + resolv_response_add_question (b, qname, qclass, qtype);
1326 + resolv_response_section (b, ns_s_an);
1327 + resolv_response_open_record (b, qname, qclass, qtype, 0);
1330 + char ipv4[4] = { 192, 0, 2, 1 };
1331 + resolv_response_add_data (b, &ipv4, sizeof (ipv4));
1336 + = { 0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
1337 + resolv_response_add_data (b, &ipv6, sizeof (ipv6));
1339 + resolv_response_close_record (b);
1345 +/* Used to reorder responses. */
1346 +struct resolv_response_context *previous_query;
1348 +/* Used to keep track of the queries received. */
1349 +static int previous_server_index = -1;
1350 +static uint16_t previous_qtype;
1352 +/* For each server, buffer the first query and then send both answers
1353 + to the second query, reordered if requested. */
1355 +response (const struct resolv_response_context *ctx,
1356 + struct resolv_response_builder *b,
1357 + const char *qname, uint16_t qclass, uint16_t qtype)
1359 + TEST_VERIFY (qtype == T_A || qtype == T_AAAA);
1360 + if (ctx->server_index != 0)
1361 + TEST_COMPARE (ctx->server_index, 1);
1363 + struct parsed_qname parsed;
1364 + parse_qname (&parsed, qname);
1366 + if (previous_query == NULL)
1368 + /* No buffered query. Record this query and do not send a
1370 + TEST_COMPARE (previous_qtype, 0);
1371 + previous_query = resolv_response_context_duplicate (ctx);
1372 + previous_qtype = qtype;
1373 + resolv_response_drop (b);
1374 + previous_server_index = ctx->server_index;
1377 + printf ("info: buffering first query for: %s\n", qname);
1381 + TEST_VERIFY (previous_query != 0);
1382 + TEST_COMPARE (ctx->server_index, previous_server_index);
1383 + TEST_VERIFY (previous_qtype != qtype); /* Not a duplicate. */
1385 + /* If reordering, send a response for this query explicitly, and
1386 + then skip the implicit send. */
1387 + if (parsed.reorder[ctx->server_index])
1390 + printf ("info: sending reordered second response for: %s\n",
1392 + build_response (ctx, b, qname, qclass, qtype);
1393 + resolv_response_send_udp (ctx, b);
1394 + resolv_response_drop (b);
1397 + /* Build a response for the previous query and send it, thus
1398 + reordering the two responses. */
1401 + printf ("info: sending first response for: %s\n", qname);
1402 + struct resolv_response_builder *btmp
1403 + = resolv_response_builder_allocate (previous_query->query_buffer,
1404 + previous_query->query_length);
1405 + build_response (ctx, btmp, qname, qclass, previous_qtype);
1406 + resolv_response_send_udp (ctx, btmp);
1407 + resolv_response_builder_free (btmp);
1410 + /* If not reordering, send the reply as usual. */
1411 + if (!parsed.reorder[ctx->server_index])
1414 + printf ("info: sending non-reordered second response for: %s\n",
1416 + build_response (ctx, b, qname, qclass, qtype);
1419 + /* Unbuffer the response and prepare for the next query. */
1420 + resolv_response_context_free (previous_query);
1421 + previous_query = NULL;
1422 + previous_qtype = 0;
1423 + previous_server_index = -1;
1427 +/* Runs a query for QNAME and checks for the expected reply. See
1428 + struct parsed_qname for the expected format for QNAME. */
1430 +test_qname (const char *qname, int rcode)
1432 + struct resolv_context *ctx = __resolv_context_get ();
1433 + TEST_VERIFY_EXIT (ctx != NULL);
1435 + unsigned char q1[512];
1436 + int q1len = res_mkquery (QUERY, qname, C_IN, T_A, NULL, 0, NULL,
1438 + TEST_VERIFY_EXIT (q1len > 12);
1440 + unsigned char q2[512];
1441 + int q2len = res_mkquery (QUERY, qname, C_IN, T_AAAA, NULL, 0, NULL,
1443 + TEST_VERIFY_EXIT (q2len > 12);
1445 + /* Produce a transaction ID collision. */
1446 + memcpy (q2, q1, 2);
1448 + unsigned char ans1[512];
1449 + unsigned char *ans1p = ans1;
1450 + unsigned char *ans2p = NULL;
1453 + int ans2p_malloced = 0;
1455 + /* Perform a parallel A/AAAA query. */
1456 + int resplen1 = __res_context_send (ctx, q1, q1len, q2, q2len,
1457 + ans1, sizeof (ans1), &ans1p,
1459 + &resplen2, &ans2p_malloced);
1461 + TEST_VERIFY (resplen1 > 12);
1462 + TEST_VERIFY (resplen2 > 12);
1463 + if (resplen1 <= 12 || resplen2 <= 12)
1466 + if (rcode == 1 || rcode == 3)
1468 + /* Format Error and Name Error responses does not trigger
1469 + switching to the next server. */
1470 + TEST_COMPARE (ans1p[3] & 0x0f, rcode);
1471 + TEST_COMPARE (ans2p[3] & 0x0f, rcode);
1475 + /* The response should be successful. */
1476 + TEST_COMPARE (ans1p[3] & 0x0f, 0);
1477 + TEST_COMPARE (ans2p[3] & 0x0f, 0);
1479 + /* Due to bug 19691, the answer may not be in the slot matching the
1480 + query. Assume that the AAAA response is the longer one. */
1481 + unsigned char *a_answer;
1482 + int a_answer_length;
1483 + unsigned char *aaaa_answer;
1484 + int aaaa_answer_length;
1485 + if (resplen2 > resplen1)
1488 + a_answer_length = resplen1;
1489 + aaaa_answer = ans2p;
1490 + aaaa_answer_length = resplen2;
1495 + a_answer_length = resplen2;
1496 + aaaa_answer = ans1p;
1497 + aaaa_answer_length = resplen1;
1501 + char *expected = xasprintf ("name: %s\n"
1502 + "address: 192.0.2.1\n",
1504 + check_dns_packet (qname, a_answer, a_answer_length, expected);
1508 + char *expected = xasprintf ("name: %s\n"
1509 + "address: 2001:db8::1\n",
1511 + check_dns_packet (qname, aaaa_answer, aaaa_answer_length, expected);
1515 + if (ans2p_malloced)
1518 + __resolv_context_put (ctx);
1524 + struct resolv_test *aux = resolv_test_start
1525 + ((struct resolv_redirect_config)
1527 + .response_callback = response,
1529 + /* The response callback use global state (the previous_*
1530 + variables), and query processing must therefore be
1532 + .single_thread_udp = true,
1535 + for (int rcode = 0; rcode <= 5; ++rcode)
1536 + for (int do_reorder_0 = 0; do_reorder_0 < 2; ++do_reorder_0)
1537 + for (int do_reorder_1 = 0; do_reorder_1 < 2; ++do_reorder_1)
1539 + char *qname = xasprintf ("reorder-%d-%d.rcode-%d.example.net",
1540 + do_reorder_0, do_reorder_1, rcode);
1541 + test_qname (qname, rcode);
1545 + resolv_test_end (aux);
1550 +#include <support/test-driver.c>
1551 diff --git a/stdio-common/Makefile b/stdio-common/Makefile
1552 index 8475fd1f09..eff0c98d82 100644
1553 --- a/stdio-common/Makefile
1554 +++ b/stdio-common/Makefile
1555 @@ -69,7 +69,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
1556 tst-printf-bz25691 \
1557 tst-vfprintf-width-prec-alloc \
1558 tst-printf-fp-free \
1559 - tst-printf-fp-leak
1560 + tst-printf-fp-leak \
1564 test-srcs = tst-unbputc tst-printf tst-printfsz-islongdouble
1565 diff --git a/stdio-common/errlist.c b/stdio-common/errlist.c
1566 index d15f13a22a..2ecf121674 100644
1567 --- a/stdio-common/errlist.c
1568 +++ b/stdio-common/errlist.c
1570 #include <libintl.h>
1571 #include <array_length.h>
1574 +# define ERR_MAP(n) n
1577 const char *const _sys_errlist_internal[] =
1579 -#define _S(n, str) [n] = str,
1580 +#define _S(n, str) [ERR_MAP(n)] = str,
1581 #include <errlist.h>
1584 @@ -41,20 +45,21 @@ static const union sys_errname_t
1586 #define MSGSTRFIELD1(line) str##line
1587 #define MSGSTRFIELD(line) MSGSTRFIELD1(line)
1588 -#define _S(n, str) char MSGSTRFIELD(__LINE__)[sizeof(str)];
1589 +#define _S(n, str) char MSGSTRFIELD(__LINE__)[sizeof(#n)];
1590 #include <errlist.h>
1594 } _sys_errname = { {
1595 -#define _S(n, s) s,
1596 +#define _S(n, s) #n,
1597 #include <errlist.h>
1601 static const unsigned short _sys_errnameidx[] =
1603 -#define _S(n, s) [n] = offsetof(union sys_errname_t, MSGSTRFIELD(__LINE__)),
1605 + [ERR_MAP(n)] = offsetof(union sys_errname_t, MSGSTRFIELD(__LINE__)),
1606 #include <errlist.h>
1609 diff --git a/stdio-common/test-strerr.c b/stdio-common/test-strerr.c
1610 index fded208118..d77b81d507 100644
1611 --- a/stdio-common/test-strerr.c
1612 +++ b/stdio-common/test-strerr.c
1613 @@ -18,46 +18,672 @@
1617 -#include <array_length.h>
1619 #include <support/support.h>
1620 #include <support/check.h>
1622 -#define N_(name) name
1624 -static const char *const errlist[] =
1626 -/* This file is auto-generated from errlist.def. */
1627 -#include <errlist.h>
1630 -#define MSGSTR_T errname_t
1631 -#define MSGSTR errname
1632 -#define MSGIDX errnameidx
1633 -#include <errlist-name.h>
1640 - TEST_VERIFY (strerrordesc_np (-1) == NULL);
1641 - TEST_VERIFY (strerrordesc_np (array_length (errlist)) == NULL);
1642 - for (size_t i = 0; i < array_length (errlist); i++)
1644 - if (errlist[i] == NULL)
1646 - TEST_COMPARE_STRING (strerrordesc_np (i), errlist[i]);
1648 + TEST_COMPARE_STRING (strerrordesc_np (0), "Success");
1649 + TEST_COMPARE_STRING (strerrorname_np (0), "0");
1651 - TEST_VERIFY (strerrorname_np (-1) == NULL);
1652 - TEST_VERIFY (strerrorname_np (array_length (errlist)) == NULL);
1653 - for (size_t i = 0; i < array_length (errlist); i++)
1655 - if (errlist[i] == NULL)
1657 - TEST_COMPARE_STRING (strerrorname_np (i), errname.str + errnameidx[i]);
1660 + TEST_COMPARE_STRING (strerrordesc_np (EPERM), "Operation not permitted");
1661 + TEST_COMPARE_STRING (strerrorname_np (EPERM), "EPERM");
1664 + TEST_COMPARE_STRING (strerrordesc_np (ENOENT),
1665 + "No such file or directory");
1666 + TEST_COMPARE_STRING (strerrorname_np (ENOENT), "ENOENT");
1669 + TEST_COMPARE_STRING (strerrordesc_np (ESRCH), "No such process");
1670 + TEST_COMPARE_STRING (strerrorname_np (ESRCH), "ESRCH");
1673 + TEST_COMPARE_STRING (strerrordesc_np (EINTR), "Interrupted system call");
1674 + TEST_COMPARE_STRING (strerrorname_np (EINTR), "EINTR");
1677 + TEST_COMPARE_STRING (strerrordesc_np (EIO), "Input/output error");
1678 + TEST_COMPARE_STRING (strerrorname_np (EIO), "EIO");
1681 + TEST_COMPARE_STRING (strerrordesc_np (ENXIO), "No such device or address");
1682 + TEST_COMPARE_STRING (strerrorname_np (ENXIO), "ENXIO");
1685 + TEST_COMPARE_STRING (strerrordesc_np (E2BIG), "Argument list too long");
1686 + TEST_COMPARE_STRING (strerrorname_np (E2BIG), "E2BIG");
1689 + TEST_COMPARE_STRING (strerrordesc_np (ENOEXEC), "Exec format error");
1690 + TEST_COMPARE_STRING (strerrorname_np (ENOEXEC), "ENOEXEC");
1693 + TEST_COMPARE_STRING (strerrordesc_np (EBADF), "Bad file descriptor");
1694 + TEST_COMPARE_STRING (strerrorname_np (EBADF), "EBADF");
1697 + TEST_COMPARE_STRING (strerrordesc_np (ECHILD), "No child processes");
1698 + TEST_COMPARE_STRING (strerrorname_np (ECHILD), "ECHILD");
1701 + TEST_COMPARE_STRING (strerrordesc_np (EDEADLK),
1702 + "Resource deadlock avoided");
1703 + TEST_COMPARE_STRING (strerrorname_np (EDEADLK), "EDEADLK");
1706 + TEST_COMPARE_STRING (strerrordesc_np (ENOMEM), "Cannot allocate memory");
1707 + TEST_COMPARE_STRING (strerrorname_np (ENOMEM), "ENOMEM");
1710 + TEST_COMPARE_STRING (strerrordesc_np (EACCES), "Permission denied");
1711 + TEST_COMPARE_STRING (strerrorname_np (EACCES), "EACCES");
1714 + TEST_COMPARE_STRING (strerrordesc_np (EFAULT), "Bad address");
1715 + TEST_COMPARE_STRING (strerrorname_np (EFAULT), "EFAULT");
1718 + TEST_COMPARE_STRING (strerrordesc_np (ENOTBLK), "Block device required");
1719 + TEST_COMPARE_STRING (strerrorname_np (ENOTBLK), "ENOTBLK");
1722 + TEST_COMPARE_STRING (strerrordesc_np (EBUSY), "Device or resource busy");
1723 + TEST_COMPARE_STRING (strerrorname_np (EBUSY), "EBUSY");
1726 + TEST_COMPARE_STRING (strerrordesc_np (EEXIST), "File exists");
1727 + TEST_COMPARE_STRING (strerrorname_np (EEXIST), "EEXIST");
1730 + TEST_COMPARE_STRING (strerrordesc_np (EXDEV), "Invalid cross-device link");
1731 + TEST_COMPARE_STRING (strerrorname_np (EXDEV), "EXDEV");
1734 + TEST_COMPARE_STRING (strerrordesc_np (ENODEV), "No such device");
1735 + TEST_COMPARE_STRING (strerrorname_np (ENODEV), "ENODEV");
1738 + TEST_COMPARE_STRING (strerrordesc_np (ENOTDIR), "Not a directory");
1739 + TEST_COMPARE_STRING (strerrorname_np (ENOTDIR), "ENOTDIR");
1742 + TEST_COMPARE_STRING (strerrordesc_np (EISDIR), "Is a directory");
1743 + TEST_COMPARE_STRING (strerrorname_np (EISDIR), "EISDIR");
1746 + TEST_COMPARE_STRING (strerrordesc_np (EINVAL), "Invalid argument");
1747 + TEST_COMPARE_STRING (strerrorname_np (EINVAL), "EINVAL");
1750 + TEST_COMPARE_STRING (strerrordesc_np (EMFILE), "Too many open files");
1751 + TEST_COMPARE_STRING (strerrorname_np (EMFILE), "EMFILE");
1754 + TEST_COMPARE_STRING (strerrordesc_np (ENFILE),
1755 + "Too many open files in system");
1756 + TEST_COMPARE_STRING (strerrorname_np (ENFILE), "ENFILE");
1759 + TEST_COMPARE_STRING (strerrordesc_np (ENOTTY),
1760 + "Inappropriate ioctl for device");
1761 + TEST_COMPARE_STRING (strerrorname_np (ENOTTY), "ENOTTY");
1764 + TEST_COMPARE_STRING (strerrordesc_np (ETXTBSY), "Text file busy");
1765 + TEST_COMPARE_STRING (strerrorname_np (ETXTBSY), "ETXTBSY");
1768 + TEST_COMPARE_STRING (strerrordesc_np (EFBIG), "File too large");
1769 + TEST_COMPARE_STRING (strerrorname_np (EFBIG), "EFBIG");
1772 + TEST_COMPARE_STRING (strerrordesc_np (ENOSPC), "No space left on device");
1773 + TEST_COMPARE_STRING (strerrorname_np (ENOSPC), "ENOSPC");
1776 + TEST_COMPARE_STRING (strerrordesc_np (ESPIPE), "Illegal seek");
1777 + TEST_COMPARE_STRING (strerrorname_np (ESPIPE), "ESPIPE");
1780 + TEST_COMPARE_STRING (strerrordesc_np (EROFS), "Read-only file system");
1781 + TEST_COMPARE_STRING (strerrorname_np (EROFS), "EROFS");
1784 + TEST_COMPARE_STRING (strerrordesc_np (EMLINK), "Too many links");
1785 + TEST_COMPARE_STRING (strerrorname_np (EMLINK), "EMLINK");
1788 + TEST_COMPARE_STRING (strerrordesc_np (EPIPE), "Broken pipe");
1789 + TEST_COMPARE_STRING (strerrorname_np (EPIPE), "EPIPE");
1792 + TEST_COMPARE_STRING (strerrordesc_np (EDOM),
1793 + "Numerical argument out of domain");
1794 + TEST_COMPARE_STRING (strerrorname_np (EDOM), "EDOM");
1797 + TEST_COMPARE_STRING (strerrordesc_np (ERANGE),
1798 + "Numerical result out of range");
1799 + TEST_COMPARE_STRING (strerrorname_np (ERANGE), "ERANGE");
1802 + TEST_COMPARE_STRING (strerrordesc_np (EAGAIN),
1803 + "Resource temporarily unavailable");
1804 + TEST_COMPARE_STRING (strerrorname_np (EAGAIN), "EAGAIN");
1807 + TEST_COMPARE_STRING (strerrordesc_np (EINPROGRESS),
1808 + "Operation now in progress");
1809 + TEST_COMPARE_STRING (strerrorname_np (EINPROGRESS), "EINPROGRESS");
1812 + TEST_COMPARE_STRING (strerrordesc_np (EALREADY),
1813 + "Operation already in progress");
1814 + TEST_COMPARE_STRING (strerrorname_np (EALREADY), "EALREADY");
1817 + TEST_COMPARE_STRING (strerrordesc_np (ENOTSOCK),
1818 + "Socket operation on non-socket");
1819 + TEST_COMPARE_STRING (strerrorname_np (ENOTSOCK), "ENOTSOCK");
1822 + TEST_COMPARE_STRING (strerrordesc_np (EMSGSIZE), "Message too long");
1823 + TEST_COMPARE_STRING (strerrorname_np (EMSGSIZE), "EMSGSIZE");
1826 + TEST_COMPARE_STRING (strerrordesc_np (EPROTOTYPE),
1827 + "Protocol wrong type for socket");
1828 + TEST_COMPARE_STRING (strerrorname_np (EPROTOTYPE), "EPROTOTYPE");
1831 + TEST_COMPARE_STRING (strerrordesc_np (ENOPROTOOPT),
1832 + "Protocol not available");
1833 + TEST_COMPARE_STRING (strerrorname_np (ENOPROTOOPT), "ENOPROTOOPT");
1835 +#ifdef EPROTONOSUPPORT
1836 + TEST_COMPARE_STRING (strerrordesc_np (EPROTONOSUPPORT),
1837 + "Protocol not supported");
1838 + TEST_COMPARE_STRING (strerrorname_np (EPROTONOSUPPORT), "EPROTONOSUPPORT");
1840 +#ifdef ESOCKTNOSUPPORT
1841 + TEST_COMPARE_STRING (strerrordesc_np (ESOCKTNOSUPPORT),
1842 + "Socket type not supported");
1843 + TEST_COMPARE_STRING (strerrorname_np (ESOCKTNOSUPPORT), "ESOCKTNOSUPPORT");
1846 + TEST_COMPARE_STRING (strerrordesc_np (EOPNOTSUPP),
1847 + "Operation not supported");
1848 + TEST_COMPARE_STRING (strerrorname_np (EOPNOTSUPP), "EOPNOTSUPP");
1850 +#ifdef EPFNOSUPPORT
1851 + TEST_COMPARE_STRING (strerrordesc_np (EPFNOSUPPORT),
1852 + "Protocol family not supported");
1853 + TEST_COMPARE_STRING (strerrorname_np (EPFNOSUPPORT), "EPFNOSUPPORT");
1855 +#ifdef EAFNOSUPPORT
1856 + TEST_COMPARE_STRING (strerrordesc_np (EAFNOSUPPORT),
1857 + "Address family not supported by protocol");
1858 + TEST_COMPARE_STRING (strerrorname_np (EAFNOSUPPORT), "EAFNOSUPPORT");
1861 + TEST_COMPARE_STRING (strerrordesc_np (EADDRINUSE),
1862 + "Address already in use");
1863 + TEST_COMPARE_STRING (strerrorname_np (EADDRINUSE), "EADDRINUSE");
1865 +#ifdef EADDRNOTAVAIL
1866 + TEST_COMPARE_STRING (strerrordesc_np (EADDRNOTAVAIL),
1867 + "Cannot assign requested address");
1868 + TEST_COMPARE_STRING (strerrorname_np (EADDRNOTAVAIL), "EADDRNOTAVAIL");
1871 + TEST_COMPARE_STRING (strerrordesc_np (ENETDOWN), "Network is down");
1872 + TEST_COMPARE_STRING (strerrorname_np (ENETDOWN), "ENETDOWN");
1875 + TEST_COMPARE_STRING (strerrordesc_np (ENETUNREACH),
1876 + "Network is unreachable");
1877 + TEST_COMPARE_STRING (strerrorname_np (ENETUNREACH), "ENETUNREACH");
1880 + TEST_COMPARE_STRING (strerrordesc_np (ENETRESET),
1881 + "Network dropped connection on reset");
1882 + TEST_COMPARE_STRING (strerrorname_np (ENETRESET), "ENETRESET");
1884 +#ifdef ECONNABORTED
1885 + TEST_COMPARE_STRING (strerrordesc_np (ECONNABORTED),
1886 + "Software caused connection abort");
1887 + TEST_COMPARE_STRING (strerrorname_np (ECONNABORTED), "ECONNABORTED");
1890 + TEST_COMPARE_STRING (strerrordesc_np (ECONNRESET),
1891 + "Connection reset by peer");
1892 + TEST_COMPARE_STRING (strerrorname_np (ECONNRESET), "ECONNRESET");
1895 + TEST_COMPARE_STRING (strerrordesc_np (ENOBUFS),
1896 + "No buffer space available");
1897 + TEST_COMPARE_STRING (strerrorname_np (ENOBUFS), "ENOBUFS");
1900 + TEST_COMPARE_STRING (strerrordesc_np (EISCONN),
1901 + "Transport endpoint is already connected");
1902 + TEST_COMPARE_STRING (strerrorname_np (EISCONN), "EISCONN");
1905 + TEST_COMPARE_STRING (strerrordesc_np (ENOTCONN),
1906 + "Transport endpoint is not connected");
1907 + TEST_COMPARE_STRING (strerrorname_np (ENOTCONN), "ENOTCONN");
1909 +#ifdef EDESTADDRREQ
1910 + TEST_COMPARE_STRING (strerrordesc_np (EDESTADDRREQ),
1911 + "Destination address required");
1912 + TEST_COMPARE_STRING (strerrorname_np (EDESTADDRREQ), "EDESTADDRREQ");
1915 + TEST_COMPARE_STRING (strerrordesc_np (ESHUTDOWN),
1916 + "Cannot send after transport endpoint shutdown");
1917 + TEST_COMPARE_STRING (strerrorname_np (ESHUTDOWN), "ESHUTDOWN");
1919 +#ifdef ETOOMANYREFS
1920 + TEST_COMPARE_STRING (strerrordesc_np (ETOOMANYREFS),
1921 + "Too many references: cannot splice");
1922 + TEST_COMPARE_STRING (strerrorname_np (ETOOMANYREFS), "ETOOMANYREFS");
1925 + TEST_COMPARE_STRING (strerrordesc_np (ETIMEDOUT), "Connection timed out");
1926 + TEST_COMPARE_STRING (strerrorname_np (ETIMEDOUT), "ETIMEDOUT");
1928 +#ifdef ECONNREFUSED
1929 + TEST_COMPARE_STRING (strerrordesc_np (ECONNREFUSED), "Connection refused");
1930 + TEST_COMPARE_STRING (strerrorname_np (ECONNREFUSED), "ECONNREFUSED");
1933 + TEST_COMPARE_STRING (strerrordesc_np (ELOOP),
1934 + "Too many levels of symbolic links");
1935 + TEST_COMPARE_STRING (strerrorname_np (ELOOP), "ELOOP");
1937 +#ifdef ENAMETOOLONG
1938 + TEST_COMPARE_STRING (strerrordesc_np (ENAMETOOLONG), "File name too long");
1939 + TEST_COMPARE_STRING (strerrorname_np (ENAMETOOLONG), "ENAMETOOLONG");
1942 + TEST_COMPARE_STRING (strerrordesc_np (EHOSTDOWN), "Host is down");
1943 + TEST_COMPARE_STRING (strerrorname_np (EHOSTDOWN), "EHOSTDOWN");
1945 +#ifdef EHOSTUNREACH
1946 + TEST_COMPARE_STRING (strerrordesc_np (EHOSTUNREACH), "No route to host");
1947 + TEST_COMPARE_STRING (strerrorname_np (EHOSTUNREACH), "EHOSTUNREACH");
1950 + TEST_COMPARE_STRING (strerrordesc_np (ENOTEMPTY), "Directory not empty");
1951 + TEST_COMPARE_STRING (strerrorname_np (ENOTEMPTY), "ENOTEMPTY");
1954 + TEST_COMPARE_STRING (strerrordesc_np (EUSERS), "Too many users");
1955 + TEST_COMPARE_STRING (strerrorname_np (EUSERS), "EUSERS");
1958 + TEST_COMPARE_STRING (strerrordesc_np (EDQUOT), "Disk quota exceeded");
1959 + TEST_COMPARE_STRING (strerrorname_np (EDQUOT), "EDQUOT");
1962 + TEST_COMPARE_STRING (strerrordesc_np (ESTALE), "Stale file handle");
1963 + TEST_COMPARE_STRING (strerrorname_np (ESTALE), "ESTALE");
1966 + TEST_COMPARE_STRING (strerrordesc_np (EREMOTE), "Object is remote");
1967 + TEST_COMPARE_STRING (strerrorname_np (EREMOTE), "EREMOTE");
1970 + TEST_COMPARE_STRING (strerrordesc_np (ENOLCK), "No locks available");
1971 + TEST_COMPARE_STRING (strerrorname_np (ENOLCK), "ENOLCK");
1974 + TEST_COMPARE_STRING (strerrordesc_np (ENOSYS), "Function not implemented");
1975 + TEST_COMPARE_STRING (strerrorname_np (ENOSYS), "ENOSYS");
1978 + TEST_COMPARE_STRING (strerrordesc_np (EILSEQ),
1979 + "Invalid or incomplete multibyte or wide character");
1980 + TEST_COMPARE_STRING (strerrorname_np (EILSEQ), "EILSEQ");
1983 + TEST_COMPARE_STRING (strerrordesc_np (EBADMSG), "Bad message");
1984 + TEST_COMPARE_STRING (strerrorname_np (EBADMSG), "EBADMSG");
1987 + TEST_COMPARE_STRING (strerrordesc_np (EIDRM), "Identifier removed");
1988 + TEST_COMPARE_STRING (strerrorname_np (EIDRM), "EIDRM");
1991 + TEST_COMPARE_STRING (strerrordesc_np (EMULTIHOP), "Multihop attempted");
1992 + TEST_COMPARE_STRING (strerrorname_np (EMULTIHOP), "EMULTIHOP");
1995 + TEST_COMPARE_STRING (strerrordesc_np (ENODATA), "No data available");
1996 + TEST_COMPARE_STRING (strerrorname_np (ENODATA), "ENODATA");
1999 + TEST_COMPARE_STRING (strerrordesc_np (ENOLINK), "Link has been severed");
2000 + TEST_COMPARE_STRING (strerrorname_np (ENOLINK), "ENOLINK");
2003 + TEST_COMPARE_STRING (strerrordesc_np (ENOMSG),
2004 + "No message of desired type");
2005 + TEST_COMPARE_STRING (strerrorname_np (ENOMSG), "ENOMSG");
2008 + TEST_COMPARE_STRING (strerrordesc_np (ENOSR), "Out of streams resources");
2009 + TEST_COMPARE_STRING (strerrorname_np (ENOSR), "ENOSR");
2012 + TEST_COMPARE_STRING (strerrordesc_np (ENOSTR), "Device not a stream");
2013 + TEST_COMPARE_STRING (strerrorname_np (ENOSTR), "ENOSTR");
2016 + TEST_COMPARE_STRING (strerrordesc_np (EOVERFLOW),
2017 + "Value too large for defined data type");
2018 + TEST_COMPARE_STRING (strerrorname_np (EOVERFLOW), "EOVERFLOW");
2021 + TEST_COMPARE_STRING (strerrordesc_np (EPROTO), "Protocol error");
2022 + TEST_COMPARE_STRING (strerrorname_np (EPROTO), "EPROTO");
2025 + TEST_COMPARE_STRING (strerrordesc_np (ETIME), "Timer expired");
2026 + TEST_COMPARE_STRING (strerrorname_np (ETIME), "ETIME");
2029 + TEST_COMPARE_STRING (strerrordesc_np (ECANCELED), "Operation canceled");
2030 + TEST_COMPARE_STRING (strerrorname_np (ECANCELED), "ECANCELED");
2033 + TEST_COMPARE_STRING (strerrordesc_np (EOWNERDEAD), "Owner died");
2034 + TEST_COMPARE_STRING (strerrorname_np (EOWNERDEAD), "EOWNERDEAD");
2036 +#ifdef ENOTRECOVERABLE
2037 + TEST_COMPARE_STRING (strerrordesc_np (ENOTRECOVERABLE),
2038 + "State not recoverable");
2039 + TEST_COMPARE_STRING (strerrorname_np (ENOTRECOVERABLE), "ENOTRECOVERABLE");
2042 + TEST_COMPARE_STRING (strerrordesc_np (ERESTART),
2043 + "Interrupted system call should be restarted");
2044 + TEST_COMPARE_STRING (strerrorname_np (ERESTART), "ERESTART");
2047 + TEST_COMPARE_STRING (strerrordesc_np (ECHRNG),
2048 + "Channel number out of range");
2049 + TEST_COMPARE_STRING (strerrorname_np (ECHRNG), "ECHRNG");
2052 + TEST_COMPARE_STRING (strerrordesc_np (EL2NSYNC),
2053 + "Level 2 not synchronized");
2054 + TEST_COMPARE_STRING (strerrorname_np (EL2NSYNC), "EL2NSYNC");
2057 + TEST_COMPARE_STRING (strerrordesc_np (EL3HLT), "Level 3 halted");
2058 + TEST_COMPARE_STRING (strerrorname_np (EL3HLT), "EL3HLT");
2061 + TEST_COMPARE_STRING (strerrordesc_np (EL3RST), "Level 3 reset");
2062 + TEST_COMPARE_STRING (strerrorname_np (EL3RST), "EL3RST");
2065 + TEST_COMPARE_STRING (strerrordesc_np (ELNRNG), "Link number out of range");
2066 + TEST_COMPARE_STRING (strerrorname_np (ELNRNG), "ELNRNG");
2069 + TEST_COMPARE_STRING (strerrordesc_np (EUNATCH),
2070 + "Protocol driver not attached");
2071 + TEST_COMPARE_STRING (strerrorname_np (EUNATCH), "EUNATCH");
2074 + TEST_COMPARE_STRING (strerrordesc_np (ENOCSI),
2075 + "No CSI structure available");
2076 + TEST_COMPARE_STRING (strerrorname_np (ENOCSI), "ENOCSI");
2079 + TEST_COMPARE_STRING (strerrordesc_np (EL2HLT), "Level 2 halted");
2080 + TEST_COMPARE_STRING (strerrorname_np (EL2HLT), "EL2HLT");
2083 + TEST_COMPARE_STRING (strerrordesc_np (EBADE), "Invalid exchange");
2084 + TEST_COMPARE_STRING (strerrorname_np (EBADE), "EBADE");
2087 + TEST_COMPARE_STRING (strerrordesc_np (EBADR),
2088 + "Invalid request descriptor");
2089 + TEST_COMPARE_STRING (strerrorname_np (EBADR), "EBADR");
2092 + TEST_COMPARE_STRING (strerrordesc_np (EXFULL), "Exchange full");
2093 + TEST_COMPARE_STRING (strerrorname_np (EXFULL), "EXFULL");
2096 + TEST_COMPARE_STRING (strerrordesc_np (ENOANO), "No anode");
2097 + TEST_COMPARE_STRING (strerrorname_np (ENOANO), "ENOANO");
2100 + TEST_COMPARE_STRING (strerrordesc_np (EBADRQC), "Invalid request code");
2101 + TEST_COMPARE_STRING (strerrorname_np (EBADRQC), "EBADRQC");
2104 + TEST_COMPARE_STRING (strerrordesc_np (EBADSLT), "Invalid slot");
2105 + TEST_COMPARE_STRING (strerrorname_np (EBADSLT), "EBADSLT");
2108 + TEST_COMPARE_STRING (strerrordesc_np (EBFONT), "Bad font file format");
2109 + TEST_COMPARE_STRING (strerrorname_np (EBFONT), "EBFONT");
2112 + TEST_COMPARE_STRING (strerrordesc_np (ENONET),
2113 + "Machine is not on the network");
2114 + TEST_COMPARE_STRING (strerrorname_np (ENONET), "ENONET");
2117 + TEST_COMPARE_STRING (strerrordesc_np (ENOPKG), "Package not installed");
2118 + TEST_COMPARE_STRING (strerrorname_np (ENOPKG), "ENOPKG");
2121 + TEST_COMPARE_STRING (strerrordesc_np (EADV), "Advertise error");
2122 + TEST_COMPARE_STRING (strerrorname_np (EADV), "EADV");
2125 + TEST_COMPARE_STRING (strerrordesc_np (ESRMNT), "Srmount error");
2126 + TEST_COMPARE_STRING (strerrorname_np (ESRMNT), "ESRMNT");
2129 + TEST_COMPARE_STRING (strerrordesc_np (ECOMM),
2130 + "Communication error on send");
2131 + TEST_COMPARE_STRING (strerrorname_np (ECOMM), "ECOMM");
2134 + TEST_COMPARE_STRING (strerrordesc_np (EDOTDOT), "RFS specific error");
2135 + TEST_COMPARE_STRING (strerrorname_np (EDOTDOT), "EDOTDOT");
2138 + TEST_COMPARE_STRING (strerrordesc_np (ENOTUNIQ),
2139 + "Name not unique on network");
2140 + TEST_COMPARE_STRING (strerrorname_np (ENOTUNIQ), "ENOTUNIQ");
2143 + TEST_COMPARE_STRING (strerrordesc_np (EBADFD),
2144 + "File descriptor in bad state");
2145 + TEST_COMPARE_STRING (strerrorname_np (EBADFD), "EBADFD");
2148 + TEST_COMPARE_STRING (strerrordesc_np (EREMCHG), "Remote address changed");
2149 + TEST_COMPARE_STRING (strerrorname_np (EREMCHG), "EREMCHG");
2152 + TEST_COMPARE_STRING (strerrordesc_np (ELIBACC),
2153 + "Can not access a needed shared library");
2154 + TEST_COMPARE_STRING (strerrorname_np (ELIBACC), "ELIBACC");
2157 + TEST_COMPARE_STRING (strerrordesc_np (ELIBBAD),
2158 + "Accessing a corrupted shared library");
2159 + TEST_COMPARE_STRING (strerrorname_np (ELIBBAD), "ELIBBAD");
2162 + TEST_COMPARE_STRING (strerrordesc_np (ELIBSCN),
2163 + ".lib section in a.out corrupted");
2164 + TEST_COMPARE_STRING (strerrorname_np (ELIBSCN), "ELIBSCN");
2167 + TEST_COMPARE_STRING (strerrordesc_np (ELIBMAX),
2168 + "Attempting to link in too many shared libraries");
2169 + TEST_COMPARE_STRING (strerrorname_np (ELIBMAX), "ELIBMAX");
2172 + TEST_COMPARE_STRING (strerrordesc_np (ELIBEXEC),
2173 + "Cannot exec a shared library directly");
2174 + TEST_COMPARE_STRING (strerrorname_np (ELIBEXEC), "ELIBEXEC");
2177 + TEST_COMPARE_STRING (strerrordesc_np (ESTRPIPE), "Streams pipe error");
2178 + TEST_COMPARE_STRING (strerrorname_np (ESTRPIPE), "ESTRPIPE");
2181 + TEST_COMPARE_STRING (strerrordesc_np (EUCLEAN),
2182 + "Structure needs cleaning");
2183 + TEST_COMPARE_STRING (strerrorname_np (EUCLEAN), "EUCLEAN");
2186 + TEST_COMPARE_STRING (strerrordesc_np (ENOTNAM),
2187 + "Not a XENIX named type file");
2188 + TEST_COMPARE_STRING (strerrorname_np (ENOTNAM), "ENOTNAM");
2191 + TEST_COMPARE_STRING (strerrordesc_np (ENAVAIL),
2192 + "No XENIX semaphores available");
2193 + TEST_COMPARE_STRING (strerrorname_np (ENAVAIL), "ENAVAIL");
2196 + TEST_COMPARE_STRING (strerrordesc_np (EISNAM), "Is a named type file");
2197 + TEST_COMPARE_STRING (strerrorname_np (EISNAM), "EISNAM");
2200 + TEST_COMPARE_STRING (strerrordesc_np (EREMOTEIO), "Remote I/O error");
2201 + TEST_COMPARE_STRING (strerrorname_np (EREMOTEIO), "EREMOTEIO");
2204 + TEST_COMPARE_STRING (strerrordesc_np (ENOMEDIUM), "No medium found");
2205 + TEST_COMPARE_STRING (strerrorname_np (ENOMEDIUM), "ENOMEDIUM");
2208 + TEST_COMPARE_STRING (strerrordesc_np (EMEDIUMTYPE), "Wrong medium type");
2209 + TEST_COMPARE_STRING (strerrorname_np (EMEDIUMTYPE), "EMEDIUMTYPE");
2212 + TEST_COMPARE_STRING (strerrordesc_np (ENOKEY),
2213 + "Required key not available");
2214 + TEST_COMPARE_STRING (strerrorname_np (ENOKEY), "ENOKEY");
2217 + TEST_COMPARE_STRING (strerrordesc_np (EKEYEXPIRED), "Key has expired");
2218 + TEST_COMPARE_STRING (strerrorname_np (EKEYEXPIRED), "EKEYEXPIRED");
2221 + TEST_COMPARE_STRING (strerrordesc_np (EKEYREVOKED),
2222 + "Key has been revoked");
2223 + TEST_COMPARE_STRING (strerrorname_np (EKEYREVOKED), "EKEYREVOKED");
2225 +#ifdef EKEYREJECTED
2226 + TEST_COMPARE_STRING (strerrordesc_np (EKEYREJECTED),
2227 + "Key was rejected by service");
2228 + TEST_COMPARE_STRING (strerrorname_np (EKEYREJECTED), "EKEYREJECTED");
2231 + TEST_COMPARE_STRING (strerrordesc_np (ERFKILL),
2232 + "Operation not possible due to RF-kill");
2233 + TEST_COMPARE_STRING (strerrorname_np (ERFKILL), "ERFKILL");
2236 + TEST_COMPARE_STRING (strerrordesc_np (EHWPOISON),
2237 + "Memory page has hardware error");
2238 + TEST_COMPARE_STRING (strerrorname_np (EHWPOISON), "EHWPOISON");
2241 + TEST_COMPARE_STRING (strerrordesc_np (EBADRPC), "RPC struct is bad");
2242 + TEST_COMPARE_STRING (strerrorname_np (EBADRPC), "EBADRPC");
2245 + TEST_COMPARE_STRING (strerrordesc_np (EFTYPE),
2246 + "Inappropriate file type or format");
2247 + TEST_COMPARE_STRING (strerrorname_np (EFTYPE), "EFTYPE");
2249 +#ifdef EPROCUNAVAIL
2250 + TEST_COMPARE_STRING (strerrordesc_np (EPROCUNAVAIL),
2251 + "RPC bad procedure for program");
2252 + TEST_COMPARE_STRING (strerrorname_np (EPROCUNAVAIL), "EPROCUNAVAIL");
2255 + TEST_COMPARE_STRING (strerrordesc_np (EAUTH), "Authentication error");
2256 + TEST_COMPARE_STRING (strerrorname_np (EAUTH), "EAUTH");
2259 + TEST_COMPARE_STRING (strerrordesc_np (EDIED), "Translator died");
2260 + TEST_COMPARE_STRING (strerrorname_np (EDIED), "EDIED");
2262 +#ifdef ERPCMISMATCH
2263 + TEST_COMPARE_STRING (strerrordesc_np (ERPCMISMATCH), "RPC version wrong");
2264 + TEST_COMPARE_STRING (strerrorname_np (ERPCMISMATCH), "ERPCMISMATCH");
2267 + TEST_COMPARE_STRING (strerrordesc_np (EGREGIOUS),
2268 + "You really blew it this time");
2269 + TEST_COMPARE_STRING (strerrorname_np (EGREGIOUS), "EGREGIOUS");
2272 + TEST_COMPARE_STRING (strerrordesc_np (EPROCLIM), "Too many processes");
2273 + TEST_COMPARE_STRING (strerrorname_np (EPROCLIM), "EPROCLIM");
2276 + TEST_COMPARE_STRING (strerrordesc_np (EGRATUITOUS), "Gratuitous error");
2277 + TEST_COMPARE_STRING (strerrorname_np (EGRATUITOUS), "EGRATUITOUS");
2279 +#if defined (ENOTSUP) && ENOTSUP != EOPNOTSUPP
2280 + TEST_COMPARE_STRING (strerrordesc_np (ENOTSUP), "Not supported");
2281 + TEST_COMPARE_STRING (strerrorname_np (ENOTSUP), "ENOTSUP");
2283 +#ifdef EPROGMISMATCH
2284 + TEST_COMPARE_STRING (strerrordesc_np (EPROGMISMATCH),
2285 + "RPC program version wrong");
2286 + TEST_COMPARE_STRING (strerrorname_np (EPROGMISMATCH), "EPROGMISMATCH");
2289 + TEST_COMPARE_STRING (strerrordesc_np (EBACKGROUND),
2290 + "Inappropriate operation for background process");
2291 + TEST_COMPARE_STRING (strerrorname_np (EBACKGROUND), "EBACKGROUND");
2294 + TEST_COMPARE_STRING (strerrordesc_np (EIEIO), "Computer bought the farm");
2295 + TEST_COMPARE_STRING (strerrorname_np (EIEIO), "EIEIO");
2297 +#if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
2298 + TEST_COMPARE_STRING (strerrordesc_np (EWOULDBLOCK),
2299 + "Operation would block");
2300 + TEST_COMPARE_STRING (strerrorname_np (EWOULDBLOCK), "EWOULDBLOCK");
2303 + TEST_COMPARE_STRING (strerrordesc_np (ENEEDAUTH), "Need authenticator");
2304 + TEST_COMPARE_STRING (strerrorname_np (ENEEDAUTH), "ENEEDAUTH");
2307 + TEST_COMPARE_STRING (strerrordesc_np (ED), "?");
2308 + TEST_COMPARE_STRING (strerrorname_np (ED), "ED");
2310 +#ifdef EPROGUNAVAIL
2311 + TEST_COMPARE_STRING (strerrordesc_np (EPROGUNAVAIL),
2312 + "RPC program not available");
2313 + TEST_COMPARE_STRING (strerrorname_np (EPROGUNAVAIL), "EPROGUNAVAIL");
2318 diff --git a/stdio-common/vfscanf-internal.c b/stdio-common/vfscanf-internal.c
2319 index 95b46dcbeb..3a323547f9 100644
2320 --- a/stdio-common/vfscanf-internal.c
2321 +++ b/stdio-common/vfscanf-internal.c
2322 @@ -277,7 +277,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
2326 - const CHAR_T *f = format;
2327 + const UCHAR_T *f = (const UCHAR_T *) format;
2328 UCHAR_T fc; /* Current character of the format. */
2329 WINT_T done = 0; /* Assignments done. */
2330 size_t read_in = 0; /* Chars read in. */
2331 @@ -415,10 +415,11 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
2334 #ifndef COMPILE_WSCANF
2335 - if (!isascii ((unsigned char) *f))
2336 + if (!isascii (*f))
2338 /* Non-ASCII, may be a multibyte. */
2339 - int len = __mbrlen (f, strlen (f), &state);
2340 + int len = __mbrlen ((const char *) f, strlen ((const char *) f),
2345 @@ -426,7 +427,7 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
2347 if (__glibc_unlikely (c == EOF))
2349 - else if (c != (unsigned char) *f++)
2350 + else if (c != *f++)
2352 ungetc_not_eof (c, s);
2354 @@ -484,9 +485,9 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
2355 char_buffer_rewind (&charbuf);
2357 /* Check for a positional parameter specification. */
2358 - if (ISDIGIT ((UCHAR_T) *f))
2361 - argpos = read_int ((const UCHAR_T **) &f);
2362 + argpos = read_int (&f);
2366 @@ -521,8 +522,8 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
2368 /* Find the maximum field width. */
2370 - if (ISDIGIT ((UCHAR_T) *f))
2371 - width = read_int ((const UCHAR_T **) &f);
2373 + width = read_int (&f);
2377 @@ -2522,12 +2523,11 @@ __vfscanf_internal (FILE *s, const char *format, va_list argptr,
2380 while ((fc = *f++) != '\0' && fc != ']')
2381 - if (fc == '-' && *f != '\0' && *f != ']'
2382 - && (unsigned char) f[-2] <= (unsigned char) *f)
2383 + if (fc == '-' && *f != '\0' && *f != ']' && f[-2] <= *f)
2385 /* Add all characters from the one before the '-'
2386 up to (but not including) the next format char. */
2387 - for (fc = (unsigned char) f[-2]; fc < (unsigned char) *f; ++fc)
2388 + for (fc = f[-2]; fc < *f; ++fc)
2389 ((char *)charbuf.scratch.data)[fc] = 1;
2392 diff --git a/string/bits/string_fortified.h b/string/bits/string_fortified.h
2393 index 309d0f39b2..c8d3051af8 100644
2394 --- a/string/bits/string_fortified.h
2395 +++ b/string/bits/string_fortified.h
2397 # error "Never use <bits/string_fortified.h> directly; include <string.h> instead."
2400 -#if !__GNUC_PREREQ (5,0)
2401 -__warndecl (__warn_memset_zero_len,
2402 - "memset used with constant zero length parameter; this could be due to transposed parameters");
2405 __fortify_function void *
2406 __NTH (memcpy (void *__restrict __dest, const void *__restrict __src,
2408 @@ -58,16 +53,6 @@ __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src,
2409 __fortify_function void *
2410 __NTH (memset (void *__dest, int __ch, size_t __len))
2412 - /* GCC-5.0 and newer implements these checks in the compiler, so we don't
2413 - need them here. */
2414 -#if !__GNUC_PREREQ (5,0)
2415 - if (__builtin_constant_p (__len) && __len == 0
2416 - && (!__builtin_constant_p (__ch) || __ch != 0))
2418 - __warn_memset_zero_len ();
2422 return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
2425 diff --git a/support/Makefile b/support/Makefile
2426 index 93faafddf9..4154863511 100644
2427 --- a/support/Makefile
2428 +++ b/support/Makefile
2429 @@ -35,6 +35,8 @@ libsupport-routines = \
2433 + resolv_response_context_duplicate \
2434 + resolv_response_context_free \
2436 set_fortify_handler \
2438 diff --git a/support/resolv_response_context_duplicate.c b/support/resolv_response_context_duplicate.c
2439 new file mode 100644
2440 index 0000000000..f9c5c3462a
2442 +++ b/support/resolv_response_context_duplicate.c
2444 +/* Duplicate a response context used in DNS resolver tests.
2445 + Copyright (C) 2020 Free Software Foundation, Inc.
2446 + This file is part of the GNU C Library.
2448 + The GNU C Library is free software; you can redistribute it and/or
2449 + modify it under the terms of the GNU Lesser General Public
2450 + License as published by the Free Software Foundation; either
2451 + version 2.1 of the License, or (at your option) any later version.
2453 + The GNU C Library is distributed in the hope that it will be useful,
2454 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2455 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2456 + Lesser General Public License for more details.
2458 + You should have received a copy of the GNU Lesser General Public
2459 + License along with the GNU C Library; if not, see
2460 + <https://www.gnu.org/licenses/>. */
2462 +#include <string.h>
2463 +#include <support/resolv_test.h>
2464 +#include <support/support.h>
2466 +struct resolv_response_context *
2467 +resolv_response_context_duplicate (const struct resolv_response_context *ctx)
2469 + struct resolv_response_context *result = xmalloc (sizeof (*result));
2470 + memcpy (result, ctx, sizeof (*result));
2471 + if (result->client_address != NULL)
2473 + result->client_address = xmalloc (result->client_address_length);
2474 + memcpy (result->client_address, ctx->client_address,
2475 + result->client_address_length);
2477 + result->query_buffer = xmalloc (result->query_length);
2478 + memcpy (result->query_buffer, ctx->query_buffer, result->query_length);
2481 diff --git a/support/resolv_response_context_free.c b/support/resolv_response_context_free.c
2482 new file mode 100644
2483 index 0000000000..b88c05ffd4
2485 +++ b/support/resolv_response_context_free.c
2487 +/* Free a response context used in DNS resolver tests.
2488 + Copyright (C) 2020 Free Software Foundation, Inc.
2489 + This file is part of the GNU C Library.
2491 + The GNU C Library is free software; you can redistribute it and/or
2492 + modify it under the terms of the GNU Lesser General Public
2493 + License as published by the Free Software Foundation; either
2494 + version 2.1 of the License, or (at your option) any later version.
2496 + The GNU C Library is distributed in the hope that it will be useful,
2497 + but WITHOUT ANY WARRANTY; without even the implied warranty of
2498 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2499 + Lesser General Public License for more details.
2501 + You should have received a copy of the GNU Lesser General Public
2502 + License along with the GNU C Library; if not, see
2503 + <https://www.gnu.org/licenses/>. */
2505 +#include <stdlib.h>
2506 +#include <support/resolv_test.h>
2509 +resolv_response_context_free (struct resolv_response_context *ctx)
2511 + free (ctx->query_buffer);
2512 + free (ctx->client_address);
2515 diff --git a/support/resolv_test.c b/support/resolv_test.c
2516 index 53b7fc41ab..9878a040a3 100644
2517 --- a/support/resolv_test.c
2518 +++ b/support/resolv_test.c
2519 @@ -181,7 +181,9 @@ resolv_response_init (struct resolv_response_builder *b,
2520 b->buffer[2] |= b->query_buffer[2] & 0x01; /* Copy the RD bit. */
2522 b->buffer[2] |= 0x02;
2523 - b->buffer[3] = 0x80 | flags.rcode; /* Always set RA. */
2524 + b->buffer[3] = flags.rcode;
2525 + if (!flags.clear_ra)
2526 + b->buffer[3] |= 0x80;
2528 b->buffer[3] |= 0x20;
2530 @@ -434,9 +436,9 @@ resolv_response_buffer (const struct resolv_response_builder *b)
2534 -static struct resolv_response_builder *
2535 -response_builder_allocate
2536 - (const unsigned char *query_buffer, size_t query_length)
2537 +struct resolv_response_builder *
2538 +resolv_response_builder_allocate (const unsigned char *query_buffer,
2539 + size_t query_length)
2541 struct resolv_response_builder *b = xmalloc (sizeof (*b));
2542 memset (b, 0, offsetof (struct resolv_response_builder, buffer));
2543 @@ -445,8 +447,8 @@ response_builder_allocate
2548 -response_builder_free (struct resolv_response_builder *b)
2550 +resolv_response_builder_free (struct resolv_response_builder *b)
2552 tdestroy (b->compression_offsets, free);
2554 @@ -661,13 +663,17 @@ server_thread_udp_process_one (struct resolv_test *obj, int server_index)
2556 struct resolv_response_context ctx =
2559 + .client_address = &peer,
2560 + .client_address_length = peerlen,
2561 .query_buffer = query,
2562 .query_length = length,
2563 .server_index = server_index,
2567 - struct resolv_response_builder *b = response_builder_allocate (query, length);
2568 + struct resolv_response_builder *b
2569 + = resolv_response_builder_allocate (query, length);
2570 obj->config.response_callback
2571 (&ctx, b, qinfo.qname, qinfo.qclass, qinfo.qtype);
2573 @@ -684,7 +690,7 @@ server_thread_udp_process_one (struct resolv_test *obj, int server_index)
2574 if (b->offset >= 12)
2575 printf ("info: UDP server %d: sending response:"
2576 " %zu bytes, RCODE %d (for %s/%u/%u)\n",
2577 - server_index, b->offset, b->buffer[3] & 0x0f,
2578 + ctx.server_index, b->offset, b->buffer[3] & 0x0f,
2579 qinfo.qname, qinfo.qclass, qinfo.qtype);
2581 printf ("info: UDP server %d: sending response: %zu bytes"
2582 @@ -694,23 +700,31 @@ server_thread_udp_process_one (struct resolv_test *obj, int server_index)
2583 if (b->truncate_bytes > 0)
2584 printf ("info: truncated by %u bytes\n", b->truncate_bytes);
2586 - size_t to_send = b->offset;
2587 - if (to_send < b->truncate_bytes)
2590 - to_send -= b->truncate_bytes;
2592 - /* Ignore most errors here because the other end may have closed
2594 - if (sendto (obj->servers[server_index].socket_udp,
2595 - b->buffer, to_send, 0,
2596 - (struct sockaddr *) &peer, peerlen) < 0)
2597 - TEST_VERIFY_EXIT (errno != EBADF);
2598 + resolv_response_send_udp (&ctx, b);
2600 - response_builder_free (b);
2601 + resolv_response_builder_free (b);
2606 +resolv_response_send_udp (const struct resolv_response_context *ctx,
2607 + struct resolv_response_builder *b)
2609 + TEST_VERIFY_EXIT (!ctx->tcp);
2610 + size_t to_send = b->offset;
2611 + if (to_send < b->truncate_bytes)
2614 + to_send -= b->truncate_bytes;
2616 + /* Ignore most errors here because the other end may have closed
2618 + if (sendto (ctx->test->servers[ctx->server_index].socket_udp,
2619 + b->buffer, to_send, 0,
2620 + ctx->client_address, ctx->client_address_length) < 0)
2621 + TEST_VERIFY_EXIT (errno != EBADF);
2624 /* UDP thread_callback function. Variant for one thread per
2627 @@ -897,14 +911,15 @@ server_thread_tcp_client (void *arg)
2629 struct resolv_response_context ctx =
2631 + .test = closure->obj,
2632 .query_buffer = query_buffer,
2633 .query_length = query_length,
2634 .server_index = closure->server_index,
2638 - struct resolv_response_builder *b = response_builder_allocate
2639 - (query_buffer, query_length);
2640 + struct resolv_response_builder *b
2641 + = resolv_response_builder_allocate (query_buffer, query_length);
2642 closure->obj->config.response_callback
2643 (&ctx, b, qinfo.qname, qinfo.qclass, qinfo.qtype);
2645 @@ -936,7 +951,7 @@ server_thread_tcp_client (void *arg)
2646 writev_fully (closure->client_socket, buffers, 2);
2648 bool close_flag = b->close;
2649 - response_builder_free (b);
2650 + resolv_response_builder_free (b);
2651 free (query_buffer);
2654 diff --git a/support/resolv_test.h b/support/resolv_test.h
2655 index 67819469a0..31a5c1c3e7 100644
2656 --- a/support/resolv_test.h
2657 +++ b/support/resolv_test.h
2658 @@ -35,25 +35,36 @@ struct resolv_edns_info
2659 uint16_t payload_size;
2662 +/* This opaque struct collects information about the resolver testing
2663 + currently in progress. */
2664 +struct resolv_test;
2666 /* This struct provides context information when the response callback
2667 specified in struct resolv_redirect_config is invoked. */
2668 struct resolv_response_context
2670 - const unsigned char *query_buffer;
2671 + struct resolv_test *test;
2672 + void *client_address;
2673 + size_t client_address_length;
2674 + unsigned char *query_buffer;
2675 size_t query_length;
2678 struct resolv_edns_info edns;
2681 +/* Produces a deep copy of the context. */
2682 +struct resolv_response_context *
2683 + resolv_response_context_duplicate (const struct resolv_response_context *);
2685 +/* Frees the copy. For the context passed to the response function,
2686 + this happens implicitly. */
2687 +void resolv_response_context_free (struct resolv_response_context *);
2689 /* This opaque struct is used to construct responses from within the
2690 response callback function. */
2691 struct resolv_response_builder;
2693 -/* This opaque struct collects information about the resolver testing
2694 - currently in progress. */
2695 -struct resolv_test;
2699 /* Maximum number of test servers supported by the framework. */
2700 @@ -137,6 +148,10 @@ struct resolv_response_flags
2701 /* If true, the AD (authenticated data) flag will be set. */
2704 + /* If true, do not set the RA (recursion available) flag in the
2708 /* Initial section count values. Can be used to artificially
2709 increase the counts, for malformed packet testing.*/
2710 unsigned short qdcount;
2711 @@ -188,6 +203,22 @@ void resolv_response_close (struct resolv_response_builder *);
2712 /* The size of the response packet built so far. */
2713 size_t resolv_response_length (const struct resolv_response_builder *);
2715 +/* Allocates a response builder tied to a specific query packet,
2716 + starting at QUERY_BUFFER, containing QUERY_LENGTH bytes. */
2717 +struct resolv_response_builder *
2718 + resolv_response_builder_allocate (const unsigned char *query_buffer,
2719 + size_t query_length);
2721 +/* Deallocates a response buffer. */
2722 +void resolv_response_builder_free (struct resolv_response_builder *);
2724 +/* Sends a UDP response using a specific context. This can be used to
2725 + reorder or duplicate responses, along with
2726 + resolv_response_context_duplicate and
2727 + response_builder_allocate. */
2728 +void resolv_response_send_udp (const struct resolv_response_context *,
2729 + struct resolv_response_builder *);
2733 #endif /* SUPPORT_RESOLV_TEST_H */
2734 diff --git a/sysdeps/aarch64/dl-bti.c b/sysdeps/aarch64/dl-bti.c
2735 index 196e462520..cf7624aaa2 100644
2736 --- a/sysdeps/aarch64/dl-bti.c
2737 +++ b/sysdeps/aarch64/dl-bti.c
2740 #include <libintl.h>
2741 #include <ldsodefs.h>
2742 +#include <sys/mman.h>
2745 -enable_bti (struct link_map *map, const char *program)
2746 +/* See elf/dl-load.h. */
2748 +# define MAP_COPY (MAP_PRIVATE | MAP_DENYWRITE)
2751 +/* Enable BTI protection for MAP. */
2754 +_dl_bti_protect (struct link_map *map, int fd)
2756 + const size_t pagesz = GLRO(dl_pagesize);
2757 const ElfW(Phdr) *phdr;
2760 for (phdr = map->l_phdr; phdr < &map->l_phdr[map->l_phnum]; ++phdr)
2761 if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X))
2763 - void *start = (void *) (phdr->p_vaddr + map->l_addr);
2764 - size_t len = phdr->p_memsz;
2765 + size_t vstart = ALIGN_DOWN (phdr->p_vaddr, pagesz);
2766 + size_t vend = ALIGN_UP (phdr->p_vaddr + phdr->p_filesz, pagesz);
2767 + off_t off = ALIGN_DOWN (phdr->p_offset, pagesz);
2768 + void *start = (void *) (vstart + map->l_addr);
2769 + size_t len = vend - vstart;
2771 - prot = PROT_EXEC | PROT_BTI;
2772 + unsigned prot = PROT_EXEC | PROT_BTI;
2773 if (phdr->p_flags & PF_R)
2775 if (phdr->p_flags & PF_W)
2778 - if (__mprotect (start, len, prot) < 0)
2781 - _dl_fatal_printf ("%s: mprotect failed to turn on BTI\n",
2784 - _dl_signal_error (errno, map->l_name, "dlopen",
2785 - N_("mprotect failed to turn on BTI"));
2788 + /* Ignore failures for kernel mapped binaries. */
2789 + __mprotect (start, len, prot);
2791 + map->l_mach.bti_fail = __mmap (start, len, prot,
2792 + MAP_FIXED|MAP_COPY|MAP_FILE,
2793 + fd, off) == MAP_FAILED;
2798 -/* Enable BTI for L if required. */
2801 +bti_failed (struct link_map *l, const char *program)
2804 + _dl_fatal_printf ("%s: %s: failed to turn on BTI protection\n",
2805 + program, l->l_name);
2807 + /* Note: the errno value is not available any more. */
2808 + _dl_signal_error (0, l->l_name, "dlopen",
2809 + N_("failed to turn on BTI protection"));
2813 +/* Enable BTI for L and its dependencies. */
2816 _dl_bti_check (struct link_map *l, const char *program)
2818 - if (GLRO(dl_aarch64_cpu_features).bti && l->l_mach.bti)
2819 - enable_bti (l, program);
2820 + if (!GLRO(dl_aarch64_cpu_features).bti)
2823 + if (l->l_mach.bti_fail)
2824 + bti_failed (l, program);
2826 + unsigned int i = l->l_searchlist.r_nlist;
2829 + struct link_map *dep = l->l_initfini[i];
2830 + if (dep->l_mach.bti_fail)
2831 + bti_failed (dep, program);
2834 diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
2835 index 70b9ed3925..fde7cfd9e2 100644
2836 --- a/sysdeps/aarch64/dl-machine.h
2837 +++ b/sysdeps/aarch64/dl-machine.h
2838 @@ -395,13 +395,6 @@ elf_machine_lazy_rel (struct link_map *map,
2839 /* Check for unexpected PLT reloc type. */
2840 if (__builtin_expect (r_type == AARCH64_R(JUMP_SLOT), 1))
2842 - if (map->l_mach.plt == 0)
2845 - *reloc_addr += l_addr;
2849 if (__glibc_unlikely (map->l_info[DT_AARCH64 (VARIANT_PCS)] != NULL))
2851 /* Check the symbol table for variant PCS symbols. */
2852 @@ -425,7 +418,10 @@ elf_machine_lazy_rel (struct link_map *map,
2856 - *reloc_addr = map->l_mach.plt;
2857 + if (map->l_mach.plt == 0)
2858 + *reloc_addr += l_addr;
2860 + *reloc_addr = map->l_mach.plt;
2862 else if (__builtin_expect (r_type == AARCH64_R(TLSDESC), 1))
2864 diff --git a/sysdeps/aarch64/dl-prop.h b/sysdeps/aarch64/dl-prop.h
2865 index b0785bda83..e926e54984 100644
2866 --- a/sysdeps/aarch64/dl-prop.h
2867 +++ b/sysdeps/aarch64/dl-prop.h
2872 +extern void _dl_bti_protect (struct link_map *, int) attribute_hidden;
2874 extern void _dl_bti_check (struct link_map *, const char *)
2877 @@ -35,14 +37,18 @@ _dl_open_check (struct link_map *m)
2880 static inline void __attribute__ ((always_inline))
2881 -_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph)
2882 +_dl_process_pt_note (struct link_map *l, int fd, const ElfW(Phdr) *ph)
2887 -_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz,
2889 +_dl_process_gnu_property (struct link_map *l, int fd, uint32_t type,
2890 + uint32_t datasz, void *data)
2892 + if (!GLRO(dl_aarch64_cpu_features).bti)
2893 + /* Skip note processing. */
2896 if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND)
2898 /* Stop if the property note is ill-formed. */
2899 @@ -51,7 +57,7 @@ _dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz,
2901 unsigned int feature_1 = *(unsigned int *) data;
2902 if (feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)
2903 - l->l_mach.bti = true;
2904 + _dl_bti_protect (l, fd);
2906 /* Stop if we processed the property note. */
2908 diff --git a/sysdeps/aarch64/linkmap.h b/sysdeps/aarch64/linkmap.h
2909 index 847a03ace2..b3f7663b07 100644
2910 --- a/sysdeps/aarch64/linkmap.h
2911 +++ b/sysdeps/aarch64/linkmap.h
2912 @@ -22,5 +22,5 @@ struct link_map_machine
2914 ElfW(Addr) plt; /* Address of .plt */
2915 void *tlsdesc_table; /* Address of TLS descriptor hash table. */
2916 - bool bti; /* Branch Target Identification is enabled. */
2917 + bool bti_fail; /* Failed to enable Branch Target Identification. */
2919 diff --git a/sysdeps/aarch64/multiarch/memcpy.c b/sysdeps/aarch64/multiarch/memcpy.c
2920 index 7cf5f033e8..799d60c98c 100644
2921 --- a/sysdeps/aarch64/multiarch/memcpy.c
2922 +++ b/sysdeps/aarch64/multiarch/memcpy.c
2923 @@ -41,7 +41,8 @@ libc_ifunc (__libc_memcpy,
2925 : (IS_THUNDERX2 (midr) || IS_THUNDERX2PA (midr)
2926 ? __memcpy_thunderx2
2927 - : (IS_NEOVERSE_N1 (midr)
2928 + : (IS_NEOVERSE_N1 (midr) || IS_NEOVERSE_N2 (midr)
2929 + || IS_NEOVERSE_V1 (midr)
2931 : __memcpy_generic)))));
2933 diff --git a/sysdeps/aarch64/multiarch/memcpy_advsimd.S b/sysdeps/aarch64/multiarch/memcpy_advsimd.S
2934 index d4ba747777..48bb6d7ca4 100644
2935 --- a/sysdeps/aarch64/multiarch/memcpy_advsimd.S
2936 +++ b/sysdeps/aarch64/multiarch/memcpy_advsimd.S
2937 @@ -223,12 +223,13 @@ L(copy_long_backwards):
2938 b.ls L(copy64_from_start)
2940 L(loop64_backwards):
2941 - stp A_q, B_q, [dstend, -32]
2942 + str B_q, [dstend, -16]
2943 + str A_q, [dstend, -32]
2944 ldp A_q, B_q, [srcend, -96]
2945 - stp C_q, D_q, [dstend, -64]
2946 + str D_q, [dstend, -48]
2947 + str C_q, [dstend, -64]!
2948 ldp C_q, D_q, [srcend, -128]
2949 sub srcend, srcend, 64
2950 - sub dstend, dstend, 64
2951 subs count, count, 64
2952 b.hi L(loop64_backwards)
2954 diff --git a/sysdeps/aarch64/multiarch/memmove.c b/sysdeps/aarch64/multiarch/memmove.c
2955 index ad10aa8ac6..46a4cb3a54 100644
2956 --- a/sysdeps/aarch64/multiarch/memmove.c
2957 +++ b/sysdeps/aarch64/multiarch/memmove.c
2958 @@ -41,7 +41,8 @@ libc_ifunc (__libc_memmove,
2960 : (IS_THUNDERX2 (midr) || IS_THUNDERX2PA (midr)
2961 ? __memmove_thunderx2
2962 - : (IS_NEOVERSE_N1 (midr)
2963 + : (IS_NEOVERSE_N1 (midr) || IS_NEOVERSE_N2 (midr)
2964 + || IS_NEOVERSE_V1 (midr)
2966 : __memmove_generic)))));
2968 diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S
2969 index 75393e1c18..1998ea95d4 100644
2970 --- a/sysdeps/aarch64/start.S
2971 +++ b/sysdeps/aarch64/start.S
2977 - .type _start,#function
2981 /* Create an initial frame with 0 LR and FP */
2982 + cfi_undefined (x30)
2986 @@ -101,8 +99,10 @@ _start:
2987 because crt1.o and rcrt1.o share code and the later must avoid the
2988 use of GOT relocations before __libc_start_main is called. */
2995 /* Define a symbol for the first piece of initialized data. */
2997 diff --git a/sysdeps/generic/dl-prop.h b/sysdeps/generic/dl-prop.h
2998 index f1cf576fe3..df27ff8e6a 100644
2999 --- a/sysdeps/generic/dl-prop.h
3000 +++ b/sysdeps/generic/dl-prop.h
3001 @@ -37,15 +37,15 @@ _dl_open_check (struct link_map *m)
3004 static inline void __attribute__ ((always_inline))
3005 -_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph)
3006 +_dl_process_pt_note (struct link_map *l, int fd, const ElfW(Phdr) *ph)
3010 /* Called for each property in the NT_GNU_PROPERTY_TYPE_0 note of L,
3011 processing of the properties continues until this returns 0. */
3012 static inline int __attribute__ ((always_inline))
3013 -_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz,
3015 +_dl_process_gnu_property (struct link_map *l, int fd, uint32_t type,
3016 + uint32_t datasz, void *data)
3020 diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h
3021 index ba114ab4b1..62ac40d81b 100644
3022 --- a/sysdeps/generic/ldsodefs.h
3023 +++ b/sysdeps/generic/ldsodefs.h
3024 @@ -919,8 +919,9 @@ extern void _dl_rtld_di_serinfo (struct link_map *loader,
3025 Dl_serinfo *si, bool counting);
3027 /* Process PT_GNU_PROPERTY program header PH in module L after
3028 - PT_LOAD segments are mapped. */
3029 -void _dl_process_pt_gnu_property (struct link_map *l, const ElfW(Phdr) *ph);
3030 + PT_LOAD segments are mapped from file FD. */
3031 +void _dl_process_pt_gnu_property (struct link_map *l, int fd,
3032 + const ElfW(Phdr) *ph);
3035 /* Search loaded objects' symbol tables for a definition of the symbol
3036 diff --git a/sysdeps/generic/unwind.h b/sysdeps/generic/unwind.h
3037 index b667a5b652..c229603af3 100644
3038 --- a/sysdeps/generic/unwind.h
3039 +++ b/sysdeps/generic/unwind.h
3040 @@ -75,15 +75,21 @@ typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code,
3042 struct _Unwind_Exception
3044 - _Unwind_Exception_Class exception_class;
3045 - _Unwind_Exception_Cleanup_Fn exception_cleanup;
3046 - _Unwind_Word private_1;
3047 - _Unwind_Word private_2;
3049 - /* @@@ The IA-64 ABI says that this structure must be double-word aligned.
3050 - Taking that literally does not make much sense generically. Instead we
3051 - provide the maximum alignment required by any type for the machine. */
3052 -} __attribute__((__aligned__));
3057 + _Unwind_Exception_Class exception_class;
3058 + _Unwind_Exception_Cleanup_Fn exception_cleanup;
3059 + _Unwind_Word private_1;
3060 + _Unwind_Word private_2;
3063 + /* The IA-64 ABI says that this structure must be double-word aligned. */
3064 + _Unwind_Word unwind_exception_align[2]
3065 + __attribute__ ((__aligned__ (2 * sizeof (_Unwind_Word))));
3070 /* The ACTIONS argument to the personality routine is a bitwise OR of one
3071 diff --git a/sysdeps/gnu/errlist.h b/sysdeps/gnu/errlist.h
3072 index 5d11ed723d..6329e5f393 100644
3073 --- a/sysdeps/gnu/errlist.h
3074 +++ b/sysdeps/gnu/errlist.h
3077 -#define ERR_MAP(value) value
3079 -_S(ERR_MAP(0), N_("Success"))
3080 +_S(0, N_("Success"))
3083 TRANS Only the owner of the file (or other resource)
3084 TRANS or processes with special privileges can perform the operation. */
3085 -_S(ERR_MAP(EPERM), N_("Operation not permitted"))
3086 +_S(EPERM, N_("Operation not permitted"))
3090 TRANS This is a ``file doesn't exist'' error
3091 TRANS for ordinary files that are referenced in contexts where they are
3092 TRANS expected to already exist. */
3093 -_S(ERR_MAP(ENOENT), N_("No such file or directory"))
3094 +_S(ENOENT, N_("No such file or directory"))
3098 TRANS No process matches the specified process ID. */
3099 -_S(ERR_MAP(ESRCH), N_("No such process"))
3100 +_S(ESRCH, N_("No such process"))
3104 @@ -29,12 +26,12 @@ TRANS
3105 TRANS You can choose to have functions resume after a signal that is handled,
3106 TRANS rather than failing with @code{EINTR}; see @ref{Interrupted
3107 TRANS Primitives}. */
3108 -_S(ERR_MAP(EINTR), N_("Interrupted system call"))
3109 +_S(EINTR, N_("Interrupted system call"))
3113 TRANS Usually used for physical read or write errors. */
3114 -_S(ERR_MAP(EIO), N_("Input/output error"))
3115 +_S(EIO, N_("Input/output error"))
3119 @@ -43,7 +40,7 @@ TRANS represented by a file you specified, and it couldn't find the device.
3120 TRANS This can mean that the device file was installed incorrectly, or that
3121 TRANS the physical device is missing or not correctly attached to the
3123 -_S(ERR_MAP(ENXIO), N_("No such device or address"))
3124 +_S(ENXIO, N_("No such device or address"))
3128 @@ -51,27 +48,27 @@ TRANS Used when the arguments passed to a new program
3129 TRANS being executed with one of the @code{exec} functions (@pxref{Executing a
3130 TRANS File}) occupy too much memory space. This condition never arises on
3131 TRANS @gnuhurdsystems{}. */
3132 -_S(ERR_MAP(E2BIG), N_("Argument list too long"))
3133 +_S(E2BIG, N_("Argument list too long"))
3137 TRANS Invalid executable file format. This condition is detected by the
3138 TRANS @code{exec} functions; see @ref{Executing a File}. */
3139 -_S(ERR_MAP(ENOEXEC), N_("Exec format error"))
3140 +_S(ENOEXEC, N_("Exec format error"))
3144 TRANS For example, I/O on a descriptor that has been
3145 TRANS closed or reading from a descriptor open only for writing (or vice
3147 -_S(ERR_MAP(EBADF), N_("Bad file descriptor"))
3148 +_S(EBADF, N_("Bad file descriptor"))
3152 TRANS This error happens on operations that are
3153 TRANS supposed to manipulate child processes, when there aren't any processes
3154 TRANS to manipulate. */
3155 -_S(ERR_MAP(ECHILD), N_("No child processes"))
3156 +_S(ECHILD, N_("No child processes"))
3160 @@ -79,74 +76,74 @@ TRANS Allocating a system resource would have resulted in a
3161 TRANS deadlock situation. The system does not guarantee that it will notice
3162 TRANS all such situations. This error means you got lucky and the system
3163 TRANS noticed; it might just hang. @xref{File Locks}, for an example. */
3164 -_S(ERR_MAP(EDEADLK), N_("Resource deadlock avoided"))
3165 +_S(EDEADLK, N_("Resource deadlock avoided"))
3169 TRANS The system cannot allocate more virtual memory
3170 TRANS because its capacity is full. */
3171 -_S(ERR_MAP(ENOMEM), N_("Cannot allocate memory"))
3172 +_S(ENOMEM, N_("Cannot allocate memory"))
3176 TRANS The file permissions do not allow the attempted operation. */
3177 -_S(ERR_MAP(EACCES), N_("Permission denied"))
3178 +_S(EACCES, N_("Permission denied"))
3182 TRANS An invalid pointer was detected.
3183 TRANS On @gnuhurdsystems{}, this error never happens; you get a signal instead. */
3184 -_S(ERR_MAP(EFAULT), N_("Bad address"))
3185 +_S(EFAULT, N_("Bad address"))
3189 TRANS A file that isn't a block special file was given in a situation that
3190 TRANS requires one. For example, trying to mount an ordinary file as a file
3191 TRANS system in Unix gives this error. */
3192 -_S(ERR_MAP(ENOTBLK), N_("Block device required"))
3193 +_S(ENOTBLK, N_("Block device required"))
3197 TRANS A system resource that can't be shared is already in use.
3198 TRANS For example, if you try to delete a file that is the root of a currently
3199 TRANS mounted filesystem, you get this error. */
3200 -_S(ERR_MAP(EBUSY), N_("Device or resource busy"))
3201 +_S(EBUSY, N_("Device or resource busy"))
3205 TRANS An existing file was specified in a context where it only
3206 TRANS makes sense to specify a new file. */
3207 -_S(ERR_MAP(EEXIST), N_("File exists"))
3208 +_S(EEXIST, N_("File exists"))
3212 TRANS An attempt to make an improper link across file systems was detected.
3213 TRANS This happens not only when you use @code{link} (@pxref{Hard Links}) but
3214 TRANS also when you rename a file with @code{rename} (@pxref{Renaming Files}). */
3215 -_S(ERR_MAP(EXDEV), N_("Invalid cross-device link"))
3216 +_S(EXDEV, N_("Invalid cross-device link"))
3220 TRANS The wrong type of device was given to a function that expects a
3221 TRANS particular sort of device. */
3222 -_S(ERR_MAP(ENODEV), N_("No such device"))
3223 +_S(ENODEV, N_("No such device"))
3227 TRANS A file that isn't a directory was specified when a directory is required. */
3228 -_S(ERR_MAP(ENOTDIR), N_("Not a directory"))
3229 +_S(ENOTDIR, N_("Not a directory"))
3233 TRANS You cannot open a directory for writing,
3234 TRANS or create or remove hard links to it. */
3235 -_S(ERR_MAP(EISDIR), N_("Is a directory"))
3236 +_S(EISDIR, N_("Is a directory"))
3240 TRANS This is used to indicate various kinds of problems
3241 TRANS with passing the wrong argument to a library function. */
3242 -_S(ERR_MAP(EINVAL), N_("Invalid argument"))
3243 +_S(EINVAL, N_("Invalid argument"))
3247 @@ -157,20 +154,20 @@ TRANS In BSD and GNU, the number of open files is controlled by a resource
3248 TRANS limit that can usually be increased. If you get this error, you might
3249 TRANS want to increase the @code{RLIMIT_NOFILE} limit or make it unlimited;
3250 TRANS @pxref{Limits on Resources}. */
3251 -_S(ERR_MAP(EMFILE), N_("Too many open files"))
3252 +_S(EMFILE, N_("Too many open files"))
3256 TRANS There are too many distinct file openings in the entire system. Note
3257 TRANS that any number of linked channels count as just one file opening; see
3258 TRANS @ref{Linked Channels}. This error never occurs on @gnuhurdsystems{}. */
3259 -_S(ERR_MAP(ENFILE), N_("Too many open files in system"))
3260 +_S(ENFILE, N_("Too many open files in system"))
3264 TRANS Inappropriate I/O control operation, such as trying to set terminal
3265 TRANS modes on an ordinary file. */
3266 -_S(ERR_MAP(ENOTTY), N_("Inappropriate ioctl for device"))
3267 +_S(ENOTTY, N_("Inappropriate ioctl for device"))
3271 @@ -179,35 +176,35 @@ TRANS write to a file that is currently being executed. Often using a
3272 TRANS debugger to run a program is considered having it open for writing and
3273 TRANS will cause this error. (The name stands for ``text file busy''.) This
3274 TRANS is not an error on @gnuhurdsystems{}; the text is copied as necessary. */
3275 -_S(ERR_MAP(ETXTBSY), N_("Text file busy"))
3276 +_S(ETXTBSY, N_("Text file busy"))
3280 TRANS The size of a file would be larger than allowed by the system. */
3281 -_S(ERR_MAP(EFBIG), N_("File too large"))
3282 +_S(EFBIG, N_("File too large"))
3286 TRANS Write operation on a file failed because the
3287 TRANS disk is full. */
3288 -_S(ERR_MAP(ENOSPC), N_("No space left on device"))
3289 +_S(ENOSPC, N_("No space left on device"))
3293 TRANS Invalid seek operation (such as on a pipe). */
3294 -_S(ERR_MAP(ESPIPE), N_("Illegal seek"))
3295 +_S(ESPIPE, N_("Illegal seek"))
3299 TRANS An attempt was made to modify something on a read-only file system. */
3300 -_S(ERR_MAP(EROFS), N_("Read-only file system"))
3301 +_S(EROFS, N_("Read-only file system"))
3305 TRANS The link count of a single file would become too large.
3306 TRANS @code{rename} can cause this error if the file being renamed already has
3307 TRANS as many links as it can take (@pxref{Renaming Files}). */
3308 -_S(ERR_MAP(EMLINK), N_("Too many links"))
3309 +_S(EMLINK, N_("Too many links"))
3313 @@ -216,19 +213,19 @@ TRANS Every library function that returns this error code also generates a
3314 TRANS @code{SIGPIPE} signal; this signal terminates the program if not handled
3315 TRANS or blocked. Thus, your program will never actually see @code{EPIPE}
3316 TRANS unless it has handled or blocked @code{SIGPIPE}. */
3317 -_S(ERR_MAP(EPIPE), N_("Broken pipe"))
3318 +_S(EPIPE, N_("Broken pipe"))
3322 TRANS Used by mathematical functions when an argument value does
3323 TRANS not fall into the domain over which the function is defined. */
3324 -_S(ERR_MAP(EDOM), N_("Numerical argument out of domain"))
3325 +_S(EDOM, N_("Numerical argument out of domain"))
3329 TRANS Used by mathematical functions when the result value is
3330 TRANS not representable because of overflow or underflow. */
3331 -_S(ERR_MAP(ERANGE), N_("Numerical result out of range"))
3332 +_S(ERANGE, N_("Numerical result out of range"))
3336 @@ -261,7 +258,7 @@ TRANS Such shortages are usually fairly serious and affect the whole system,
3337 TRANS so usually an interactive program should report the error to the user
3338 TRANS and return to its command loop.
3339 TRANS @end itemize */
3340 -_S(ERR_MAP(EAGAIN), N_("Resource temporarily unavailable"))
3341 +_S(EAGAIN, N_("Resource temporarily unavailable"))
3345 @@ -273,47 +270,47 @@ TRANS the operation has begun and will take some time. Attempts to manipulate
3346 TRANS the object before the call completes return @code{EALREADY}. You can
3347 TRANS use the @code{select} function to find out when the pending operation
3348 TRANS has completed; @pxref{Waiting for I/O}. */
3349 -_S(ERR_MAP(EINPROGRESS), N_("Operation now in progress"))
3350 +_S(EINPROGRESS, N_("Operation now in progress"))
3354 TRANS An operation is already in progress on an object that has non-blocking
3355 TRANS mode selected. */
3356 -_S(ERR_MAP(EALREADY), N_("Operation already in progress"))
3357 +_S(EALREADY, N_("Operation already in progress"))
3361 TRANS A file that isn't a socket was specified when a socket is required. */
3362 -_S(ERR_MAP(ENOTSOCK), N_("Socket operation on non-socket"))
3363 +_S(ENOTSOCK, N_("Socket operation on non-socket"))
3367 TRANS The size of a message sent on a socket was larger than the supported
3368 TRANS maximum size. */
3369 -_S(ERR_MAP(EMSGSIZE), N_("Message too long"))
3370 +_S(EMSGSIZE, N_("Message too long"))
3374 TRANS The socket type does not support the requested communications protocol. */
3375 -_S(ERR_MAP(EPROTOTYPE), N_("Protocol wrong type for socket"))
3376 +_S(EPROTOTYPE, N_("Protocol wrong type for socket"))
3380 TRANS You specified a socket option that doesn't make sense for the
3381 TRANS particular protocol being used by the socket. @xref{Socket Options}. */
3382 -_S(ERR_MAP(ENOPROTOOPT), N_("Protocol not available"))
3383 +_S(ENOPROTOOPT, N_("Protocol not available"))
3385 #ifdef EPROTONOSUPPORT
3387 TRANS The socket domain does not support the requested communications protocol
3388 TRANS (perhaps because the requested protocol is completely invalid).
3389 TRANS @xref{Creating a Socket}. */
3390 -_S(ERR_MAP(EPROTONOSUPPORT), N_("Protocol not supported"))
3391 +_S(EPROTONOSUPPORT, N_("Protocol not supported"))
3393 #ifdef ESOCKTNOSUPPORT
3395 TRANS The socket type is not supported. */
3396 -_S(ERR_MAP(ESOCKTNOSUPPORT), N_("Socket type not supported"))
3397 +_S(ESOCKTNOSUPPORT, N_("Socket type not supported"))
3401 @@ -323,71 +320,71 @@ TRANS implemented for all communications protocols. On @gnuhurdsystems{}, this
3402 TRANS error can happen for many calls when the object does not support the
3403 TRANS particular operation; it is a generic indication that the server knows
3404 TRANS nothing to do for that call. */
3405 -_S(ERR_MAP(EOPNOTSUPP), N_("Operation not supported"))
3406 +_S(EOPNOTSUPP, N_("Operation not supported"))
3410 TRANS The socket communications protocol family you requested is not supported. */
3411 -_S(ERR_MAP(EPFNOSUPPORT), N_("Protocol family not supported"))
3412 +_S(EPFNOSUPPORT, N_("Protocol family not supported"))
3416 TRANS The address family specified for a socket is not supported; it is
3417 TRANS inconsistent with the protocol being used on the socket. @xref{Sockets}. */
3418 -_S(ERR_MAP(EAFNOSUPPORT), N_("Address family not supported by protocol"))
3419 +_S(EAFNOSUPPORT, N_("Address family not supported by protocol"))
3423 TRANS The requested socket address is already in use. @xref{Socket Addresses}. */
3424 -_S(ERR_MAP(EADDRINUSE), N_("Address already in use"))
3425 +_S(EADDRINUSE, N_("Address already in use"))
3427 #ifdef EADDRNOTAVAIL
3429 TRANS The requested socket address is not available; for example, you tried
3430 TRANS to give a socket a name that doesn't match the local host name.
3431 TRANS @xref{Socket Addresses}. */
3432 -_S(ERR_MAP(EADDRNOTAVAIL), N_("Cannot assign requested address"))
3433 +_S(EADDRNOTAVAIL, N_("Cannot assign requested address"))
3437 TRANS A socket operation failed because the network was down. */
3438 -_S(ERR_MAP(ENETDOWN), N_("Network is down"))
3439 +_S(ENETDOWN, N_("Network is down"))
3443 TRANS A socket operation failed because the subnet containing the remote host
3444 TRANS was unreachable. */
3445 -_S(ERR_MAP(ENETUNREACH), N_("Network is unreachable"))
3446 +_S(ENETUNREACH, N_("Network is unreachable"))
3450 TRANS A network connection was reset because the remote host crashed. */
3451 -_S(ERR_MAP(ENETRESET), N_("Network dropped connection on reset"))
3452 +_S(ENETRESET, N_("Network dropped connection on reset"))
3456 TRANS A network connection was aborted locally. */
3457 -_S(ERR_MAP(ECONNABORTED), N_("Software caused connection abort"))
3458 +_S(ECONNABORTED, N_("Software caused connection abort"))
3462 TRANS A network connection was closed for reasons outside the control of the
3463 TRANS local host, such as by the remote machine rebooting or an unrecoverable
3464 TRANS protocol violation. */
3465 -_S(ERR_MAP(ECONNRESET), N_("Connection reset by peer"))
3466 +_S(ECONNRESET, N_("Connection reset by peer"))
3470 TRANS The kernel's buffers for I/O operations are all in use. In GNU, this
3471 TRANS error is always synonymous with @code{ENOMEM}; you may get one or the
3472 TRANS other from network operations. */
3473 -_S(ERR_MAP(ENOBUFS), N_("No buffer space available"))
3474 +_S(ENOBUFS, N_("No buffer space available"))
3478 TRANS You tried to connect a socket that is already connected.
3479 TRANS @xref{Connecting}. */
3480 -_S(ERR_MAP(EISCONN), N_("Transport endpoint is already connected"))
3481 +_S(EISCONN, N_("Transport endpoint is already connected"))
3485 @@ -395,74 +392,74 @@ TRANS The socket is not connected to anything. You get this error when you
3486 TRANS try to transmit data over a socket, without first specifying a
3487 TRANS destination for the data. For a connectionless socket (for datagram
3488 TRANS protocols, such as UDP), you get @code{EDESTADDRREQ} instead. */
3489 -_S(ERR_MAP(ENOTCONN), N_("Transport endpoint is not connected"))
3490 +_S(ENOTCONN, N_("Transport endpoint is not connected"))
3494 TRANS No default destination address was set for the socket. You get this
3495 TRANS error when you try to transmit data over a connectionless socket,
3496 TRANS without first specifying a destination for the data with @code{connect}. */
3497 -_S(ERR_MAP(EDESTADDRREQ), N_("Destination address required"))
3498 +_S(EDESTADDRREQ, N_("Destination address required"))
3502 TRANS The socket has already been shut down. */
3503 -_S(ERR_MAP(ESHUTDOWN), N_("Cannot send after transport endpoint shutdown"))
3504 +_S(ESHUTDOWN, N_("Cannot send after transport endpoint shutdown"))
3507 -_S(ERR_MAP(ETOOMANYREFS), N_("Too many references: cannot splice"))
3508 +_S(ETOOMANYREFS, N_("Too many references: cannot splice"))
3512 TRANS A socket operation with a specified timeout received no response during
3513 TRANS the timeout period. */
3514 -_S(ERR_MAP(ETIMEDOUT), N_("Connection timed out"))
3515 +_S(ETIMEDOUT, N_("Connection timed out"))
3519 TRANS A remote host refused to allow the network connection (typically because
3520 TRANS it is not running the requested service). */
3521 -_S(ERR_MAP(ECONNREFUSED), N_("Connection refused"))
3522 +_S(ECONNREFUSED, N_("Connection refused"))
3526 TRANS Too many levels of symbolic links were encountered in looking up a file name.
3527 TRANS This often indicates a cycle of symbolic links. */
3528 -_S(ERR_MAP(ELOOP), N_("Too many levels of symbolic links"))
3529 +_S(ELOOP, N_("Too many levels of symbolic links"))
3533 TRANS Filename too long (longer than @code{PATH_MAX}; @pxref{Limits for
3534 TRANS Files}) or host name too long (in @code{gethostname} or
3535 TRANS @code{sethostname}; @pxref{Host Identification}). */
3536 -_S(ERR_MAP(ENAMETOOLONG), N_("File name too long"))
3537 +_S(ENAMETOOLONG, N_("File name too long"))
3541 TRANS The remote host for a requested network connection is down. */
3542 -_S(ERR_MAP(EHOSTDOWN), N_("Host is down"))
3543 +_S(EHOSTDOWN, N_("Host is down"))
3546 TRANS The remote host for a requested network connection is not reachable. */
3548 -_S(ERR_MAP(EHOSTUNREACH), N_("No route to host"))
3549 +_S(EHOSTUNREACH, N_("No route to host"))
3553 TRANS Directory not empty, where an empty directory was expected. Typically,
3554 TRANS this error occurs when you are trying to delete a directory. */
3555 -_S(ERR_MAP(ENOTEMPTY), N_("Directory not empty"))
3556 +_S(ENOTEMPTY, N_("Directory not empty"))
3560 TRANS The file quota system is confused because there are too many users.
3561 TRANS @c This can probably happen in a GNU system when using NFS. */
3562 -_S(ERR_MAP(EUSERS), N_("Too many users"))
3563 +_S(EUSERS, N_("Too many users"))
3567 TRANS The user's disk quota was exceeded. */
3568 -_S(ERR_MAP(EDQUOT), N_("Disk quota exceeded"))
3569 +_S(EDQUOT, N_("Disk quota exceeded"))
3573 @@ -471,7 +468,7 @@ TRANS file system which is due to file system rearrangements on the server host
3574 TRANS for NFS file systems or corruption in other file systems.
3575 TRANS Repairing this condition usually requires unmounting, possibly repairing
3576 TRANS and remounting the file system. */
3577 -_S(ERR_MAP(ESTALE), N_("Stale file handle"))
3578 +_S(ESTALE, N_("Stale file handle"))
3582 @@ -479,7 +476,7 @@ TRANS An attempt was made to NFS-mount a remote file system with a file name tha
3583 TRANS already specifies an NFS-mounted file.
3584 TRANS (This is an error on some operating systems, but we expect it to work
3585 TRANS properly on @gnuhurdsystems{}, making this error code impossible.) */
3586 -_S(ERR_MAP(EREMOTE), N_("Object is remote"))
3587 +_S(EREMOTE, N_("Object is remote"))
3591 @@ -487,7 +484,7 @@ TRANS This is used by the file locking facilities; see
3592 TRANS @ref{File Locks}. This error is never generated by @gnuhurdsystems{}, but
3593 TRANS it can result from an operation to an NFS server running another
3594 TRANS operating system. */
3595 -_S(ERR_MAP(ENOLCK), N_("No locks available"))
3596 +_S(ENOLCK, N_("No locks available"))
3600 @@ -496,46 +493,46 @@ TRANS not implemented at all, either in the C library itself or in the
3601 TRANS operating system. When you get this error, you can be sure that this
3602 TRANS particular function will always fail with @code{ENOSYS} unless you
3603 TRANS install a new version of the C library or the operating system. */
3604 -_S(ERR_MAP(ENOSYS), N_("Function not implemented"))
3605 +_S(ENOSYS, N_("Function not implemented"))
3609 TRANS While decoding a multibyte character the function came along an invalid
3610 TRANS or an incomplete sequence of bytes or the given wide character is invalid. */
3611 -_S(ERR_MAP(EILSEQ), N_("Invalid or incomplete multibyte or wide character"))
3612 +_S(EILSEQ, N_("Invalid or incomplete multibyte or wide character"))
3615 -_S(ERR_MAP(EBADMSG), N_("Bad message"))
3616 +_S(EBADMSG, N_("Bad message"))
3619 -_S(ERR_MAP(EIDRM), N_("Identifier removed"))
3620 +_S(EIDRM, N_("Identifier removed"))
3623 -_S(ERR_MAP(EMULTIHOP), N_("Multihop attempted"))
3624 +_S(EMULTIHOP, N_("Multihop attempted"))
3627 -_S(ERR_MAP(ENODATA), N_("No data available"))
3628 +_S(ENODATA, N_("No data available"))
3631 -_S(ERR_MAP(ENOLINK), N_("Link has been severed"))
3632 +_S(ENOLINK, N_("Link has been severed"))
3635 -_S(ERR_MAP(ENOMSG), N_("No message of desired type"))
3636 +_S(ENOMSG, N_("No message of desired type"))
3639 -_S(ERR_MAP(ENOSR), N_("Out of streams resources"))
3640 +_S(ENOSR, N_("Out of streams resources"))
3643 -_S(ERR_MAP(ENOSTR), N_("Device not a stream"))
3644 +_S(ENOSTR, N_("Device not a stream"))
3647 -_S(ERR_MAP(EOVERFLOW), N_("Value too large for defined data type"))
3648 +_S(EOVERFLOW, N_("Value too large for defined data type"))
3651 -_S(ERR_MAP(EPROTO), N_("Protocol error"))
3652 +_S(EPROTO, N_("Protocol error"))
3655 -_S(ERR_MAP(ETIME), N_("Timer expired"))
3656 +_S(ETIME, N_("Timer expired"))
3660 @@ -543,148 +540,148 @@ TRANS An asynchronous operation was canceled before it
3661 TRANS completed. @xref{Asynchronous I/O}. When you call @code{aio_cancel},
3662 TRANS the normal result is for the operations affected to complete with this
3663 TRANS error; @pxref{Cancel AIO Operations}. */
3664 -_S(ERR_MAP(ECANCELED), N_("Operation canceled"))
3665 +_S(ECANCELED, N_("Operation canceled"))
3668 -_S(ERR_MAP(EOWNERDEAD), N_("Owner died"))
3669 +_S(EOWNERDEAD, N_("Owner died"))
3671 #ifdef ENOTRECOVERABLE
3672 -_S(ERR_MAP(ENOTRECOVERABLE), N_("State not recoverable"))
3673 +_S(ENOTRECOVERABLE, N_("State not recoverable"))
3676 -_S(ERR_MAP(ERESTART), N_("Interrupted system call should be restarted"))
3677 +_S(ERESTART, N_("Interrupted system call should be restarted"))
3680 -_S(ERR_MAP(ECHRNG), N_("Channel number out of range"))
3681 +_S(ECHRNG, N_("Channel number out of range"))
3684 -_S(ERR_MAP(EL2NSYNC), N_("Level 2 not synchronized"))
3685 +_S(EL2NSYNC, N_("Level 2 not synchronized"))
3688 -_S(ERR_MAP(EL3HLT), N_("Level 3 halted"))
3689 +_S(EL3HLT, N_("Level 3 halted"))
3692 -_S(ERR_MAP(EL3RST), N_("Level 3 reset"))
3693 +_S(EL3RST, N_("Level 3 reset"))
3696 -_S(ERR_MAP(ELNRNG), N_("Link number out of range"))
3697 +_S(ELNRNG, N_("Link number out of range"))
3700 -_S(ERR_MAP(EUNATCH), N_("Protocol driver not attached"))
3701 +_S(EUNATCH, N_("Protocol driver not attached"))
3704 -_S(ERR_MAP(ENOCSI), N_("No CSI structure available"))
3705 +_S(ENOCSI, N_("No CSI structure available"))
3708 -_S(ERR_MAP(EL2HLT), N_("Level 2 halted"))
3709 +_S(EL2HLT, N_("Level 2 halted"))
3712 -_S(ERR_MAP(EBADE), N_("Invalid exchange"))
3713 +_S(EBADE, N_("Invalid exchange"))
3716 -_S(ERR_MAP(EBADR), N_("Invalid request descriptor"))
3717 +_S(EBADR, N_("Invalid request descriptor"))
3720 -_S(ERR_MAP(EXFULL), N_("Exchange full"))
3721 +_S(EXFULL, N_("Exchange full"))
3724 -_S(ERR_MAP(ENOANO), N_("No anode"))
3725 +_S(ENOANO, N_("No anode"))
3728 -_S(ERR_MAP(EBADRQC), N_("Invalid request code"))
3729 +_S(EBADRQC, N_("Invalid request code"))
3732 -_S(ERR_MAP(EBADSLT), N_("Invalid slot"))
3733 +_S(EBADSLT, N_("Invalid slot"))
3736 -_S(ERR_MAP(EBFONT), N_("Bad font file format"))
3737 +_S(EBFONT, N_("Bad font file format"))
3740 -_S(ERR_MAP(ENONET), N_("Machine is not on the network"))
3741 +_S(ENONET, N_("Machine is not on the network"))
3744 -_S(ERR_MAP(ENOPKG), N_("Package not installed"))
3745 +_S(ENOPKG, N_("Package not installed"))
3748 -_S(ERR_MAP(EADV), N_("Advertise error"))
3749 +_S(EADV, N_("Advertise error"))
3752 -_S(ERR_MAP(ESRMNT), N_("Srmount error"))
3753 +_S(ESRMNT, N_("Srmount error"))
3756 -_S(ERR_MAP(ECOMM), N_("Communication error on send"))
3757 +_S(ECOMM, N_("Communication error on send"))
3760 -_S(ERR_MAP(EDOTDOT), N_("RFS specific error"))
3761 +_S(EDOTDOT, N_("RFS specific error"))
3764 -_S(ERR_MAP(ENOTUNIQ), N_("Name not unique on network"))
3765 +_S(ENOTUNIQ, N_("Name not unique on network"))
3768 -_S(ERR_MAP(EBADFD), N_("File descriptor in bad state"))
3769 +_S(EBADFD, N_("File descriptor in bad state"))
3772 -_S(ERR_MAP(EREMCHG), N_("Remote address changed"))
3773 +_S(EREMCHG, N_("Remote address changed"))
3776 -_S(ERR_MAP(ELIBACC), N_("Can not access a needed shared library"))
3777 +_S(ELIBACC, N_("Can not access a needed shared library"))
3780 -_S(ERR_MAP(ELIBBAD), N_("Accessing a corrupted shared library"))
3781 +_S(ELIBBAD, N_("Accessing a corrupted shared library"))
3784 -_S(ERR_MAP(ELIBSCN), N_(".lib section in a.out corrupted"))
3785 +_S(ELIBSCN, N_(".lib section in a.out corrupted"))
3788 -_S(ERR_MAP(ELIBMAX), N_("Attempting to link in too many shared libraries"))
3789 +_S(ELIBMAX, N_("Attempting to link in too many shared libraries"))
3792 -_S(ERR_MAP(ELIBEXEC), N_("Cannot exec a shared library directly"))
3793 +_S(ELIBEXEC, N_("Cannot exec a shared library directly"))
3796 -_S(ERR_MAP(ESTRPIPE), N_("Streams pipe error"))
3797 +_S(ESTRPIPE, N_("Streams pipe error"))
3800 -_S(ERR_MAP(EUCLEAN), N_("Structure needs cleaning"))
3801 +_S(EUCLEAN, N_("Structure needs cleaning"))
3804 -_S(ERR_MAP(ENOTNAM), N_("Not a XENIX named type file"))
3805 +_S(ENOTNAM, N_("Not a XENIX named type file"))
3808 -_S(ERR_MAP(ENAVAIL), N_("No XENIX semaphores available"))
3809 +_S(ENAVAIL, N_("No XENIX semaphores available"))
3812 -_S(ERR_MAP(EISNAM), N_("Is a named type file"))
3813 +_S(EISNAM, N_("Is a named type file"))
3816 -_S(ERR_MAP(EREMOTEIO), N_("Remote I/O error"))
3817 +_S(EREMOTEIO, N_("Remote I/O error"))
3820 -_S(ERR_MAP(ENOMEDIUM), N_("No medium found"))
3821 +_S(ENOMEDIUM, N_("No medium found"))
3824 -_S(ERR_MAP(EMEDIUMTYPE), N_("Wrong medium type"))
3825 +_S(EMEDIUMTYPE, N_("Wrong medium type"))
3828 -_S(ERR_MAP(ENOKEY), N_("Required key not available"))
3829 +_S(ENOKEY, N_("Required key not available"))
3832 -_S(ERR_MAP(EKEYEXPIRED), N_("Key has expired"))
3833 +_S(EKEYEXPIRED, N_("Key has expired"))
3836 -_S(ERR_MAP(EKEYREVOKED), N_("Key has been revoked"))
3837 +_S(EKEYREVOKED, N_("Key has been revoked"))
3840 -_S(ERR_MAP(EKEYREJECTED), N_("Key was rejected by service"))
3841 +_S(EKEYREJECTED, N_("Key was rejected by service"))
3844 -_S(ERR_MAP(ERFKILL), N_("Operation not possible due to RF-kill"))
3845 +_S(ERFKILL, N_("Operation not possible due to RF-kill"))
3848 -_S(ERR_MAP(EHWPOISON), N_("Memory page has hardware error"))
3849 +_S(EHWPOISON, N_("Memory page has hardware error"))
3852 -_S(ERR_MAP(EBADRPC), N_("RPC struct is bad"))
3853 +_S(EBADRPC, N_("RPC struct is bad"))
3857 @@ -693,40 +690,40 @@ TRANS operation, or a data file had the wrong format.
3859 TRANS On some systems @code{chmod} returns this error if you try to set the
3860 TRANS sticky bit on a non-directory file; @pxref{Setting Permissions}. */
3861 -_S(ERR_MAP(EFTYPE), N_("Inappropriate file type or format"))
3862 +_S(EFTYPE, N_("Inappropriate file type or format"))
3865 -_S(ERR_MAP(EPROCUNAVAIL), N_("RPC bad procedure for program"))
3866 +_S(EPROCUNAVAIL, N_("RPC bad procedure for program"))
3869 -_S(ERR_MAP(EAUTH), N_("Authentication error"))
3870 +_S(EAUTH, N_("Authentication error"))
3874 TRANS On @gnuhurdsystems{}, opening a file returns this error when the file is
3875 TRANS translated by a program and the translator program dies while starting
3876 TRANS up, before it has connected to the file. */
3877 -_S(ERR_MAP(EDIED), N_("Translator died"))
3878 +_S(EDIED, N_("Translator died"))
3881 -_S(ERR_MAP(ERPCMISMATCH), N_("RPC version wrong"))
3882 +_S(ERPCMISMATCH, N_("RPC version wrong"))
3886 TRANS You did @strong{what}? */
3887 -_S(ERR_MAP(EGREGIOUS), N_("You really blew it this time"))
3888 +_S(EGREGIOUS, N_("You really blew it this time"))
3892 TRANS This means that the per-user limit on new process would be exceeded by
3893 TRANS an attempted @code{fork}. @xref{Limits on Resources}, for details on
3894 TRANS the @code{RLIMIT_NPROC} limit. */
3895 -_S(ERR_MAP(EPROCLIM), N_("Too many processes"))
3896 +_S(EPROCLIM, N_("Too many processes"))
3900 TRANS This error code has no purpose. */
3901 -_S(ERR_MAP(EGRATUITOUS), N_("Gratuitous error"))
3902 +_S(EGRATUITOUS, N_("Gratuitous error"))
3904 #if defined (ENOTSUP) && ENOTSUP != EOPNOTSUPP
3906 @@ -742,10 +739,10 @@ TRANS values.
3908 TRANS If the entire function is not available at all in the implementation,
3909 TRANS it returns @code{ENOSYS} instead. */
3910 -_S(ERR_MAP(ENOTSUP), N_("Not supported"))
3911 +_S(ENOTSUP, N_("Not supported"))
3913 #ifdef EPROGMISMATCH
3914 -_S(ERR_MAP(EPROGMISMATCH), N_("RPC program version wrong"))
3915 +_S(EPROGMISMATCH, N_("RPC program version wrong"))
3919 @@ -755,7 +752,7 @@ TRANS foreground process group of the terminal. Users do not usually see this
3920 TRANS error because functions such as @code{read} and @code{write} translate
3921 TRANS it into a @code{SIGTTIN} or @code{SIGTTOU} signal. @xref{Job Control},
3922 TRANS for information on process groups and these signals. */
3923 -_S(ERR_MAP(EBACKGROUND), N_("Inappropriate operation for background process"))
3924 +_S(EBACKGROUND, N_("Inappropriate operation for background process"))
3928 @@ -773,7 +770,7 @@ TRANS @c "bought the farm" means "died". -jtobey
3930 TRANS @c Translators, please do not translate this litteraly, translate it into
3931 TRANS @c an idiomatic funny way of saying that the computer died. */
3932 -_S(ERR_MAP(EIEIO), N_("Computer bought the farm"))
3933 +_S(EIEIO, N_("Computer bought the farm"))
3935 #if defined (EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
3937 @@ -782,18 +779,18 @@ TRANS The values are always the same, on every operating system.
3939 TRANS C libraries in many older Unix systems have @code{EWOULDBLOCK} as a
3940 TRANS separate error code. */
3941 -_S(ERR_MAP(EWOULDBLOCK), N_("Operation would block"))
3942 +_S(EWOULDBLOCK, N_("Operation would block"))
3945 -_S(ERR_MAP(ENEEDAUTH), N_("Need authenticator"))
3946 +_S(ENEEDAUTH, N_("Need authenticator"))
3950 TRANS The experienced user will know what is wrong.
3951 TRANS @c This error code is a joke. Its perror text is part of the joke.
3952 TRANS @c Don't change it. */
3953 -_S(ERR_MAP(ED), N_("?"))
3957 -_S(ERR_MAP(EPROGUNAVAIL), N_("RPC program not available"))
3958 +_S(EPROGUNAVAIL, N_("RPC program not available"))
3960 diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
3961 index 0f08079e48..672d8f27ce 100644
3962 --- a/sysdeps/i386/dl-machine.h
3963 +++ b/sysdeps/i386/dl-machine.h
3964 @@ -338,16 +338,22 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc,
3966 # ifndef RTLD_BOOTSTRAP
3968 - && sym_map->l_type != lt_executable
3969 && !sym_map->l_relocated)
3972 = (const char *) D_PTR (map, l_info[DT_STRTAB]);
3973 - _dl_error_printf ("\
3974 + if (sym_map->l_type == lt_executable)
3975 + _dl_fatal_printf ("\
3976 +%s: IFUNC symbol '%s' referenced in '%s' is defined in the executable \
3977 +and creates an unsatisfiable circular dependency.\n",
3978 + RTLD_PROGNAME, strtab + refsym->st_name,
3981 + _dl_error_printf ("\
3982 %s: Relink `%s' with `%s' for IFUNC symbol `%s'\n",
3983 - RTLD_PROGNAME, map->l_name,
3985 - strtab + refsym->st_name);
3986 + RTLD_PROGNAME, map->l_name,
3988 + strtab + refsym->st_name);
3991 value = ((Elf32_Addr (*) (void)) value) ();
3992 diff --git a/sysdeps/powerpc/powerpc64/backtrace.c b/sysdeps/powerpc/powerpc64/backtrace.c
3993 index 8a53a1088f..362a2b713c 100644
3994 --- a/sysdeps/powerpc/powerpc64/backtrace.c
3995 +++ b/sysdeps/powerpc/powerpc64/backtrace.c
3996 @@ -54,11 +54,22 @@ struct signal_frame_64 {
3997 /* We don't care about the rest, since the IP value is at 'uc' field. */
4000 +/* Test if the address match to the inside the trampoline code.
4001 + Up to and including kernel 5.8, returning from an interrupt or syscall to a
4002 + signal handler starts execution directly at the handler's entry point, with
4003 + LR set to address of the sigreturn trampoline (the vDSO symbol).
4004 + Newer kernels will branch to signal handler from the trampoline instead, so
4005 + checking the stacktrace against the vDSO entrypoint does not work in such
4007 + The vDSO branches with a 'bctrl' instruction, so checking either the
4008 + vDSO address itself and the next instruction should cover all kernel
4011 is_sigtramp_address (void *nip)
4013 #ifdef HAVE_SIGTRAMP_RT64
4014 - if (nip == GLRO (dl_vdso_sigtramp_rt64))
4015 + if (nip == GLRO (dl_vdso_sigtramp_rt64) ||
4016 + nip == GLRO (dl_vdso_sigtramp_rt64) + 4)
4020 diff --git a/sysdeps/sh/be/sh4/fpu/Implies b/sysdeps/sh/be/sh4/fpu/Implies
4021 new file mode 100644
4022 index 0000000000..71b28ee1a4
4024 +++ b/sysdeps/sh/be/sh4/fpu/Implies
4027 diff --git a/sysdeps/sh/le/sh4/fpu/Implies b/sysdeps/sh/le/sh4/fpu/Implies
4028 new file mode 100644
4029 index 0000000000..71b28ee1a4
4031 +++ b/sysdeps/sh/le/sh4/fpu/Implies
4034 diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
4035 index 9b2a253032..34748ffcd1 100644
4036 --- a/sysdeps/unix/sysv/linux/Makefile
4037 +++ b/sysdeps/unix/sysv/linux/Makefile
4038 @@ -100,7 +100,7 @@ tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
4039 tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
4040 test-errno-linux tst-memfd_create tst-mlock2 tst-pkey \
4041 tst-rlimit-infinity tst-ofdlocks tst-gettid tst-gettid-kill \
4043 + tst-tgkill tst-sysvsem-linux tst-sysvmsg-linux tst-sysvshm-linux
4044 tests-internal += tst-ofdlocks-compat tst-sigcontext-get_pc
4046 CFLAGS-tst-sigcontext-get_pc.c = -fasynchronous-unwind-tables
4047 diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
4048 index fc688450ee..00a4d0c8e7 100644
4049 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
4050 +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h
4052 && MIDR_PARTNUM(midr) == 0x000)
4053 #define IS_NEOVERSE_N1(midr) (MIDR_IMPLEMENTOR(midr) == 'A' \
4054 && MIDR_PARTNUM(midr) == 0xd0c)
4055 +#define IS_NEOVERSE_N2(midr) (MIDR_IMPLEMENTOR(midr) == 'A' \
4056 + && MIDR_PARTNUM(midr) == 0xd49)
4057 +#define IS_NEOVERSE_V1(midr) (MIDR_IMPLEMENTOR(midr) == 'A' \
4058 + && MIDR_PARTNUM(midr) == 0xd40)
4060 #define IS_EMAG(midr) (MIDR_IMPLEMENTOR(midr) == 'P' \
4061 && MIDR_PARTNUM(midr) == 0x000)
4062 diff --git a/sysdeps/unix/sysv/linux/msgctl.c b/sysdeps/unix/sysv/linux/msgctl.c
4063 index 0776472d5e..a1f24ab242 100644
4064 --- a/sysdeps/unix/sysv/linux/msgctl.c
4065 +++ b/sysdeps/unix/sysv/linux/msgctl.c
4066 @@ -90,8 +90,15 @@ __msgctl64 (int msqid, int cmd, struct __msqid64_ds *buf)
4067 struct kernel_msqid64_ds ksemid, *arg = NULL;
4070 - msqid64_to_kmsqid64 (buf, &ksemid);
4072 + /* This is a Linux extension where kernel returns a 'struct msginfo'
4074 + if (cmd == IPC_INFO || cmd == MSG_INFO)
4075 + arg = (struct kernel_msqid64_ds *) buf;
4078 + msqid64_to_kmsqid64 (buf, &ksemid);
4082 # ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T
4084 @@ -169,8 +176,15 @@ __msgctl (int msqid, int cmd, struct msqid_ds *buf)
4085 struct __msqid64_ds msqid64, *buf64 = NULL;
4088 - msqid_to_msqid64 (&msqid64, buf);
4090 + /* This is a Linux extension where kernel returns a 'struct msginfo'
4092 + if (cmd == IPC_INFO || cmd == MSG_INFO)
4093 + buf64 = (struct __msqid64_ds *) buf;
4096 + msqid_to_msqid64 (&msqid64, buf);
4101 int ret = __msgctl64 (msqid, cmd, buf64);
4102 diff --git a/sysdeps/unix/sysv/linux/semctl.c b/sysdeps/unix/sysv/linux/semctl.c
4103 index f131a26fc7..1cdabde8f2 100644
4104 --- a/sysdeps/unix/sysv/linux/semctl.c
4105 +++ b/sysdeps/unix/sysv/linux/semctl.c
4106 @@ -102,6 +102,7 @@ semun64_to_ksemun64 (int cmd, union semun64 semun64,
4107 r.array = semun64.array;
4110 + case SEM_STAT_ANY:
4114 @@ -150,6 +151,7 @@ __semctl64 (int semid, int semnum, int cmd, ...)
4115 case IPC_STAT: /* arg.buf */
4118 + case SEM_STAT_ANY:
4119 case IPC_INFO: /* arg.__buf */
4122 @@ -238,6 +240,7 @@ semun_to_semun64 (int cmd, union semun semun, struct __semid64_ds *semid64)
4123 r.array = semun.array;
4126 + case SEM_STAT_ANY:
4130 @@ -267,6 +270,7 @@ __semctl (int semid, int semnum, int cmd, ...)
4131 case IPC_STAT: /* arg.buf */
4134 + case SEM_STAT_ANY:
4135 case IPC_INFO: /* arg.__buf */
4138 @@ -321,6 +325,7 @@ __semctl_mode16 (int semid, int semnum, int cmd, ...)
4139 case IPC_STAT: /* arg.buf */
4142 + case SEM_STAT_ANY:
4143 case IPC_INFO: /* arg.__buf */
4146 @@ -354,6 +359,7 @@ __old_semctl (int semid, int semnum, int cmd, ...)
4147 case IPC_STAT: /* arg.buf */
4150 + case SEM_STAT_ANY:
4151 case IPC_INFO: /* arg.__buf */
4154 diff --git a/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies b/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies
4155 new file mode 100644
4156 index 0000000000..7eeaf15a5a
4158 +++ b/sysdeps/unix/sysv/linux/sh/be/sh4/fpu/Implies
4160 +unix/sysv/linux/sh/sh4/fpu
4161 diff --git a/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies b/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies
4162 new file mode 100644
4163 index 0000000000..7eeaf15a5a
4165 +++ b/sysdeps/unix/sysv/linux/sh/le/sh4/fpu/Implies
4167 +unix/sysv/linux/sh/sh4/fpu
4168 diff --git a/sysdeps/unix/sysv/linux/shmctl.c b/sysdeps/unix/sysv/linux/shmctl.c
4169 index 76d88441f1..1d19a798b1 100644
4170 --- a/sysdeps/unix/sysv/linux/shmctl.c
4171 +++ b/sysdeps/unix/sysv/linux/shmctl.c
4172 @@ -90,8 +90,15 @@ __shmctl64 (int shmid, int cmd, struct __shmid64_ds *buf)
4173 struct kernel_shmid64_ds kshmid, *arg = NULL;
4176 - shmid64_to_kshmid64 (buf, &kshmid);
4178 + /* This is a Linux extension where kernel expects either a
4179 + 'struct shminfo' (IPC_INFO) or 'struct shm_info' (SHM_INFO). */
4180 + if (cmd == IPC_INFO || cmd == SHM_INFO)
4181 + arg = (struct kernel_shmid64_ds *) buf;
4184 + shmid64_to_kshmid64 (buf, &kshmid);
4188 # ifdef __ASSUME_SYSVIPC_BROKEN_MODE_T
4190 @@ -107,7 +114,6 @@ __shmctl64 (int shmid, int cmd, struct __shmid64_ds *buf)
4198 @@ -168,8 +174,15 @@ __shmctl (int shmid, int cmd, struct shmid_ds *buf)
4199 struct __shmid64_ds shmid64, *buf64 = NULL;
4202 - shmid_to_shmid64 (&shmid64, buf);
4204 + /* This is a Linux extension where kernel expects either a
4205 + 'struct shminfo' (IPC_INFO) or 'struct shm_info' (SHM_INFO). */
4206 + if (cmd == IPC_INFO || cmd == SHM_INFO)
4207 + buf64 = (struct __shmid64_ds *) buf;
4210 + shmid_to_shmid64 (&shmid64, buf);
4215 int ret = __shmctl64 (shmid, cmd, buf64);
4216 @@ -178,7 +191,6 @@ __shmctl (int shmid, int cmd, struct shmid_ds *buf)
4224 diff --git a/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c b/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c
4225 new file mode 100644
4226 index 0000000000..630f4f792c
4228 +++ b/sysdeps/unix/sysv/linux/tst-sysvmsg-linux.c
4230 +/* Basic tests for Linux SYSV message queue extensions.
4231 + Copyright (C) 2020 Free Software Foundation, Inc.
4232 + This file is part of the GNU C Library.
4234 + The GNU C Library is free software; you can redistribute it and/or
4235 + modify it under the terms of the GNU Lesser General Public
4236 + License as published by the Free Software Foundation; either
4237 + version 2.1 of the License, or (at your option) any later version.
4239 + The GNU C Library is distributed in the hope that it will be useful,
4240 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4241 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4242 + Lesser General Public License for more details.
4244 + You should have received a copy of the GNU Lesser General Public
4245 + License along with the GNU C Library; if not, see
4246 + <https://www.gnu.org/licenses/>. */
4248 +#include <sys/ipc.h>
4249 +#include <sys/msg.h>
4251 +#include <stdlib.h>
4252 +#include <stdbool.h>
4255 +#include <support/check.h>
4256 +#include <support/temp_file.h>
4258 +#define MSGQ_MODE 0644
4260 +/* These are for the temporary file we generate. */
4267 + /* Enforce message queue removal in case of early test failure.
4268 + Ignore error since the msg may already have being removed. */
4269 + msgctl (msqid, IPC_RMID, NULL);
4273 +do_prepare (int argc, char *argv[])
4275 + TEST_VERIFY_EXIT (create_temp_file ("tst-sysvmsg.", &name) != -1);
4278 +#define PREPARE do_prepare
4280 +struct test_msginfo
4287 +/* It tries to obtain some system-wide SysV messsage queue information from
4288 + /proc to check against IPC_INFO/MSG_INFO. The /proc only returns the
4289 + tunables value of MSGMAX, MSGMNB, and MSGMNI.
4291 + The kernel also returns constant value for MSGSSZ, MSGSEG and also MSGMAP,
4292 + MSGPOOL, and MSGTQL (for IPC_INFO). The issue to check them is they might
4293 + change over kernel releases. */
4296 +read_proc_file (const char *file)
4298 + FILE *f = fopen (file, "r");
4300 + FAIL_UNSUPPORTED ("/proc is not mounted or %s is not available", file);
4303 + int r = fscanf (f, "%d", & v);
4304 + TEST_VERIFY_EXIT (r == 1);
4311 +/* Check if the message queue with IDX (index into the kernel's internal
4312 + array) matches the one with KEY. The CMD is either MSG_STAT or
4316 +check_msginfo (int idx, key_t key, int cmd)
4318 + struct msqid_ds msginfo;
4319 + int mid = msgctl (idx, cmd, &msginfo);
4320 + /* Ignore unused array slot returned by the kernel or information from
4321 + unknown message queue. */
4322 + if ((mid == -1 && errno == EINVAL) || mid != msqid)
4326 + FAIL_EXIT1 ("msgctl with %s failed: %m",
4327 + cmd == MSG_STAT ? "MSG_STAT" : "MSG_STAT_ANY");
4329 + TEST_COMPARE (msginfo.msg_perm.__key, key);
4330 + TEST_COMPARE (msginfo.msg_perm.mode, MSGQ_MODE);
4331 + TEST_COMPARE (msginfo.msg_qnum, 0);
4339 + atexit (remove_msq);
4341 + key_t key = ftok (name, 'G');
4343 + FAIL_EXIT1 ("ftok failed: %m");
4345 + msqid = msgget (key, MSGQ_MODE | IPC_CREAT);
4347 + FAIL_EXIT1 ("msgget failed: %m");
4349 + struct test_msginfo tipcinfo;
4350 + tipcinfo.msgmax = read_proc_file ("/proc/sys/kernel/msgmax");
4351 + tipcinfo.msgmnb = read_proc_file ("/proc/sys/kernel/msgmnb");
4352 + tipcinfo.msgmni = read_proc_file ("/proc/sys/kernel/msgmni");
4357 + struct msginfo ipcinfo;
4358 + msqidx = msgctl (msqid, IPC_INFO, (struct msqid_ds *) &ipcinfo);
4360 + FAIL_EXIT1 ("msgctl with IPC_INFO failed: %m");
4362 + TEST_COMPARE (ipcinfo.msgmax, tipcinfo.msgmax);
4363 + TEST_COMPARE (ipcinfo.msgmnb, tipcinfo.msgmnb);
4364 + TEST_COMPARE (ipcinfo.msgmni, tipcinfo.msgmni);
4367 + /* Same as before but with MSG_INFO. */
4369 + struct msginfo ipcinfo;
4370 + msqidx = msgctl (msqid, MSG_INFO, (struct msqid_ds *) &ipcinfo);
4372 + FAIL_EXIT1 ("msgctl with IPC_INFO failed: %m");
4374 + TEST_COMPARE (ipcinfo.msgmax, tipcinfo.msgmax);
4375 + TEST_COMPARE (ipcinfo.msgmnb, tipcinfo.msgmnb);
4376 + TEST_COMPARE (ipcinfo.msgmni, tipcinfo.msgmni);
4379 + /* We check if the created message queue shows in global list. */
4380 + bool found = false;
4381 + for (int i = 0; i <= msqidx; i++)
4383 + /* We can't tell apart if MSG_STAT_ANY is not supported (kernel older
4384 + than 4.17) or if the index used is invalid. So it just check if the
4385 + value returned from a valid call matches the created message
4387 + check_msginfo (i, key, MSG_STAT_ANY);
4389 + if (check_msginfo (i, key, MSG_STAT))
4397 + FAIL_EXIT1 ("msgctl with MSG_STAT/MSG_STAT_ANY could not find the "
4398 + "created message queue");
4400 + if (msgctl (msqid, IPC_RMID, NULL) == -1)
4401 + FAIL_EXIT1 ("msgctl failed");
4406 +#include <support/test-driver.c>
4407 diff --git a/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c b/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c
4408 new file mode 100644
4409 index 0000000000..45f19e2d37
4411 +++ b/sysdeps/unix/sysv/linux/tst-sysvsem-linux.c
4413 +/* Basic tests for Linux SYSV semaphore extensions.
4414 + Copyright (C) 2020 Free Software Foundation, Inc.
4415 + This file is part of the GNU C Library.
4417 + The GNU C Library is free software; you can redistribute it and/or
4418 + modify it under the terms of the GNU Lesser General Public
4419 + License as published by the Free Software Foundation; either
4420 + version 2.1 of the License, or (at your option) any later version.
4422 + The GNU C Library is distributed in the hope that it will be useful,
4423 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4424 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4425 + Lesser General Public License for more details.
4427 + You should have received a copy of the GNU Lesser General Public
4428 + License along with the GNU C Library; if not, see
4429 + <https://www.gnu.org/licenses/>. */
4431 +#include <sys/ipc.h>
4432 +#include <sys/sem.h>
4434 +#include <stdlib.h>
4435 +#include <stdbool.h>
4438 +#include <support/check.h>
4439 +#include <support/temp_file.h>
4441 +/* These are for the temporary file we generate. */
4448 + /* Enforce message queue removal in case of early test failure.
4449 + Ignore error since the sem may already have being removed. */
4450 + semctl (semid, 0, IPC_RMID, 0);
4454 +do_prepare (int argc, char *argv[])
4456 + TEST_VERIFY_EXIT (create_temp_file ("tst-sysvsem.", &name) != -1);
4459 +#define PREPARE do_prepare
4461 +#define SEM_MODE 0644
4466 + struct semid_ds *buf;
4467 + unsigned short *array;
4468 + struct seminfo *__buf;
4471 +struct test_seminfo
4479 +/* It tries to obtain some system-wide SysV semaphore information from /proc
4480 + to check against IPC_INFO/SEM_INFO. The /proc only returns the tunables
4481 + value of SEMMSL, SEMMNS, SEMOPM, and SEMMNI.
4483 + The kernel also returns constant value for SEMVMX, SEMMNU, SEMMAP, SEMUME,
4484 + and also SEMUSZ and SEMAEM (for IPC_INFO). The issue to check them is they
4485 + might change over kernel releases. */
4488 +read_sem_stat (struct test_seminfo *tseminfo)
4490 + FILE *f = fopen ("/proc/sys/kernel/sem", "r");
4492 + FAIL_UNSUPPORTED ("/proc is not mounted or /proc/sys/kernel/sem is not "
4495 + int r = fscanf (f, "%d %d %d %d",
4496 + &tseminfo->semmsl, &tseminfo->semmns, &tseminfo->semopm,
4497 + &tseminfo->semmni);
4498 + TEST_VERIFY_EXIT (r == 4);
4504 +/* Check if the semaphore with IDX (index into the kernel's internal array)
4505 + matches the one with KEY. The CMD is either SEM_STAT or SEM_STAT_ANY. */
4508 +check_seminfo (int idx, key_t key, int cmd)
4510 + struct semid_ds seminfo;
4511 + int sid = semctl (idx, 0, cmd, (union semun) { .buf = &seminfo });
4512 + /* Ignore unused array slot returned by the kernel or information from
4513 + unknown semaphores. */
4514 + if ((sid == -1 && errno == EINVAL) || sid != semid)
4518 + FAIL_EXIT1 ("semctl with SEM_STAT failed (errno=%d)", errno);
4520 + TEST_COMPARE (seminfo.sem_perm.__key, key);
4521 + TEST_COMPARE (seminfo.sem_perm.mode, SEM_MODE);
4522 + TEST_COMPARE (seminfo.sem_nsems, 1);
4530 + atexit (remove_sem);
4532 + key_t key = ftok (name, 'G');
4534 + FAIL_EXIT1 ("ftok failed: %m");
4536 + semid = semget (key, 1, IPC_CREAT | IPC_EXCL | SEM_MODE);
4538 + FAIL_EXIT1 ("semget failed: %m");
4540 + struct test_seminfo tipcinfo;
4541 + read_sem_stat (&tipcinfo);
4546 + struct seminfo ipcinfo;
4547 + semidx = semctl (semid, 0, IPC_INFO, (union semun) { .__buf = &ipcinfo });
4549 + FAIL_EXIT1 ("semctl with IPC_INFO failed: %m");
4551 + TEST_COMPARE (ipcinfo.semmsl, tipcinfo.semmsl);
4552 + TEST_COMPARE (ipcinfo.semmns, tipcinfo.semmns);
4553 + TEST_COMPARE (ipcinfo.semopm, tipcinfo.semopm);
4554 + TEST_COMPARE (ipcinfo.semmni, tipcinfo.semmni);
4557 + /* Same as before but with SEM_INFO. */
4559 + struct seminfo ipcinfo;
4560 + semidx = semctl (semid, 0, SEM_INFO, (union semun) { .__buf = &ipcinfo });
4562 + FAIL_EXIT1 ("semctl with IPC_INFO failed: %m");
4564 + TEST_COMPARE (ipcinfo.semmsl, tipcinfo.semmsl);
4565 + TEST_COMPARE (ipcinfo.semmns, tipcinfo.semmns);
4566 + TEST_COMPARE (ipcinfo.semopm, tipcinfo.semopm);
4567 + TEST_COMPARE (ipcinfo.semmni, tipcinfo.semmni);
4570 + /* We check if the created semaphore shows in the system-wide status. */
4571 + bool found = false;
4572 + for (int i = 0; i <= semidx; i++)
4574 + /* We can't tell apart if SEM_STAT_ANY is not supported (kernel older
4575 + than 4.17) or if the index used is invalid. So it just check if
4576 + value returned from a valid call matches the created semaphore. */
4577 + check_seminfo (i, key, SEM_STAT_ANY);
4579 + if (check_seminfo (i, key, SEM_STAT))
4587 + FAIL_EXIT1 ("semctl with SEM_STAT/SEM_STAT_ANY could not find the "
4588 + "created semaphore");
4590 + if (semctl (semid, 0, IPC_RMID, 0) == -1)
4591 + FAIL_EXIT1 ("semctl failed: %m");
4596 +#include <support/test-driver.c>
4597 diff --git a/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c
4598 new file mode 100644
4599 index 0000000000..7128ae2e14
4601 +++ b/sysdeps/unix/sysv/linux/tst-sysvshm-linux.c
4603 +/* Basic tests for Linux SYSV shared memory extensions.
4604 + Copyright (C) 2020 Free Software Foundation, Inc.
4605 + This file is part of the GNU C Library.
4607 + The GNU C Library is free software; you can redistribute it and/or
4608 + modify it under the terms of the GNU Lesser General Public
4609 + License as published by the Free Software Foundation; either
4610 + version 2.1 of the License, or (at your option) any later version.
4612 + The GNU C Library is distributed in the hope that it will be useful,
4613 + but WITHOUT ANY WARRANTY; without even the implied warranty of
4614 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4615 + Lesser General Public License for more details.
4617 + You should have received a copy of the GNU Lesser General Public
4618 + License along with the GNU C Library; if not, see
4619 + <https://www.gnu.org/licenses/>. */
4621 +#include <sys/ipc.h>
4622 +#include <sys/shm.h>
4624 +#include <stdlib.h>
4625 +#include <stdbool.h>
4627 +#include <unistd.h>
4628 +#include <inttypes.h>
4629 +#include <limits.h>
4631 +#include <support/check.h>
4632 +#include <support/temp_file.h>
4634 +#define SHM_MODE 0644
4636 +/* These are for the temporary file we generate. */
4639 +static long int pgsz;
4644 + /* Enforce message queue removal in case of early test failure.
4645 + Ignore error since the shm may already have being removed. */
4646 + shmctl (shmid, IPC_RMID, NULL);
4650 +do_prepare (int argc, char *argv[])
4652 + TEST_VERIFY_EXIT (create_temp_file ("tst-sysvshm.", &name) != -1);
4655 +#define PREPARE do_prepare
4657 +struct test_shminfo
4659 + unsigned long int shmall;
4660 + unsigned long int shmmax;
4661 + unsigned long int shmmni;
4664 +/* It tries to obtain some system-wide SysV shared memory information from
4665 + /proc to check against IPC_INFO/SHM_INFO. The /proc only returns the
4666 + tunables value of SHMALL, SHMMAX, and SHMMNI. */
4669 +read_proc_file (const char *file)
4671 + FILE *f = fopen (file, "r");
4673 + FAIL_UNSUPPORTED ("/proc is not mounted or %s is not available", file);
4675 + /* Handle 32-bit binaries running on 64-bit kernels. */
4677 + int r = fscanf (f, "%" SCNu64, &v);
4678 + TEST_VERIFY_EXIT (r == 1);
4685 +/* Check if the message queue with IDX (index into the kernel's internal
4686 + array) matches the one with KEY. The CMD is either SHM_STAT or
4690 +check_shminfo (int idx, key_t key, int cmd)
4692 + struct shmid_ds shminfo;
4693 + int sid = shmctl (idx, cmd, &shminfo);
4694 + /* Ignore unused array slot returned by the kernel or information from
4695 + unknown message queue. */
4696 + if ((sid == -1 && errno == EINVAL) || sid != shmid)
4700 + FAIL_EXIT1 ("shmctl with %s failed: %m",
4701 + cmd == SHM_STAT ? "SHM_STAT" : "SHM_STAT_ANY");
4703 + TEST_COMPARE (shminfo.shm_perm.__key, key);
4704 + TEST_COMPARE (shminfo.shm_perm.mode, SHM_MODE);
4705 + TEST_COMPARE (shminfo.shm_segsz, pgsz);
4713 + atexit (remove_shm);
4715 + pgsz = sysconf (_SC_PAGESIZE);
4717 + FAIL_EXIT1 ("sysconf (_SC_PAGESIZE) failed: %m");
4719 + key_t key = ftok (name, 'G');
4721 + FAIL_EXIT1 ("ftok failed: %m");
4723 + shmid = shmget (key, pgsz, IPC_CREAT | IPC_EXCL | SHM_MODE);
4725 + FAIL_EXIT1 ("shmget failed: %m");
4727 + struct test_shminfo tipcinfo;
4729 + uint64_t v = read_proc_file ("/proc/sys/kernel/shmmax");
4730 +#if LONG_MAX == INT_MAX
4731 + /* Kernel explicit clamp the value for shmmax on compat symbol (32-bit
4732 + binaries running on 64-bit kernels). */
4736 + tipcinfo.shmmax = v;
4738 + tipcinfo.shmall = read_proc_file ("/proc/sys/kernel/shmall");
4739 + tipcinfo.shmmni = read_proc_file ("/proc/sys/kernel/shmmni");
4743 + /* Note: SHM_INFO does not return a shminfo, but rather a 'struct shm_info'.
4744 + It is tricky to verify its values since the syscall returns system wide
4745 + resources consumed by shared memory. The shmctl implementation handles
4746 + SHM_INFO as IPC_INFO, so the IPC_INFO test should validate SHM_INFO as
4750 + struct shminfo ipcinfo;
4751 + shmidx = shmctl (shmid, IPC_INFO, (struct shmid_ds *) &ipcinfo);
4753 + FAIL_EXIT1 ("shmctl with IPC_INFO failed: %m");
4755 + TEST_COMPARE (ipcinfo.shmall, tipcinfo.shmall);
4756 + TEST_COMPARE (ipcinfo.shmmax, tipcinfo.shmmax);
4757 + TEST_COMPARE (ipcinfo.shmmni, tipcinfo.shmmni);
4760 + /* We check if the created shared memory shows in the global list. */
4761 + bool found = false;
4762 + for (int i = 0; i <= shmidx; i++)
4764 + /* We can't tell apart if SHM_STAT_ANY is not supported (kernel older
4765 + than 4.17) or if the index used is invalid. So it just check if
4766 + value returned from a valid call matches the created message
4768 + check_shminfo (i, key, SHM_STAT_ANY);
4770 + if (check_shminfo (i, key, SHM_STAT))
4778 + FAIL_EXIT1 ("shmctl with SHM_STAT/SHM_STAT_ANY could not find the "
4779 + "created shared memory");
4781 + if (shmctl (shmid, IPC_RMID, NULL) == -1)
4782 + FAIL_EXIT1 ("shmctl failed");
4787 +#include <support/test-driver.c>
4788 diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile
4789 index a6736aef25..9736a13e7b 100644
4790 --- a/sysdeps/x86/Makefile
4791 +++ b/sysdeps/x86/Makefile
4792 @@ -12,6 +12,12 @@ endif
4793 ifeq ($(subdir),setjmp)
4794 gen-as-const-headers += jmp_buf-ssp.sym
4795 sysdep_routines += __longjmp_cancel
4796 +ifneq ($(enable-cet),no)
4797 +ifneq ($(have-tunables),no)
4798 +tests += tst-setjmp-cet
4799 +tst-setjmp-cet-ENV = GLIBC_TUNABLES=glibc.cpu.x86_ibt=on:glibc.cpu.x86_shstk=on
4804 ifeq ($(subdir),string)
4805 diff --git a/sysdeps/x86/cacheinfo.c b/sysdeps/x86/cacheinfo.c
4806 index 217c21c34f..3fb4a028d8 100644
4807 --- a/sysdeps/x86/cacheinfo.c
4808 +++ b/sysdeps/x86/cacheinfo.c
4809 @@ -808,7 +808,7 @@ init_cacheinfo (void)
4810 threads = 1 << ((ecx >> 12) & 0x0f);
4814 + if (threads == 0 || cpu_features->basic.family >= 0x17)
4816 /* If APIC ID width is not available, use logical
4818 @@ -823,8 +823,22 @@ init_cacheinfo (void)
4822 - /* Account for exclusive L2 and L3 caches. */
4824 + /* Get shared cache per ccx for Zen architectures. */
4825 + if (cpu_features->basic.family >= 0x17)
4829 + /* Get number of threads share the L3 cache in CCX. */
4830 + __cpuid_count (0x8000001D, 0x3, eax, ebx, ecx, edx);
4832 + unsigned int threads_per_ccx = ((eax >> 14) & 0xfff) + 1;
4833 + shared *= threads_per_ccx;
4837 + /* Account for exclusive L2 and L3 caches. */
4843 @@ -854,14 +868,20 @@ init_cacheinfo (void)
4844 __x86_shared_cache_size = shared;
4847 - /* The large memcpy micro benchmark in glibc shows that 6 times of
4848 - shared cache size is the approximate value above which non-temporal
4849 - store becomes faster on a 8-core processor. This is the 3/4 of the
4850 - total shared cache size. */
4851 + /* The default setting for the non_temporal threshold is 3/4 of one
4852 + thread's share of the chip's cache. For most Intel and AMD processors
4853 + with an initial release date between 2017 and 2020, a thread's typical
4854 + share of the cache is from 500 KBytes to 2 MBytes. Using the 3/4
4855 + threshold leaves 125 KBytes to 500 KBytes of the thread's data
4856 + in cache after a maximum temporal copy, which will maintain
4857 + in cache a reasonable portion of the thread's stack and other
4858 + active data. If the threshold is set higher than one thread's
4859 + share of the cache, it has a substantial risk of negatively
4860 + impacting the performance of other threads running on the chip. */
4861 __x86_shared_non_temporal_threshold
4862 = (cpu_features->non_temporal_threshold != 0
4863 ? cpu_features->non_temporal_threshold
4864 - : __x86_shared_cache_size * threads * 3 / 4);
4865 + : __x86_shared_cache_size * 3 / 4);
4867 /* NB: The REP MOVSB threshold must be greater than VEC_SIZE * 8. */
4868 unsigned int minimum_rep_movsb_threshold;
4869 diff --git a/sysdeps/x86/dl-cet.c b/sysdeps/x86/dl-cet.c
4870 index 03572f7af6..3cc54a8d53 100644
4871 --- a/sysdeps/x86/dl-cet.c
4872 +++ b/sysdeps/x86/dl-cet.c
4873 @@ -47,7 +47,10 @@ dl_cet_check (struct link_map *m, const char *program)
4874 /* No legacy object check if both IBT and SHSTK are always on. */
4875 if (enable_ibt_type == cet_always_on
4876 && enable_shstk_type == cet_always_on)
4879 + THREAD_SETMEM (THREAD_SELF, header.feature_1, GL(dl_x86_feature_1));
4883 /* Check if IBT is enabled by kernel. */
4885 diff --git a/sysdeps/x86/dl-prop.h b/sysdeps/x86/dl-prop.h
4886 index 89911e19e2..4eb3b85a7b 100644
4887 --- a/sysdeps/x86/dl-prop.h
4888 +++ b/sysdeps/x86/dl-prop.h
4889 @@ -145,15 +145,15 @@ _dl_process_cet_property_note (struct link_map *l,
4892 static inline void __attribute__ ((unused))
4893 -_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph)
4894 +_dl_process_pt_note (struct link_map *l, int fd, const ElfW(Phdr) *ph)
4896 const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr);
4897 _dl_process_cet_property_note (l, note, ph->p_memsz, ph->p_align);
4900 static inline int __attribute__ ((always_inline))
4901 -_dl_process_gnu_property (struct link_map *l, uint32_t type, uint32_t datasz,
4903 +_dl_process_gnu_property (struct link_map *l, int fd, uint32_t type,
4904 + uint32_t datasz, void *data)
4908 diff --git a/sysdeps/x86/tst-setjmp-cet.c b/sysdeps/x86/tst-setjmp-cet.c
4909 new file mode 100644
4910 index 0000000000..42c795d2a8
4912 +++ b/sysdeps/x86/tst-setjmp-cet.c
4914 +#include <setjmp/tst-setjmp.c>
4915 diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
4916 index ca73d8fef9..363a749cb2 100644
4917 --- a/sysdeps/x86_64/dl-machine.h
4918 +++ b/sysdeps/x86_64/dl-machine.h
4919 @@ -315,16 +315,22 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
4921 # ifndef RTLD_BOOTSTRAP
4923 - && sym_map->l_type != lt_executable
4924 && !sym_map->l_relocated)
4927 = (const char *) D_PTR (map, l_info[DT_STRTAB]);
4928 - _dl_error_printf ("\
4929 + if (sym_map->l_type == lt_executable)
4930 + _dl_fatal_printf ("\
4931 +%s: IFUNC symbol '%s' referenced in '%s' is defined in the executable \
4932 +and creates an unsatisfiable circular dependency.\n",
4933 + RTLD_PROGNAME, strtab + refsym->st_name,
4936 + _dl_error_printf ("\
4937 %s: Relink `%s' with `%s' for IFUNC symbol `%s'\n",
4938 - RTLD_PROGNAME, map->l_name,
4940 - strtab + refsym->st_name);
4941 + RTLD_PROGNAME, map->l_name,
4943 + strtab + refsym->st_name);
4946 value = ((ElfW(Addr) (*) (void)) value) ();
4947 diff --git a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
4948 index 7659758972..e5fd5ac9cb 100644
4949 --- a/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
4950 +++ b/sysdeps/x86_64/fpu/multiarch/ifunc-fma4.h
4951 @@ -32,7 +32,7 @@ IFUNC_SELECTOR (void)
4952 && CPU_FEATURE_USABLE_P (cpu_features, AVX2))
4953 return OPTIMIZE (fma);
4955 - if (CPU_FEATURE_USABLE_P (cpu_features, FMA))
4956 + if (CPU_FEATURE_USABLE_P (cpu_features, FMA4))
4957 return OPTIMIZE (fma4);
4959 return OPTIMIZE (sse2);
4960 diff --git a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
4961 index bd5dc1a3f3..092f364bb6 100644
4962 --- a/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
4963 +++ b/sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S
4968 +/* Avoid short distance rep movsb only with non-SSE vector. */
4969 +#ifndef AVOID_SHORT_DISTANCE_REP_MOVSB
4970 +# define AVOID_SHORT_DISTANCE_REP_MOVSB (VEC_SIZE > 16)
4972 +# define AVOID_SHORT_DISTANCE_REP_MOVSB 0
4976 # define PREFETCH(addr) prefetcht0 addr
4978 @@ -243,7 +250,21 @@ L(movsb):
4980 /* Avoid slow backward REP MOVSB. */
4981 jb L(more_8x_vec_backward)
4982 +# if AVOID_SHORT_DISTANCE_REP_MOVSB
4988 +# if AVOID_SHORT_DISTANCE_REP_MOVSB
4992 +/* Avoid "rep movsb" if RCX, the distance between source and destination,
4993 + is N*4GB + [1..63] with N >= 0. */
4995 + jbe L(more_2x_vec) /* Avoid "rep movsb" if ECX <= 63. */
4997 mov %RDX_LP, %RCX_LP
5000 diff --git a/sysvipc/test-sysvsem.c b/sysvipc/test-sysvsem.c
5001 index 01dbff343a..b7284e0b48 100644
5002 --- a/sysvipc/test-sysvsem.c
5003 +++ b/sysvipc/test-sysvsem.c
5008 +#include <stdbool.h>
5009 #include <sys/types.h>
5010 #include <sys/ipc.h>
5011 #include <sys/sem.h>
5012 diff --git a/version.h b/version.h
5013 index 83cd196798..e6ca7a8857 100644
5017 /* This file just defines the current version number of libc. */
5019 -#define RELEASE "release"
5020 +#define RELEASE "stable"
5021 #define VERSION "2.32"
5022 diff --git a/sysdeps/unix/sysv/linux/x86_64/64/configure b/sysdeps/unix/sysv/linux/x86_64/64/configure
5023 index 9d298faba7..cef1ec842c 100644
5024 --- a/sysdeps/unix/sysv/linux/x86_64/64/configure
5025 +++ b/sysdeps/unix/sysv/linux/x86_64/64/configure
5027 test -n "$libc_cv_slibdir" ||
5030 - libc_cv_slibdir='/lib64'
5031 - libc_cv_rtlddir='/lib64'
5032 + libc_cv_slibdir='/lib'
5033 + libc_cv_rtlddir='/lib'
5034 if test "$libdir" = '${exec_prefix}/lib'; then
5035 - libdir='${exec_prefix}/lib64';
5036 + libdir='${exec_prefix}/lib';
5037 # Locale data can be shared between 32-bit and 64-bit libraries.
5038 libc_cv_complocaledir='${exec_prefix}/lib/locale'
5040 diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
5041 index 062c04689d..7783757726 100644
5042 --- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
5043 +++ b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
5045 #include <sysdeps/generic/ldconfig.h>
5047 #define SYSDEP_KNOWN_INTERPRETER_NAMES \
5048 - { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
5049 + { "/lib32/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
5050 { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
5051 - { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
5052 + { "/lib/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
5053 #define SYSDEP_KNOWN_LIBRARY_NAMES \
5054 { "libc.so.6", FLAG_ELF_LIBC6 }, \
5055 { "libm.so.6", FLAG_ELF_LIBC6 },