Go to file
Noah Goldstein 49953727d1 x86: Fix bug in strchrnul-evex512 [BZ #32078]
Issue was we were expecting not matches with CHAR before the start of
the string in the page cross case.

The check code in the page cross case:
```
    and    $0xffffffffffffffc0,%rax
    vmovdqa64 (%rax),%zmm17
    vpcmpneqb %zmm17,%zmm16,%k1
    vptestmb %zmm17,%zmm17,%k0{%k1}
    kmovq  %k0,%rax
    inc    %rax
    shr    %cl,%rax
    je     L(continue)
```

expects that all characters that neither match null nor CHAR will be
1s in `rax` prior to the `inc`. Then the `inc` will overflow all of
the 1s where no relevant match was found.

This is incorrect in the page-cross case, as the
`vmovdqa64 (%rax),%zmm17` loads from before the start of the input
string.

If there are matches with CHAR before the start of the string, `rax`
won't properly overflow.

The fix is quite simple. Just replace:

```
    inc    %rax
    shr    %cl,%rax
```
With:
```
    sar    %cl,%rax
    inc    %rax
```

The arithmetic shift will clear any matches prior to the start of the
string while maintaining the signbit so the 1s can properly overflow
to zero in the case of no matches.
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

(cherry picked from commit 7da0886247)
2024-08-15 13:26:05 -07:00
argp Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
assert Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
benchtests Benchtests: Increase benchmark iterations 2024-01-12 16:00:28 +00:00
bits socket: Use may_alias on sockaddr structs (bug 19622) 2024-05-27 17:25:13 +02:00
catgets Update copyright dates not handled by scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ChangeLog.old Create ChangeLog.old/ChangeLog.28 2024-01-31 01:34:58 +01:00
conform Remove ia64-linux-gnu 2024-01-08 17:09:36 -03:00
csu Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
ctype Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
debug debug/getwd_chk.c: warning should be emitted for the __getwd_chk symbol. 2024-01-12 15:21:26 +01:00
dirent Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
dlfcn Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
elf elf: Make dl-rseq-symbols Linux only 2024-07-16 16:33:53 +02:00
gmon Remove ia64-linux-gnu 2024-01-08 17:09:36 -03:00
gnulib Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hesiod Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
htl Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
hurd hurd: Declare _hurd_intr_rpc_msg* with protected visibility 2024-01-03 21:59:54 +01:00
iconv Update copyright dates not handled by scripts/update-copyrights 2024-01-01 10:53:40 -08:00
iconvdata iconv: ISO-2022-CN-EXT: fix out-of-bound writes when writing escape sequence (CVE-2024-2961) 2024-04-17 14:05:08 -03:00
include version.h, include/features.h: Bump version to 2.39 2024-01-31 01:29:11 +01:00
inet socket: Use may_alias on sockaddr structs (bug 19622) 2024-05-27 17:25:13 +02:00
intl Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
io Always define __USE_TIME_BITS64 when 64 bit time_t is used 2024-05-28 07:30:07 +02:00
libio Fix name space violation in fortify wrappers (bug 32052) 2024-08-06 08:21:58 +02:00
locale Define ISO 639-3 "ssy" (Saho) 2024-01-18 11:01:10 +01:00
localedata localedata: ssy_ER: Fix syntax error 2024-06-14 19:22:51 +01:00
login login: structs utmp, utmpx, lastlog _TIME_BITS independence (bug 30701) 2024-05-02 13:20:27 +02:00
mach mach: Drop some unnecessary vm_param.h includes 2024-01-03 21:59:54 +01:00
malloc malloc: add multi-threaded tests for aligned_alloc/calloc/malloc 2024-07-29 15:23:09 +02:00
manual manual/stdio: Further clarify putc, putwc, getc, and getwc 2024-08-06 13:47:49 +02:00
math math: remove exp10 wrappers 2024-01-12 16:02:12 +00:00
mathvec Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
misc Add mremap tests 2024-08-01 14:21:57 +02:00
nis Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
nptl Remove ia64-linux-gnu 2024-01-08 17:09:36 -03:00
nptl_db Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
nscd nscd: Use time_t for return type of addgetnetgrentX 2024-05-02 19:00:16 +02:00
nss getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163) 2024-01-02 11:10:42 +01:00
po po: Update translations 2024-01-31 01:10:02 +01:00
posix posix: Fix pidfd_spawn/pidfd_spawnp leak if execve fails (BZ 31695) 2024-06-25 13:51:16 -03:00
resolv resolv: Fix tst-resolv-short-response for older GCC (bug 32042) 2024-08-01 21:09:33 +02:00
resource Always define __USE_TIME_BITS64 when 64 bit time_t is used 2024-05-28 07:30:07 +02:00
rt Always define __USE_TIME_BITS64 when 64 bit time_t is used 2024-05-28 07:30:07 +02:00
scripts Adjust check-local-headers test for libaudit 4.0 2024-08-13 09:57:26 +02:00
setjmp Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
signal Always define __USE_TIME_BITS64 when 64 bit time_t is used 2024-05-28 07:30:07 +02:00
socket Fix name space violation in fortify wrappers (bug 32052) 2024-08-06 08:21:58 +02:00
soft-fp Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
stdio-common localedata: Use consistent values for grouping and mon_grouping 2024-01-25 11:41:02 +01:00
stdlib Fix name space violation in fortify wrappers (bug 32052) 2024-08-06 08:21:58 +02:00
string x86: Fix bug in strchrnul-evex512 [BZ #32078] 2024-08-15 13:26:05 -07:00
sunrpc Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
support support: Add options list terminator to the test driver 2024-08-09 17:26:41 +02:00
sysdeps x86: Fix bug in strchrnul-evex512 [BZ #32078] 2024-08-15 13:26:05 -07:00
sysvipc Always define __USE_TIME_BITS64 when 64 bit time_t is used 2024-05-28 07:30:07 +02:00
termios Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
time Always define __USE_TIME_BITS64 when 64 bit time_t is used 2024-05-28 07:30:07 +02:00
timezone Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
wcsmbs Fix name space violation in fortify wrappers (bug 32052) 2024-08-06 08:21:58 +02:00
wctype Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
.clang-format Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
.gitattributes Assume __NR_openat is always defined 2016-03-23 23:35:08 +01:00
.gitignore Add *.pyc to .gitignore 2015-05-18 15:26:26 +05:30
abi-tags Remove the bulk of the NaCl port. 2017-05-20 08:09:10 -04:00
aclocal.m4 configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
ADVISORIES Replace advisories directory 2024-01-31 02:12:43 +01:00
config.h.in x86: Define MINIMUM_X86_ISA_LEVEL in config.h [BZ #31676] 2024-04-25 13:16:51 +02:00
config.make.in crypt: Remove libcrypt support 2023-10-30 13:03:59 -03:00
configure elf: Enable TLS descriptor tests on aarch64 2024-04-01 11:16:32 -07:00
configure.ac elf: Enable TLS descriptor tests on aarch64 2024-04-01 11:16:32 -07:00
CONTRIBUTED-BY crypt: Remove libcrypt support 2023-10-30 13:03:59 -03:00
COPYING Update to latest versions of GPL-2.0 and LGPL-2.1 2013-09-09 12:52:48 +10:00
COPYING.LIB Update to latest versions of GPL-2.0 and LGPL-2.1 2013-09-09 12:52:48 +10:00
extra-lib.mk Rename cppflags-iterator.mk to libof-iterator.mk, remove extra-modules.mk. 2017-05-09 07:06:29 -04:00
gen-locales.mk Improve gen-locales.mk and gen-locale.sh to make test files with @ options work 2018-02-27 17:01:57 +01:00
INSTALL INSTALL, install.texi: minor updates, regenerate 2024-01-31 00:13:43 +01:00
libc-abis riscv: support GNU indirect function 2021-01-10 21:25:13 -05:00
libof-iterator.mk Rename cppflags-iterator.mk to libof-iterator.mk, remove extra-modules.mk. 2017-05-09 07:06:29 -04:00
LICENSES Relicense IBM portions of resolv/base64.c resolv/res_debug.c. 2024-01-26 13:33:36 -05:00
MAINTAINERS Add MAINTAINERS 2017-05-11 13:38:30 -04:00
Makeconfig Force DT_RPATH for --enable-hardcoded-path-in-tests 2024-05-10 04:59:46 -07:00
Makefile Add a test to check for duplicate definitions in the static library 2024-05-04 13:29:48 +01:00
Makefile.help Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
Makefile.in New make target to only build benchmark binaries 2016-04-20 10:23:28 +05:30
Makerules Remove installed header rule on $(..)include/%.h 2024-01-09 10:35:37 -08:00
NEWS Fix name space violation in fortify wrappers (bug 32052) 2024-08-06 08:21:58 +02:00
o-iterator.mk Fri Mar 17 12:58:37 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> 1995-03-17 18:42:51 +00:00
README Remove ia64-linux-gnu 2024-01-08 17:09:36 -03:00
Rules Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
SECURITY.md Adapt the security policy for the security page 2023-12-05 09:15:10 -05:00
SHARED-FILES crypt: Remove libcrypt support 2023-10-30 13:03:59 -03:00
shlib-versions crypt: Remove libcrypt support 2023-10-30 13:03:59 -03:00
test-skeleton.c Update copyright dates with scripts/update-copyrights 2024-01-01 10:53:40 -08:00
version.h version.h, include/features.h: Bump version to 2.39 2024-01-31 01:29:11 +01:00

This directory contains the sources of the GNU C Library.
See the file "version.h" for what release version you have.

The GNU C Library is the standard system C library for all GNU systems,
and is an important part of what makes up a GNU system.  It provides the
system API for all programs written in C and C-compatible languages such
as C++ and Objective C; the runtime facilities of other programming
languages use the C library to access the underlying operating system.

In GNU/Linux systems, the C library works with the Linux kernel to
implement the operating system behavior seen by user applications.
In GNU/Hurd systems, it works with a microkernel and Hurd servers.

The GNU C Library implements much of the POSIX.1 functionality in the
GNU/Hurd system, using configurations i[4567]86-*-gnu and x86_64-gnu.

When working with Linux kernels, this version of the GNU C Library
requires Linux kernel version 3.2 or later.

Also note that the shared version of the libgcc_s library must be
installed for the pthread library to work correctly.

The GNU C Library supports these configurations for using Linux kernels:

	aarch64*-*-linux-gnu
	alpha*-*-linux-gnu
	arc*-*-linux-gnu
	arm-*-linux-gnueabi
	csky-*-linux-gnuabiv2
	hppa-*-linux-gnu
	i[4567]86-*-linux-gnu
	x86_64-*-linux-gnu	Can build either x86_64 or x32
	loongarch64-*-linux-gnu Hardware floating point, LE only.
	m68k-*-linux-gnu
	microblaze*-*-linux-gnu
	mips-*-linux-gnu
	mips64-*-linux-gnu
	or1k-*-linux-gnu
	powerpc-*-linux-gnu	Hardware or software floating point, BE only.
	powerpc64*-*-linux-gnu	Big-endian and little-endian.
	s390-*-linux-gnu
	s390x-*-linux-gnu
	riscv32-*-linux-gnu
	riscv64-*-linux-gnu
	sh[34]-*-linux-gnu
	sparc*-*-linux-gnu
	sparc64*-*-linux-gnu

If you are interested in doing a port, please contact the glibc
maintainers; see https://www.gnu.org/software/libc/ for more
information.

See the file INSTALL to find out how to configure, build, and install
the GNU C Library.  You might also consider reading the WWW pages for
the C library at https://www.gnu.org/software/libc/.

The GNU C Library is (almost) completely documented by the Texinfo manual
found in the `manual/' subdirectory.  The manual is still being updated
and contains some known errors and omissions; we regret that we do not
have the resources to work on the manual as much as we would like.  For
corrections to the manual, please file a bug in the `manual' component,
following the bug-reporting instructions below.  Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.

Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
information.  We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.

The GNU C Library is free software.  See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
these additional notices to be distributed.  License copyright years may be
listed using range notation, e.g., 1996-2015, indicating that every year in
the range, inclusive, is a copyrightable year that would otherwise be listed
individually.