]> sourceware.org Git - valgrind.git/log
valgrind.git
20 months agoDarwin: add support for setting errno from alloc wrappers
Paul Floyd [Sun, 2 Apr 2023 09:06:18 +0000 (11:06 +0200)]
Darwin: add support for setting errno from alloc wrappers

20 months agoRegtest: fixes for callgrind tests referring to cachegrind reference files
Paul Floyd [Sun, 2 Apr 2023 08:12:17 +0000 (10:12 +0200)]
Regtest: fixes for callgrind tests referring to cachegrind reference files

cachegrind/tests/cgout-test was renamed to ann1.cgout but the
two tests in callgrind that use it weren't updated.

20 months agoCommit access and try branches
Mark Wielaard [Sat, 1 Apr 2023 21:58:14 +0000 (23:58 +0200)]
Commit access and try branches

20 months agoDarwin: try to improve posix_memalign / zone_memalign wrapper
Paul Floyd [Sat, 1 Apr 2023 20:28:36 +0000 (22:28 +0200)]
Darwin: try to improve posix_memalign / zone_memalign wrapper

It still doesn't set errno though.

20 months agoDarwin regtest: another test using aligned_alloc
Paul Floyd [Sat, 1 Apr 2023 19:11:58 +0000 (21:11 +0200)]
Darwin regtest: another test using aligned_alloc

I added this test because I wanted to check the behaviour of
aligned_alloc on current macOS, but Valgrind doesn't support it
yet.

20 months agoDarwin regtest: fix building on older OS versions
Paul Floyd [Sat, 1 Apr 2023 18:55:22 +0000 (20:55 +0200)]
Darwin regtest: fix building on older OS versions

aligned_alloc was added to macOS 10.15 and 10.13 is the latest
that we support.

20 months agoMUSL regtest: fix a comple of build problems building regression tests on Alpine
Paul Floyd [Fri, 31 Mar 2023 11:39:34 +0000 (13:39 +0200)]
MUSL regtest: fix a comple of build problems building regression tests on Alpine

21 months agoRegtest: fix a couple of unused variable warnings
Paul Floyd [Fri, 31 Mar 2023 11:17:10 +0000 (13:17 +0200)]
Regtest: fix a couple of unused variable warnings

Copy & paste leftovers

21 months agoRemove source file added to EXTRA_DIST in error
Paul Floyd [Fri, 31 Mar 2023 10:41:40 +0000 (12:41 +0200)]
Remove source file added to EXTRA_DIST in error

21 months agoAdd missing entries to cachegrind EXTRA_DIST
Paul Floyd [Fri, 31 Mar 2023 10:09:45 +0000 (12:09 +0200)]
Add missing entries to cachegrind EXTRA_DIST

21 months agoPropagate memory allocation failure to out_of_memory_NORETURN
Mark Wielaard [Sun, 22 Jan 2023 22:18:18 +0000 (23:18 +0100)]
Propagate memory allocation failure to out_of_memory_NORETURN

Provide the user with a hint of what caused an out of memory error.
And explain that some memory policies, like selinux deny_execmem
might cause Permission denied errors.

Add an err argument to out_of_memory_NORETURN. And change
am_shadow_alloc to return a SysRes (all three callers were already
checking for errors and calling out_of_memory_NORETURN).

21 months agocg_annotate: use `<unspecified>` for an unspecified filename.
Nicholas Nethercote [Tue, 28 Mar 2023 22:15:56 +0000 (09:15 +1100)]
cg_annotate: use `<unspecified>` for an unspecified filename.

Users shouldn't ever see this, but it's useful to distinguish this
malformed data file case from the missing symbol case (which is still
shown as `???`).

21 months agocg_annotate.in: fix a small bug in the printing of past-the-end lines.
Nicholas Nethercote [Tue, 28 Mar 2023 06:22:42 +0000 (17:22 +1100)]
cg_annotate.in: fix a small bug in the printing of past-the-end lines.

21 months agoFix some problems in `cachegrind/tests/Makefile.am`.
Nicholas Nethercote [Tue, 28 Mar 2023 05:13:27 +0000 (16:13 +1100)]
Fix some problems in `cachegrind/tests/Makefile.am`.

21 months agoSimpler and more consistent `cachegrind/tests/*.vgtest` files.
Nicholas Nethercote [Tue, 28 Mar 2023 04:44:34 +0000 (15:44 +1100)]
Simpler and more consistent `cachegrind/tests/*.vgtest` files.

- Always use `python3`, never `python`.
- Avoid unnecessary `../cachegrind/` in paths.

21 months agoRewrite `cg_merge` in Python.
Nicholas Nethercote [Mon, 27 Mar 2023 06:27:56 +0000 (17:27 +1100)]
Rewrite `cg_merge` in Python.

It's currently written in C, but `cg_annotate` and `cg_diff` are written in
Python. It's better to have them all in the same language.

The good news is that the Python code is 4.5x shorter than the C code.
The bad news is that the Python code is roughly 3x slower than the C
code. But `cg_merge` isn't used that often, so I think it's a reasonable
trade-off.

21 months agoRewrite `cg_diff` in Python.
Nicholas Nethercote [Fri, 24 Mar 2023 12:50:49 +0000 (23:50 +1100)]
Rewrite `cg_diff` in Python.

For all the same reasons I rewrote `cg_annotate` in Python.

The commit also moves the Python "build" steps into
`auxprogs/pybuild.sh`, for easy sharing.

Finally, it very slightly tweaks the whitespace in the output of
`cg_annotate`.

21 months agoRename `ann-diff` test as `ann-diff1`.
Nicholas Nethercote [Sun, 26 Mar 2023 23:47:27 +0000 (10:47 +1100)]
Rename `ann-diff` test as `ann-diff1`.

To make room for another test.

21 months agoMake section formatting more consistent.
Nicholas Nethercote [Thu, 23 Mar 2023 08:36:47 +0000 (19:36 +1100)]
Make section formatting more consistent.

- Every section now has a heading with the long `----` lines above and
  below.
- Event names are always shown below that heading, rather than within
  it.
- Each Unreadable file now gets its own section, much like files that
  lack any data.

21 months agoRename a bunch of `cg_annotate` test files.
Nicholas Nethercote [Thu, 23 Mar 2023 03:04:53 +0000 (14:04 +1100)]
Rename a bunch of `cg_annotate` test files.

For more consistency.

21 months agoSolaris: improve syscall trace for sysfs
Paul Floyd [Sun, 26 Mar 2023 16:21:42 +0000 (18:21 +0200)]
Solaris: improve syscall trace for sysfs

More than just fix the format warning

21 months agoRegtest: put back a glibc version ofr memalign_args test
Paul Floyd [Sun, 26 Mar 2023 15:05:25 +0000 (17:05 +0200)]
Regtest: put back a glibc version ofr memalign_args test

I forgot that glibc aligned_alloc really is memalign, which
changes the callstack.

21 months agoRegtest: add a filter for aligned alloc uninit args tests
Paul Floyd [Sun, 26 Mar 2023 14:37:56 +0000 (16:37 +0200)]
Regtest: add a filter for aligned alloc uninit args tests

These tests generate a varying number of errors per argument
depending on the platform and compiler.

The filter just prints the first unique error stanza which
allows 8 expecteds to be removed.

21 months agoSolaris: format warnings in syswrap functions
Paul Floyd [Sun, 26 Mar 2023 08:48:08 +0000 (10:48 +0200)]
Solaris: format warnings in syswrap functions

21 months agoRegtest: clean aligned alloc tests on FreeBSD x86
Paul Floyd [Sat, 25 Mar 2023 18:52:41 +0000 (19:52 +0100)]
Regtest: clean aligned alloc tests on FreeBSD x86

Add a filter for size_t (unsigned long on 64bit platforms and unsigned
int on 32bit ones).

Add another expected for x86.

21 months agoAdd more annotated/unannotated lines at the end.
Nicholas Nethercote [Tue, 21 Mar 2023 02:58:40 +0000 (13:58 +1100)]
Add more annotated/unannotated lines at the end.

This way, all CCs are categorised, which is useful for understanding
why thing were/weren't annotated.

21 months agoChange `Threshold:` to `Thresholds:`.
Nicholas Nethercote [Tue, 21 Mar 2023 00:58:36 +0000 (11:58 +1100)]
Change `Threshold:` to `Thresholds:`.

Because all the thresholds other than the first one were always 100, due
to historical reasons.

21 months agoJust use one decimal place for all percentages.
Nicholas Nethercote [Tue, 21 Mar 2023 00:04:25 +0000 (11:04 +1100)]
Just use one decimal place for all percentages.

Simpler, shorter, and good enough in practice.

21 months agoImprove formatting of percentage columns.
Nicholas Nethercote [Mon, 20 Mar 2023 02:58:04 +0000 (13:58 +1100)]
Improve formatting of percentage columns.

Currently their width is mostly hard-wired in a quick and dirty fashion.
This commit does them properly, so:
- all columns are always the right width, even ones with really large
  percentages
- things like `( 1.00%)` are now `(1.00%)`
- any percentages that would involve a division by zero now show as
  `(n/a)` rather than `( 0.00%)`

21 months agoMake `cg_annotate` work with Python 3.9, by avoiding `TypeAlias`.
Nicholas Nethercote [Wed, 22 Mar 2023 22:50:21 +0000 (09:50 +1100)]
Make `cg_annotate` work with Python 3.9, by avoiding `TypeAlias`.

21 months agoMake cg_annotate independent of python3 install location
Paul Floyd [Wed, 22 Mar 2023 19:43:30 +0000 (20:43 +0100)]
Make cg_annotate independent of python3 install location

21 months agocachegrind/tests/Makefile.am EXTRA_DIST add ann3.{{post,stderr}.exp,vgtest}
Mark Wielaard [Wed, 22 Mar 2023 10:41:53 +0000 (11:41 +0100)]
cachegrind/tests/Makefile.am EXTRA_DIST add ann3.{{post,stderr}.exp,vgtest}

21 months agoRewrite `cg_annotate` in Python.
Nicholas Nethercote [Thu, 9 Mar 2023 04:41:31 +0000 (15:41 +1100)]
Rewrite `cg_annotate` in Python.

Perl was a reasonable choice for `cg_annotate` in 2002, but not in 2023.
Also, the existing structure of the code is not good. These two things
make it hard to modify `cg_annotate` in any significant way.

Benefits of the change:
- Now written in a language that is (a) nice, and (b) not moribund.
- Easier to maintain, due to (a) abovementioned better language, (b)
  better code structure, and (c) better language tooling, such as
  formatters, type checkers, and linters.
- The new version is a little shorter.
- It runs about 2x faster.
- Argument handling is more standard. E.g. things like `--context 2`,
  `--auto`, `--no-auto` are supported. (The old forms that require `=`
  are still supported, though the `=yes`/`=no` forms are deprecated.)

The behaviour and output of the new version is identical for typical
uses, but there are some very minor changes for edge cases, which nobody
is likely to notice. For example:
- The file format is slightly changed: I removed support for '.'
  counts, which had the same meaning as '0'. This was a feature that
  Cachegrind never used, and the old script handled it inconsistently.
- The new version will abort on a malformed data line. The old version
  would just print a warning and continue.

The commit also adds a new test `ann3` that tests many parts of
`cg_annotate` that weren't tested previously, and tweaks the existing
`ann2` test.

21 months agoSolaris: fix build, another aligned alloc typo
Paul Floyd [Tue, 21 Mar 2023 21:11:11 +0000 (22:11 +0100)]
Solaris: fix build, another aligned alloc typo

21 months agoBug 467482 - Build failure on aarch64 Alpine
Paul Floyd [Fri, 17 Mar 2023 18:48:08 +0000 (19:48 +0100)]
Bug 467482 - Build failure on aarch64 Alpine

Patch submitted by
fanquake@gmail.com

21 months agocoverity: a couple of potential buffer overruns
Paul Floyd [Sun, 12 Mar 2023 10:12:29 +0000 (11:12 +0100)]
coverity: a couple of potential buffer overruns

21 months agocoverity: printf args format mismatch
Paul Floyd [Sun, 12 Mar 2023 08:39:35 +0000 (09:39 +0100)]
coverity: printf args format mismatch

21 months agocoverity: copy paste error
Paul Floyd [Sun, 12 Mar 2023 08:22:10 +0000 (09:22 +0100)]
coverity: copy paste error

21 months agoFreeBSD: fix a syswrap compiler warning
Paul Floyd [Sun, 12 Mar 2023 07:21:55 +0000 (08:21 +0100)]
FreeBSD: fix a syswrap compiler warning

21 months agoregtest: add an s390 expected for sized_aligned_new_delete_args
Paul Floyd [Sun, 12 Mar 2023 07:20:57 +0000 (08:20 +0100)]
regtest: add an s390 expected for sized_aligned_new_delete_args

21 months agodoc: Add asan equivalent to --realloc-zero-bytes-frees to manual-core
Paul Floyd [Sat, 11 Mar 2023 15:47:56 +0000 (16:47 +0100)]
doc: Add asan equivalent to --realloc-zero-bytes-frees to manual-core

21 months agoRefactor: reorder a few structs to make them more compact
Paul Floyd [Sat, 11 Mar 2023 15:31:43 +0000 (16:31 +0100)]
Refactor: reorder a few structs to make them more compact

Used pahole to find candidates. Don't have any performance
measurements, but it won't do any harm.

21 months agoregtest: update one expected after fixing realloc_size_zero_mismatch.cpp
Paul Floyd [Sat, 11 Mar 2023 07:07:06 +0000 (08:07 +0100)]
regtest: update one expected after fixing realloc_size_zero_mismatch.cpp

21 months agoregtest: build failure on Linux ppc64le, missing header
Paul Floyd [Sat, 11 Mar 2023 05:49:13 +0000 (06:49 +0100)]
regtest: build failure on Linux ppc64le, missing header

21 months agoBug 436413 - Warn about realloc of size zero
Paul Floyd [Fri, 10 Mar 2023 20:55:14 +0000 (21:55 +0100)]
Bug 436413 - Warn about realloc of size zero

Adds a new warning to memcheck when realloc is used with a size of 0.
For a long time this has been "implementation defined" and so
non-portable. With C23 it will become UB.

Also adds a switch to turn off the error generation and a
second switch to select between the most common
"implementation" behaviours. The defaults for this second
switch are baked in at build time.

21 months agoRename memcheck/tests/sized_aligned_new_delete_args.stderr.exp-glibc
Paul Floyd [Fri, 10 Mar 2023 17:41:26 +0000 (18:41 +0100)]
Rename memcheck/tests/sized_aligned_new_delete_args.stderr.exp-glibc

It's for GCC / libstdc++ really

21 months agodarwin regtest: fix unused variable warning
Paul Floyd [Fri, 10 Mar 2023 17:39:05 +0000 (18:39 +0100)]
darwin regtest: fix unused variable warning

Copied and paster from old posix_memalign test

21 months agoMised one aligned alloc wrapper on Linux
Paul Floyd [Fri, 10 Mar 2023 07:40:40 +0000 (08:40 +0100)]
Mised one aligned alloc wrapper on Linux

Need different expected for GCC / libstdc++

And I think that the 32bit expected will also need updating.

21 months agoMalloc replacements: add some C++14/17 comments
Paul Floyd [Thu, 9 Mar 2023 19:58:12 +0000 (20:58 +0100)]
Malloc replacements: add some C++14/17 comments

Rearrange the code to group C++ 14 operator deeltes together.

21 months agoregtest: try to fix bad merge of memalign_args expected on ppc64
Paul Floyd [Thu, 9 Mar 2023 07:31:12 +0000 (08:31 +0100)]
regtest: try to fix bad merge of memalign_args expected on ppc64

21 months agoregtest: update sized_aligned_new_delete_args expected
Paul Floyd [Thu, 9 Mar 2023 07:02:19 +0000 (08:02 +0100)]
regtest: update sized_aligned_new_delete_args expected

Don't quite understand how I managed to generate the original
expected.

21 months agoMake operator new aligned more like the standalone versions
Paul Floyd [Wed, 8 Mar 2023 22:10:22 +0000 (23:10 +0100)]
Make operator new aligned more like the standalone versions

If the alignment is not a power of two return nullptr for the
nothrow overload and bomb for the throwing overload.

21 months agoregtest: add an arm expected for memalign_args
Paul Floyd [Wed, 8 Mar 2023 20:33:36 +0000 (21:33 +0100)]
regtest: add an arm expected for memalign_args

21 months agoregtest: fix warning in memalign_args and add debug info to sized_aligned_new_delete_args
Paul Floyd [Wed, 8 Mar 2023 07:59:38 +0000 (08:59 +0100)]
regtest: fix warning in memalign_args and add debug info to sized_aligned_new_delete_args

21 months agoauxchecks: fix building on FreeBSD
Paul Floyd [Tue, 7 Mar 2023 22:49:22 +0000 (23:49 +0100)]
auxchecks: fix building on FreeBSD

FreeBSD has a sha256sum that doesn't take long args (--check)
GNU sha256sum exists as gsha256sum so add a check for that to
configure.ac

21 months agoFix compile failure on Linux
Paul Floyd [Tue, 7 Mar 2023 22:19:04 +0000 (23:19 +0100)]
Fix compile failure on Linux

Use SizeT rather than size_t
Also make tests quieter with -q

21 months agoAdd 32bit version of sized_aligned_new_delete_args expected
Paul Floyd [Tue, 7 Mar 2023 21:58:57 +0000 (22:58 +0100)]
Add 32bit version of sized_aligned_new_delete_args expected

Asl add some parens to shut up clangd

21 months agoAdd checks to all new / delete overload arguments
Paul Floyd [Tue, 7 Mar 2023 21:47:19 +0000 (22:47 +0100)]
Add checks to all new / delete overload arguments

21 months agoauxchecks: use outer configure make and compilers
Paul Floyd [Tue, 7 Mar 2023 07:00:03 +0000 (08:00 +0100)]
auxchecks: use outer configure make and compilers

On FreeBSD the hard coded 'make' will switch to BSD make rather
than the outer configure make - GNU make.

Similarly for systems with gcc and clang installed then an outer
'configure CC=clang' and then make auxchecks doesn't propagate
the CC to the inner gsl configure, which will use gcc.

Still need some work on the tarball checksum calculation.

21 months agoBug 466104 - aligned_alloc problems, part 1
Paul Floyd [Mon, 6 Mar 2023 20:50:01 +0000 (21:50 +0100)]
Bug 466104 - aligned_alloc problems, part 1

I think that these are all now done.
This commit refactors memalign and updates manual-core.xml
to say some behaviour of Valgrind depends on the build time
OS and libraries.

21 months agoLinux musl: fix code refactor that missed one usage
Paul Floyd [Sun, 5 Mar 2023 16:41:27 +0000 (17:41 +0100)]
Linux musl: fix code refactor that missed one usage

21 months agoDarwin regtest: again, forgot to delete errno
Paul Floyd [Sun, 5 Mar 2023 16:22:59 +0000 (17:22 +0100)]
Darwin regtest: again, forgot to delete errno

Setting errno on Darwin not supported on Valgrind.

21 months agoDarwin regtest: remove test that aligned_alloc fails with huge alignment
Paul Floyd [Sun, 5 Mar 2023 16:20:23 +0000 (17:20 +0100)]
Darwin regtest: remove test that aligned_alloc fails with huge alignment

Needs more debugging.

21 months agoLinux musl: one more iteration for aligned_alloc, assert in wrong place
Paul Floyd [Sun, 5 Mar 2023 15:49:12 +0000 (16:49 +0100)]
Linux musl: one more iteration for aligned_alloc, assert in wrong place

21 months agoLinux musl: corrections for aligned_alloc test
Paul Floyd [Sun, 5 Mar 2023 15:43:25 +0000 (16:43 +0100)]
Linux musl: corrections for aligned_alloc test

21 months agoFix a compiler warning
Paul Floyd [Sun, 5 Mar 2023 15:34:50 +0000 (16:34 +0100)]
Fix a compiler warning

21 months agoLinux musl: alligned_alloc accepts alignment of zero
Paul Floyd [Sun, 5 Mar 2023 15:30:44 +0000 (16:30 +0100)]
Linux musl: alligned_alloc accepts alignment of zero

21 months agoSolaris regtest: final iteration for aligned_alloc
Paul Floyd [Sun, 5 Mar 2023 15:24:44 +0000 (16:24 +0100)]
Solaris regtest: final iteration for aligned_alloc

21 months agoSolaris: bump alignment to next power of two for aligned_alloc
Paul Floyd [Sun, 5 Mar 2023 15:13:09 +0000 (16:13 +0100)]
Solaris: bump alignment to next power of two for aligned_alloc

I'm not changing the Valgrind allocator to fit Solaris, too bad.

21 months agoSolaris: copy paste error in alignment check for aligned_alloc
Paul Floyd [Sun, 5 Mar 2023 15:01:23 +0000 (16:01 +0100)]
Solaris: copy paste error in alignment check for aligned_alloc

21 months agoSolaris: adapt to aligned_alloc only enforcing a multiple of 4
Paul Floyd [Sun, 5 Mar 2023 14:42:39 +0000 (15:42 +0100)]
Solaris: adapt to aligned_alloc only enforcing a multiple of 4

21 months agoMake aligned_alloc behave more like the underlying platform aligned_alloc
Paul Floyd [Sun, 5 Mar 2023 14:25:51 +0000 (15:25 +0100)]
Make aligned_alloc behave more like the underlying platform aligned_alloc

This is the third part of
Bug 466104 aligned_alloc problems, part 1

Shouldn't affect Linux glibc.

21 months agoBug 449309 - Missing loopback device ioctl(s)
Paul Floyd [Sun, 5 Mar 2023 07:38:34 +0000 (08:38 +0100)]
Bug 449309 -  Missing loopback device ioctl(s)

Patch provided by:
    Faheem Sheikh <faheem.sheikh@bmw.de>

Note that the testcase provided with this report hasn't
been added as it requires privileges.

21 months agoLinux PPC regtest: forgot to add the new expected
Paul Floyd [Wed, 1 Mar 2023 07:20:46 +0000 (08:20 +0100)]
Linux PPC regtest: forgot to add the new expected

21 months agoLinux PPC regtest: add a specific expected for memalign_args
Paul Floyd [Wed, 1 Mar 2023 07:18:09 +0000 (08:18 +0100)]
Linux PPC regtest: add a specific expected for memalign_args

The number of errors for arguments that gets triggered depends
on how GCC optimzes and generates code for the vg_replace_malloc.c
wrappers. PPC seems to trigger more than amd64.

21 months agoDarwin regtest: no malloc.h header on Darwin
Paul Floyd [Wed, 1 Mar 2023 06:42:43 +0000 (07:42 +0100)]
Darwin regtest: no malloc.h header on Darwin

22 months agoTypo in comment
Paul Floyd [Tue, 28 Feb 2023 22:27:22 +0000 (23:27 +0100)]
Typo in comment

22 months agoFix Darwin compilation
Paul Floyd [Tue, 28 Feb 2023 21:58:14 +0000 (22:58 +0100)]
Fix Darwin compilation

Removed memalign wrapper on Darwin, so valloc can't use it any more.

22 months agoBug 445743 - "The impossible happened: mutex is locked simultaneously by two threads...
Paul Floyd [Tue, 28 Feb 2023 21:17:25 +0000 (22:17 +0100)]
Bug 445743 - "The impossible happened: mutex is locked simultaneously by two threads" while using mutexes with priority inheritance and signals

Been using the same fix in FreeBSD for quite a while, so I think
it's safe to apply to Linux and close the bugzi item.

22 months agoRemove unused helgrind expected
Paul Floyd [Tue, 28 Feb 2023 20:52:54 +0000 (21:52 +0100)]
Remove unused helgrind expected

I don't think that this can match any more.

22 months agoChange behaviour of posix_memalign for Solaris
Paul Floyd [Tue, 28 Feb 2023 20:21:05 +0000 (21:21 +0100)]
Change behaviour of posix_memalign for Solaris

It returns NULL and 0 status whilst most other platforms
allocatae some undefined amount of memory (which is allowed
by posix).

Update the posix_memalign test as well.

Finally remove some clang warnings about alignment.

22 months agoPut back Darwin zone memalign
Paul Floyd [Tue, 28 Feb 2023 18:56:52 +0000 (19:56 +0100)]
Put back Darwin zone memalign

I had another look at the XNU source and this does seem to exist.
The manpage says that it is the zone version of posix_memalign,
though that's probably more because Darwin has no memalign.

22 months agoMake memalign behave more like the underlying platform memalign
Paul Floyd [Tue, 28 Feb 2023 12:17:24 +0000 (13:17 +0100)]
Make memalign behave more like the underlying platform memalign

This is the first part of
Bug 466104 aligned_alloc problems, part 1

The bulk of this change is try try to get memalign to be more
platform aware. Previously the Valgrind implementation only
reflected the glibc implementation. That meant non-power of
two alignment values would silently get bumped up to the
next largest power of two. Most other platforms return NULL
and set errno to EINVAL.

There are a few other changes. A couple of the other aligned alloc
functions like valloc were caling the Valgrind memalign. This meant
that there weould be an extra Valgrind memalign in any error
callstacks. Now these functions call the allocator directly.

The memcheck memalign2 testcase has been redone. The memalign
parts moved out to per-platform versions and the tescase
itdelf renamed to posix_memalign, since that is all that is left.
I also modified the testcase so that it checks that the
memalign calls check for non-NULL returns, and on platforms
that set errno that it is correctly set. Previously the
test only worked on non-glibc because NULL & alignment is
zero.  The platform versions have been tested on glibc,
MUSL, FreeBSD and OpenIndiana and should hopefully run OK
both under memcheck and standalone.

There is stil quite a lot that is NOT done

1. I'm not certain that implementations allocate more memory
   and/or use a wider alignment. It doesn't help that almost
   universally the memalign implementations are badly
   documented, undocumented or buggy.
2. We don't handle very large alignment requests well.
   Most implementations will fail and set EINVAL if the
   alignment is over half the memory space. Valgrind will
   core panic if an aligmnt of over 16Mbytes is requested.
3. We don't generate any memcheck errors for invalid values
   of alignment. That's planned in Part 2.
4. The code is static and fixed at compile time. That means that
   if you are using MUSL with a glibc-built Valgrind you
   will still get glibc memalign behaviour.
   I'll wait to see if there are any requests before trying
   to make the behaviour selectable at runtime.

22 months agoAnd here is the updated expected for FreeBSD scalar x86 mknodat
Paul Floyd [Sat, 25 Feb 2023 15:12:14 +0000 (16:12 +0100)]
And here is the updated expected for FreeBSD scalar x86 mknodat

22 months agoFreeBSD mknodat syscall dev arg is 64bits so the syscall needs splitting into amd64...
Paul Floyd [Sat, 25 Feb 2023 15:09:41 +0000 (16:09 +0100)]
FreeBSD mknodat syscall dev arg is 64bits so the syscall needs splitting into amd64 and x86 versions

22 months agoSmall update to FreeBSD x86 scalar expected
Paul Floyd [Sat, 25 Feb 2023 15:08:40 +0000 (16:08 +0100)]
Small update to FreeBSD x86 scalar expected

22 months agoFreeBSD: make rfork() fail more gracefully
Paul Floyd [Sat, 25 Feb 2023 14:16:35 +0000 (15:16 +0100)]
FreeBSD: make rfork() fail more gracefully

rfork() is barely used in base FreeBSD. The main use
is in posix_spawn(). If rfork() fails with EINVAL
then it falls back to using vfork(). This is preferable
to Valgrind bombing.

ksh93 uses posix_spawn. I tested bash and csh and they had
no problems.

Also add 'hello world" smoke tests for bash csh and ksh

22 months agobug465435 - m_libcfile.c:66 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit...
Paul Floyd [Fri, 24 Feb 2023 20:31:35 +0000 (21:31 +0100)]
bug465435 - m_libcfile.c:66 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit)' failed.

22 months agoOne small typo
Paul Floyd [Thu, 23 Feb 2023 21:15:59 +0000 (22:15 +0100)]
One small typo

22 months agomusl regtest : fix warnings and badly initialized struct msghdr
Paul Floyd [Tue, 21 Feb 2023 22:05:22 +0000 (23:05 +0100)]
musl regtest : fix warnings and badly initialized struct msghdr

22 months agoTry to correct configure script for warning flags with values
Paul Floyd [Tue, 21 Feb 2023 21:05:13 +0000 (22:05 +0100)]
Try to correct configure script for warning flags with values

Some -W flags come with and without an =
(usually for warning levels)
But some only have the form -Wfoo=42 and -Wno-foo

22 months agomusl: fix a couple of warnings
Paul Floyd [Tue, 21 Feb 2023 20:29:18 +0000 (21:29 +0100)]
musl: fix a couple of warnings

musl doesn't have sys/poll.h

GCC moans and then uses poll.h

On glibc linux and FreeBSD poll.h is a symlink to sys/poll.h
Illumos poll.h includes sys/poll.h

22 months agoregtest: remove compiler warnings with clang
Paul Floyd [Sun, 19 Feb 2023 09:10:59 +0000 (10:10 +0100)]
regtest: remove compiler warnings with clang

22 months agoDRD aarch64: Add some suppressions for DRD libstdc++
Paul Floyd [Fri, 17 Feb 2023 21:25:41 +0000 (22:25 +0100)]
DRD aarch64: Add some suppressions for DRD libstdc++

Also fix building drd/tests/std_mutex, needs -pthread.

22 months agoREADME_DEVELOPERS: Explain how to set VALGRIND_LIB to gdb valgrind
Mark Wielaard [Thu, 16 Feb 2023 12:44:08 +0000 (13:44 +0100)]
README_DEVELOPERS: Explain how to set VALGRIND_LIB to gdb valgrind

22 months agoDarwin: try to fix assert in DRD
Paul Floyd [Wed, 8 Feb 2023 21:54:57 +0000 (22:54 +0100)]
Darwin: try to fix assert in DRD

The hard coded memory mapping trigger drd_start_using_mem_w_perms
which will lead to tl_assert(vg_tid != VG_INVALID_THREADID);

But vg_tid was just set to VG_INVALID_THREADID before the
hard coded memory map.

22 months agoRegtest: rationalize filters for new/delete
Paul Floyd [Sun, 5 Feb 2023 11:50:13 +0000 (12:50 +0100)]
Regtest: rationalize filters for new/delete

22 months agoDarwin regtest: add filtering for zone functions and realloc
Paul Floyd [Sun, 5 Feb 2023 10:35:28 +0000 (11:35 +0100)]
Darwin regtest: add filtering for zone functions and realloc

For test of C++17 new/delete variations

22 months agoDRD regtest: try to make timed_mutex more reliable
Paul Floyd [Fri, 3 Feb 2023 18:27:39 +0000 (19:27 +0100)]
DRD regtest: try to make timed_mutex more reliable

On RHEL 7.6 ARM I see this with the lock returning false
but without the 11 second timeout. Try adding some sleeps.

22 months agoDRD regtest: try to make timed_mutex more reliable
Paul Floyd [Fri, 3 Feb 2023 18:27:39 +0000 (19:27 +0100)]
DRD regtest: try to make timed_mutex more reliable

On RHEL 7.6 ARM I see this with the lock returning false
but without the 11 second timeout. Try adding some sleeps.

This page took 0.068504 seconds and 5 git commands to generate.