48 Commits

Author SHA1 Message Date
Andreas Arnez
38acc04ac2 Bug 454040 - Add intercept for memmem on s390x
Memcheck may report false positives in an optimized version of memmem on
s390x, specifically on arch13 systems.  Prevent this by adding an
intercept for memmem on s390x platforms.
2022-07-07 14:23:06 +02:00
Paul Floyd
4fb52a67b5 Cleanup of str* and mem* functions
Add function checks to configure.ac
Use the configure HAVE_ macro rather than OS-dependent tests.
I suspect that a lot of the tests hve been obsolete for many
years. Add wrappers to FreeBSD.
:w
2022-06-01 22:09:50 +02:00
Mike Crowe
947388eb04 Intercept strncmp for glibc ld.so v2.28+
In glibc 5aad5f617892e75d91d4c8fb7594ff35b610c042 (first released in
v2.28) a call to strncmp was added to dl-load.c:is_dst. This causes
valgrind to complain about glibc's highly-optimised strncmp performing
sixteen-byte reads on short strings in ld.so. Let's intercept strncmp in
ld.so too so we use valgrind's simple version to avoid this problem.
2022-05-14 00:41:18 +02:00
Paul Floyd
53dd9bd255 FreeBSD support, patch 9
cachegrind callgrind dhat exp-bbv gdbserver_tests massif none mpi shared

Mostly these are just updates (and new testcases) under new/tests
The other directories have just #ifdef changes
2021-10-07 22:41:22 +02:00
Paul Floyd
a86016fc22 Fix dhat/tests/copy on Solaris 2020-12-08 21:29:43 +01:00
Nicholas Nethercote
8c08253b89 Add support for copy and ad hoc profiling to DHAT. 2020-12-07 19:57:56 +11:00
Nicholas Nethercote
d63b8ec7d4 Add a comment to previous commit. 2020-12-02 16:21:23 +11:00
Nicholas Nethercote
95470d249b Fix wcscpy wrapper.
wcscpy deals with wchar_t, which has a size of 4, so the adjustment in
the wrapper must be +4 instead of +1.
2020-12-02 16:18:06 +11:00
Mark Wielaard
461cc5c003 Cleanup GPL header address notices by using http://www.gnu.org/licenses/
Sync VEX/LICENSE.GPL with top-level COPYING file. We used 3 different
addresses for writing to the FSF to receive a copy of the GPL. Replace
all different variants with an URL <http://www.gnu.org/licenses/>.

The following files might still have some slightly different (L)GPL
copyright notice because they were derived from other programs:

- files under coregrind/m_demangle which come from libiberty:
  cplus-dem.c, d-demangle.c, demangle.h, rust-demangle.c,
  safe-ctype.c and safe-ctype.h
- coregrind/m_demangle/dyn-string.[hc] derived from GCC.
- coregrind/m_demangle/ansidecl.h derived from glibc.
- VEX files for FMA detived from glibc:
  host_generic_maddf.h and host_generic_maddf.c
- files under coregrin/m_debuginfo derived from LZO:
  lzoconf.h, lzodefs.h, minilzo-inl.c and minilzo.h
- files under coregrind/m_gdbserver detived from GDB:
  gdb/signals.h, inferiors.c, regcache.c, regcache.h,
  regdef.h, remote-utils.c, server.c, server.h, signals.c,
  target.c, target.h and utils.c

Plus the following test files:

- none/tests/ppc32/testVMX.c derived from testVMX.
- ppc tests derived from QEMU: jm-insns.c, ppc64_helpers.h
  and test_isa_3_0.c
- tests derived from bzip2 (with embedded GPL text in code):
  hackedbz2.c, origin5-bz2.c, varinfo6.c
- tests detived from glibc: str_tester.c, pth_atfork1.c
- test detived from GCC libgomp: tc17_sembar.c
- performance tests derived from bzip2 or tinycc (with embedded GPL
  text in code): bz2.c, test_input_for_tinycc.c and tinycc.c
2019-05-26 20:07:51 +02:00
Mark Wielaard
89423f5d8b Intercept stpcpy also in ld.so for arm64
On other arches stpcpy () is intercepted for both libc.so and ld.so.
But not on arm64, where it is only intercepted for libc.so.

This can cause memcheck warnings about the use of stpcpy () in ld.so
when called through dlopen () because ld.so contains its own copy of
that functions.

Fix by introducing VG_Z_LD_LINUX_AARCH64_SO_1 (the encoded name of
ld.so on arm64) and using that in vg_replace_strmem.c to intercept
stpcpy.

https://bugs.kde.org/show_bug.cgi?id=407307
2019-05-07 21:20:04 +02:00
Mark Wielaard
cf00e0e59d Bug 401627 - Add wcsncmp override and testcase.
glibc 2.28 added an avx2 optimized variant of wstrncmp which memcheck
cannot proof correct. Add a simple override in vg_replace_strmem.c.
2018-12-06 16:40:34 +01:00
Julian Seward
c182a3c875 MEMMOVE_OR_MEMCPY: unroll word-copying loops in the hope of a small speedup. 2018-03-09 18:51:39 +01:00
Nick Alcock
23185f46a1 Add replacements for wmemchr() and wcsnlen() on Linux.
These have gained ifunc support in recent glibc releases,
so need replacement.
Fixes BZ#388862

Patch by: Nix <nix@esperi.org.uk>
2018-03-02 16:24:26 +01:00
Tom Hughes
a5af4146e3 Avoid underflow in strlcpy and strlcat wrappers when count is zero
We can't decrement n because it's unsigned and might be zero which
means it would wrap and we'd wind up reading far too much.

Fixes BZ#208052
2017-11-14 09:16:26 +00:00
Philippe Waroquiers
c1eace647c Fix n-i-bz fix bug in strspn replacement
Mix-up between UChar and HChar in strspn.
Also grouped together the n-i-bz announded fixes in NEWS
2017-10-26 20:53:15 +02:00
Ivo Raisr
eed3a2d5d3 Add a replacement for __GI_strcspn() required on s390x/Linux.
Fixes BZ#380397.
Patch by: Andreas Arnez <arnez@linux.vnet.ibm.com>


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16436
2017-06-05 21:09:06 +00:00
Petar Jovanovic
8531fa9c3c mips32: remove false warnings on Android
Remove false warnings for strlen and strchr on Android.

Patch by Tamara Vlahovic.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16335
2017-05-05 14:36:46 +00:00
Ivo Raisr
38edd50c0e Update copyright end year to 2017 in preparation for 3.13 release.
n-i-bz



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16333
2017-05-04 15:09:39 +00:00
Ivo Raisr
7708e249b8 Support '%' in symbol Z-encoding.
Fixes BZ #371869.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16112
2016-11-02 21:50:19 +00:00
Julian Seward
32d0fc4be5 memset replacement: unroll vectorised loops.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15848
2016-04-04 12:33:35 +00:00
Mark Wielaard
8a8b65d1f2 Bug 359733 amd64 implement ld.so strchr/index override like x86
The suppression and redirection for ld.so strchr/index isn't needed for
x86. When testing a newer glibc or calling the ld.so through an alternative
path neither the suppression (doesn't match path/name) nor the redirection
(triggers too late) works. Since there is already an hardwire override for
strlen in amd64 ld.so anyway it makes sense to also hardware index (it is
always called when ld.so loads the preload images).

This was also explained in the easy hacks Fosdem session.
See https://bugs.kde.org/show_bug.cgi?id=359733 for a pointer.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15812
2016-02-24 11:12:01 +00:00
Rhys Kidd
2c1bd53275 Intercept platform_memchr$VARIANT$Haswell on OS X
bz#351756

On OS X 10.10 (without Haswell hardware)

Before:

== 595 tests, 215 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

After:

== 595 tests, 215 stderr failures, 9 stdout failures, 0 stderrB failures, 0 stdoutB failures, 30 post failures ==

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15596
2015-08-29 07:42:40 +00:00
Julian Seward
adc2dafee9 Update copyright dates, to include 2015. No functional change.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15577
2015-08-21 11:32:26 +00:00
Florian Krohm
5685245df0 Consistently use exit code 1 (== POSIX's EXIT_FAILURE) if things
go wrong. As we can tell from the error messages what whent wrong 
there is no need to have different exit codes to distinguish.
Spotted by Matthias Schwarzott.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15515
2015-08-09 20:29:18 +00:00
Julian Seward
ac60633d65 Bug 345248 - add support for Solaris OS in valgrind
Authors of this port:
    Petr Pavlu         setup@dagobah.cz
    Ivo Raisr          ivosh@ivosh.net
    Theo Schlossnagle  theo@omniti.com
            


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15426
2015-07-21 14:44:28 +00:00
Rhys Kidd
0fcd971d15 Preliminary support for OS X 10.11 (El Capitan). Refer BZ#348909 for ongoing work.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15403
2015-07-08 13:46:57 +00:00
Mark Wielaard
1aef4dc72c 349828 memcpy intercepts memmove causing src/dst overlap error (ppc64 ld.so)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15397
2015-07-07 13:01:39 +00:00
Rhys Kidd
a32cff8baf bz#347233 - Fix memcheck/tests/strchr on OS X 10.10 (Haswell)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15229
2015-05-14 13:03:08 +00:00
Rhys Kidd
d442b97795 Further fixes for bz#345394 specifically for OS X 10.10
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15038
2015-03-26 10:14:25 +00:00
Julian Seward
55a7b396f1 Followup to r14901 (vectorising memcmp): use SizeT instead of Addr
where appropriate.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14903
2015-02-04 18:46:11 +00:00
Julian Seward
bc14b1eb52 Vectorise the memcmp template implementation. For scenarios requiring
a lot of memcmp-ing (firefox reftests) this is measurably faster.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14901
2015-02-04 17:52:42 +00:00
Mark Wielaard
7d07a3deaf BZ #342795 Internal glibc __GI_mempcpy call should be intercepted.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14866
2015-01-13 16:10:20 +00:00
Julian Seward
df001848a7 OSX 10.10: intercept memchr in libsystem_platform.dylib.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14734
2014-11-19 09:14:07 +00:00
Julian Seward
fafcf8e893 Interceot _platform_strncmp also on OSX 10.10.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14712
2014-11-11 12:46:58 +00:00
Julian Seward
409c042298 Add some Mac OSX 10.10 specific wrappers.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14703
2014-11-07 00:08:13 +00:00
Julian Seward
b519f73307 Adds initial support for AArch64 (arm64) on Android. Small programs
(/system/bin/ls, /system/bin/date) run.  Still to do:

* enable more malloc/free intercepts

* enable wrappers for ashmem and binder syscalls

* check to see if any special ioctl support is required for ARM Mali GPUs



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14690
2014-11-04 17:44:21 +00:00
Florian Krohm
070ad41c3b Enable -Wcast-qual when compiling the valgrind source.
Testcases are not compiled with -Wcast-qual.
Introduce CONST_CAST macro to work around in the few spots
where a cast that drops type qualifiers is needed.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14652
2014-10-22 12:53:16 +00:00
Florian Krohm
c0869fe07c Change the return type of the replacement function for rawmemchr
to match that of glibc's rawmemchr. 


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14651
2014-10-22 12:06:22 +00:00
Florian Krohm
361909e022 Rewritten to avoid cast that drops const qualification.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14647
2014-10-21 17:15:14 +00:00
Julian Seward
ccb4fc056b Add intercepts on MacOS 10.9 for
libsystem_c.dylib:strrchr
libsystem_platform.dylib:_platform_memmove$VARIANT$Ivybridge


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14635
2014-10-17 15:07:37 +00:00
Philippe Waroquiers
44cc7cb053 Fix name of the file in the header comment
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14170
2014-07-16 21:16:10 +00:00
Julian Seward
9784fb846c Intercept libsystem_platform.dylib:_platform_strncmp and dyld:memchr
on OSX 10.9.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14099
2014-06-25 11:17:46 +00:00
Julian Seward
3534b0f75d OS X 10.9: Add redirections for strnlen, strcpy, strncpy,
platform_memchr, _platform_memcmp.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14086
2014-06-23 16:03:45 +00:00
Julian Seward
8f5dd4219c OS X 10.9: add intercepts for
libsystem_platform.dylib : _platform_strchr
libsystem_c.dylib : strlen
libsystem_platform.dylib : _platform_strcmp



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14073
2014-06-21 09:40:19 +00:00
Bart Van Assche
ac9c8e1a37 strmem intercepts: Add mempcpy() intercepts for ld-linux on x86
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13874
2014-03-15 12:47:28 +00:00
Mark Wielaard
f68b1089a7 Make sure all files under the new shared dir are included in make dist.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13868
2014-03-11 19:30:32 +00:00
Dejan Jevtic
423d0643b9 mips32: Adding mips32/Android support to Valgrind.
Necessary changes to Valgrind to support mips32 on Android.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13767
2013-12-27 09:06:55 +00:00
Bart Van Assche
39c447e4a9 Merge mc_replace_strmem.c, hg_intercepts.c and drd_strmem_intercepts.c
Move memcheck/mc_replace_strmem.c to shared/vg_replace_strmem.c and
add several intercepts for SSE-variants. Include that source file from
drd/drd_strmem_intercepts.c, helgrind/hg_intercepts.c and
memcheck/mc_replace_strmem.c.

Merge memcheck/tests/filter_memcpy into tests/filter_stderr_basic.
    
Update tests/check_headers_and_includes.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13719
2013-11-24 17:48:13 +00:00