glibc/sysdeps/x86_64
Adhemerval Zanella 3daef2c8ee Fix x86_64 memchr for large input sizes
Current optimized memchr for x86_64 does for input arguments pointers
module 64 in range of [49,63] if there is no searchr char in the rest
of 64-byte block a pointer addition which might overflow:

* sysdeps/x86_64/memchr.S

    77          .p2align 4
    78  L(unaligned_no_match):
    79          add     %rcx, %rdx

Add (uintptr_t)s % 16 to n in %rdx.

    80          sub     $16, %rdx
    81          jbe     L(return_null)

This patch fixes by adding a saturated math that sets a maximum pointer
value if it overflows (UINTPTR_MAX).

Checked on x86_64-linux-gnu and powerpc64-linux-gnu.

	[BZ# 19387]
	* sysdeps/x86_64/memchr.S (memchr): Avoid overflow in pointer
	addition.
	* string/test-memchr.c (do_test): Remove alignment limitation.
	(test_main): Add test that trigger BZ# 19387.
2016-12-27 10:50:41 -02:00
..
64 Move architecture shlib-versions files to Linux-specific directories. 2014-07-17 14:31:12 +00:00
fpu Fix x86, x86_64 fmax, fmin sNaN handling, add tests (bug 20947). 2016-12-15 23:52:18 +00:00
multiarch Require binutils 2.24 to build x86-64 glibc [BZ #20139] 2016-07-01 06:03:05 -07:00
nptl Remove cached PID/TID in clone 2016-11-24 19:38:51 -02:00
x32 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
____longjmp_chk.S ____longjmp_chk is now OS-specific. 2009-07-30 21:42:27 -07:00
__longjmp.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
_mcount.S 2016-03-03 Paul Pluzhnikov <ppluzhnikov@google.com> 2016-03-03 09:53:49 -08:00
abort-instr.h Update. 2001-09-19 10:37:31 +00:00
add_n.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
addmul_1.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
atomic-machine.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
backtrace.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bsd-_setjmp.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bsd-setjmp.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
bzero.S Make an empty file. 2007-10-16 05:59:15 +00:00
configure Require binutils 2.24 to build x86-64 glibc [BZ #20139] 2016-07-01 06:03:05 -07:00
configure.ac Require binutils 2.24 to build x86-64 glibc [BZ #20139] 2016-07-01 06:03:05 -07:00
crti.S Replace PREINIT_FUNCTION@PLT with *%rax in call 2016-03-04 16:15:41 -08:00
crtn.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
dl-irel.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
dl-lookupcfg.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
dl-machine.h Check IFUNC definition in unrelocated shared library [BZ #20019] 2016-10-28 09:12:15 -07:00
dl-procinfo.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
dl-runtime.c * elf/dl-runtime.c (reloc_offset): Define. 2009-03-15 00:26:14 +00:00
dl-tls.h elf: Consolidate machine-agnostic DTV definitions in <dl-dtv.h> 2016-06-20 14:31:40 +02:00
dl-tlsdesc.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
dl-tlsdesc.S x86-64: Properly align stack in _dl_tlsdesc_dynamic [BZ #20309] 2016-07-12 06:30:08 -07:00
dl-trampoline.h X86-64: Add _dl_runtime_resolve_avx[512]_{opt|slow} [BZ #20508] 2016-09-06 08:51:07 -07:00
dl-trampoline.S X86-64: Add _dl_runtime_resolve_avx[512]_{opt|slow} [BZ #20508] 2016-09-06 08:51:07 -07:00
ffs.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ffsll.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
hp-timing.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
htonl.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ifuncmain8.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
ifuncmod8.c Do not stack-protect ifunc resolvers [BZ #7065] 2016-12-26 10:08:41 +01:00
Implies Use x86-64 bits/byteswap.h for both i386 and x86_64 2012-05-30 14:13:18 -07:00
jmpbuf-offsets.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
l10nflist.c Minor optimization of popcount in l10nflist 2011-08-11 14:07:04 -04:00
ldbl2mpn.c [BZ #4586] 2007-06-08 02:50:59 +00:00
ldsodefs.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
link-defines.sym Replace __int128 with __int128_t 2014-05-30 10:50:21 -07:00
locale-defines.sym Implement optimized strcaecmp for x86-64. 2010-07-30 00:14:04 -07:00
localplt.data ld.so: Remove __libc_memalign 2016-11-30 16:23:58 +01:00
lshift.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
machine-gmon.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Makefile x86_64: tst-quad1pie, tst-quad2pie: compile with -fPIE [BZ #7065] 2016-12-21 12:04:12 +01:00
memchr.S Fix x86_64 memchr for large input sizes 2016-12-27 10:50:41 -02:00
memcmp.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memcopy.h X86-64: Add dummy memcopy.h and wordcopy.c 2016-06-09 04:38:34 -07:00
memcpy_chk.S x86_64: fix static build of __memcpy_chk for compilers defaulting to PIC/PIE 2016-11-24 16:56:26 +01:00
memcpy.S X86-64: Remove previous default/SSE2/AVX2 memcpy/memmove 2016-06-08 13:58:08 -07:00
memmove_chk.S X86-64: Remove previous default/SSE2/AVX2 memcpy/memmove 2016-06-08 13:58:08 -07:00
memmove.S X86-64: Remove previous default/SSE2/AVX2 memcpy/memmove 2016-06-08 13:58:08 -07:00
mempcpy_chk.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mempcpy.S X86-64: Remove previous default/SSE2/AVX2 memcpy/memmove 2016-06-08 13:58:08 -07:00
memrchr.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memset_chk.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
memset.S X86-64: Remove the previous SSE2/AVX2 memsets 2016-06-08 13:56:14 -07:00
memusage.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
mp_clz_tab.c * sysdeps/x86_64/mp_clz_tab.c: New file. 2009-04-15 04:30:41 +00:00
mul_1.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
preconfigure rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
preconfigure.ac rename configure.in to configure.ac 2013-10-30 17:32:08 +10:00
rawmemchr.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
rshift.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
sched_cpucount.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
setjmp.S Call x86-64 __mcount_internal/__sigjmp_save directly 2016-03-01 16:58:07 -08:00
stack-aliasing.h Clean up stack-coloring macros. 2014-06-20 19:50:16 -07:00
stackguard-macros.h BZ #15754: CVE-2013-4788 2013-09-23 00:52:09 -04:00
stackinfo.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
start.S Always indirect branch to __libc_start_main via GOT 2016-06-09 04:43:31 -07:00
stpcpy.S Update. 2004-05-28 06:56:51 +00:00
strcasecmp_l-nonascii.c Remove pre-ISO C support 2012-01-07 23:57:22 -05:00
strcasecmp_l.S Implement optimized strcaecmp for x86-64. 2010-07-30 00:14:04 -07:00
strcasecmp.S Implement optimized strcaecmp for x86-64. 2010-07-30 00:14:04 -07:00
strcat.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strchr.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strchrnul.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcmp.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcpy.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strcspn.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strlen.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strncase_l-nonascii.c Remove pre-ISO C support 2012-01-07 23:57:22 -05:00
strncase_l.S Add optimized strncasecmp versions for x86-64. 2010-08-14 22:04:01 -07:00
strncase.S Add optimized strncasecmp versions for x86-64. 2010-08-14 22:04:01 -07:00
strncmp.S Add SSE2 support to str{,n}cmp for x86-64. 2009-07-26 13:32:28 -07:00
strnlen.S Faster strlen on x64. 2013-03-18 07:39:12 +01:00
strpbrk.S Update. 2002-08-31 17:45:33 +00:00
strrchr.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strspn.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strtok_r.S Remove bounded-pointers handling from x86_64 assembly sources. 2013-02-17 21:57:26 +00:00
strtok.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
sub_n.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
submul_1.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
sysdep.h X86_64: Don't use PLT nor GOT in static archives [BZ #20750] 2016-11-28 09:45:07 -08:00
tls-macros.h Split tls-macros.h into sysdeps directories. 2012-07-17 11:30:58 +00:00
tlsdesc.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tlsdesc.sym Introduce TLS descriptors for i386 and x86_64. 2008-05-13 05:41:30 +00:00
tst-audit3.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-audit4-aux.c tst-audit4, tst-audit10: Compile AVX/AVX-512 code separately [BZ #19269] 2016-03-07 16:00:25 +01:00
tst-audit4.c tst-audit4, tst-audit10: Compile AVX/AVX-512 code separately [BZ #19269] 2016-03-07 16:00:25 +01:00
tst-audit5.c Modify several tests to use test-skeleton.c 2014-11-05 15:24:08 +05:30
tst-audit6.c Modify several tests to use test-skeleton.c 2015-07-15 15:10:23 +05:30
tst-audit7.c Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
tst-audit10-aux.c Fix tst-audit10 build when -mavx512f is not supported. 2016-03-08 12:32:59 -08:00
tst-audit10.c tst-audit10: Fix compilation on compilers without bit_AVX512F [BZ #19860] 2016-03-25 11:11:42 +01:00
tst-audit.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-auditmod3a.c Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
tst-auditmod3b.c Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
tst-auditmod4a.c Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
tst-auditmod4b.c Add la_symbind32 to x86-64 audit tests 2015-07-07 06:09:29 -07:00
tst-auditmod5a.c Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
tst-auditmod5b.c Add la_symbind32 to x86-64 audit tests 2015-07-07 06:09:29 -07:00
tst-auditmod6a.c Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
tst-auditmod6b.c Add la_symbind32 to x86-64 audit tests 2015-07-07 06:09:29 -07:00
tst-auditmod6c.c Add la_symbind32 to x86-64 audit tests 2015-07-07 06:09:29 -07:00
tst-auditmod7a.c Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
tst-auditmod7b.c Add la_symbind32 to x86-64 audit tests 2015-07-07 06:09:29 -07:00
tst-auditmod10a.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-auditmod10b.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-mallocalign1.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-quad1.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-quad1pie.c Handle R_X86_64_RELATIVE64 and R_X86_64_64 for x32 2012-05-10 17:05:06 -07:00
tst-quad2.c Handle R_X86_64_RELATIVE64 and R_X86_64_64 for x32 2012-05-10 17:05:06 -07:00
tst-quad2pie.c Handle R_X86_64_RELATIVE64 and R_X86_64_64 for x32 2012-05-10 17:05:06 -07:00
tst-quadmod1.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-quadmod1pie.S Handle R_X86_64_RELATIVE64 and R_X86_64_64 for x32 2012-05-10 17:05:06 -07:00
tst-quadmod2.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-quadmod2pie.S Handle R_X86_64_RELATIVE64 and R_X86_64_64 for x32 2012-05-10 17:05:06 -07:00
tst-split-dynreloc.c Fix dynamic linker issue with bind-now 2015-08-19 05:37:01 -07:00
tst-split-dynreloc.lds Fix dynamic linker issue with bind-now 2015-08-19 05:37:01 -07:00
tst-stack-align.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Versions Work around old buggy program which cannot cope with memcpy semantics. 2011-04-01 19:38:21 -04:00
wcschr.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcscmp.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcslen.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wcsrchr.S Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
wordcopy.c X86-64: Add dummy memcopy.h and wordcopy.c 2016-06-09 04:38:34 -07:00