2324 Commits

Author SHA1 Message Date
Paul Floyd
402d720b38 Add memfd_create.stderr.exp-fcntl64 to EXTRA_DIST 2023-04-24 20:53:13 +02:00
Mark Wielaard
e896406e15 Add a memfd_create.stderr.exp-fcntl64 variant
On 32bit systems a glibc fcntl call results in a fcntl64 syscall.
2023-04-24 15:01:33 +02:00
Paul Floyd
a821780d8c solaris: aligned allocation issues
Solaris 11.3 doesn't have aligned_alloc - add a configure time test
memalign does not accept either a size or an alignment of zero
2023-04-23 13:51:37 +02:00
Paul Floyd
76d6b4591a Revert "Typo in NEWS"
This reverts commit bf347551c99313a4af9c38bdeda9b946c9795945.
2023-04-22 16:29:27 +02:00
Paul Floyd
bf347551c9 Typo in NEWS
Thanks Tobias, on valgrind-developers
2023-04-22 16:08:28 +02:00
Paul Floyd
a2af9adec4 Bug 397083 - Likely false positive "uninitialised value(s)" for __wmemchr_avx2 and __wmemcmp_avx2_movbe 2023-04-20 22:11:31 +02:00
Paul Floyd
ec1049b5d1 regtest: update filter_stanza so that sized_aligned_new_delete_args works on 32bit platforms 2023-04-13 22:06:34 +02:00
Paul Floyd
ab6d3928a5 regtest: warning cleanup
All for clang and mostly Apple clang
There are still numerous deprecated warnings on macOS 10.13
(sem* functions, syscall, sbrk, i386, PIEi, OSSpinLocki, swapcontext, getcontext)
2023-04-10 10:33:54 +02:00
Paul Floyd
0641a27ffb Darwin regtest: update strchr filter 2023-04-02 15:28:21 +02:00
Paul Floyd
e105ce0d8f 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.
2023-04-01 21:11:58 +02:00
Paul Floyd
abf513febd 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.
2023-04-01 20:55:22 +02:00
Paul Floyd
81e51f9469 MUSL regtest: fix a comple of build problems building regression tests on Alpine 2023-03-31 13:39:34 +02:00
Paul Floyd
37edf8fbda Regtest: fix a couple of unused variable warnings
Copy & paste leftovers
2023-03-31 13:17:10 +02:00
Paul Floyd
78d0dc51c0 Remove source file added to EXTRA_DIST in error 2023-03-31 12:41:40 +02:00
Mark Wielaard
f32cc294e3 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).
2023-03-31 01:31:25 +02:00
Paul Floyd
5fd3b8947e Regtest: put back a glibc version ofr memalign_args test
I forgot that glibc aligned_alloc really is memalign, which
changes the callstack.
2023-03-26 17:05:25 +02:00
Paul Floyd
95ac41bc58 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.
2023-03-26 16:37:56 +02:00
Paul Floyd
3eaac58827 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.
2023-03-25 19:52:41 +01:00
Paul Floyd
8532c8b5e4 regtest: add an s390 expected for sized_aligned_new_delete_args 2023-03-12 08:20:57 +01:00
Paul Floyd
036bf06734 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.
2023-03-11 16:31:43 +01:00
Paul Floyd
678b685c7b regtest: update one expected after fixing realloc_size_zero_mismatch.cpp 2023-03-11 08:07:06 +01:00
Paul Floyd
d9a8c601af regtest: build failure on Linux ppc64le, missing header 2023-03-11 06:49:13 +01:00
Paul Floyd
50bded71b2 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.
2023-03-10 21:55:14 +01:00
Paul Floyd
4af62304d9 Rename memcheck/tests/sized_aligned_new_delete_args.stderr.exp-glibc
It's for GCC / libstdc++ really
2023-03-10 18:41:26 +01:00
Paul Floyd
c2a0cd6e11 darwin regtest: fix unused variable warning
Copied and paster from old posix_memalign test
2023-03-10 18:39:59 +01:00
Paul Floyd
28e4efb2b1 Mised one aligned alloc wrapper on Linux
Need different expected for GCC / libstdc++

And I think that the 32bit expected will also need updating.
2023-03-10 08:40:40 +01:00
Paul Floyd
294894459a regtest: try to fix bad merge of memalign_args expected on ppc64 2023-03-09 08:31:12 +01:00
Paul Floyd
e29bf11d87 regtest: update sized_aligned_new_delete_args expected
Don't quite understand how I managed to generate the original
expected.
2023-03-09 08:02:19 +01:00
Paul Floyd
d4affb0ab7 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.
2023-03-08 23:10:22 +01:00
Paul Floyd
bb5e8df560 regtest: add an arm expected for memalign_args 2023-03-08 21:34:25 +01:00
Paul Floyd
a7d86da0f6 regtest: fix warning in memalign_args and add debug info to sized_aligned_new_delete_args 2023-03-08 08:59:38 +01:00
Paul Floyd
18ca012c08 Fix compile failure on Linux
Use SizeT rather than size_t
Also make tests quieter with -q
2023-03-07 23:19:04 +01:00
Paul Floyd
114c528dab Add 32bit version of sized_aligned_new_delete_args expected
Asl add some parens to shut up clangd
2023-03-07 22:58:57 +01:00
Paul Floyd
ceee3e8922 Add checks to all new / delete overload arguments 2023-03-07 22:47:19 +01:00
Paul Floyd
b2ca91d669 Darwin regtest: again, forgot to delete errno
Setting errno on Darwin not supported on Valgrind.
2023-03-05 17:22:59 +01:00
Paul Floyd
0fecf3914d Darwin regtest: remove test that aligned_alloc fails with huge alignment
Needs more debugging.
2023-03-05 17:20:23 +01:00
Paul Floyd
b07d068887 Linux musl: one more iteration for aligned_alloc, assert in wrong place 2023-03-05 16:49:12 +01:00
Paul Floyd
e99cd3c6a3 Linux musl: corrections for aligned_alloc test 2023-03-05 16:43:25 +01:00
Paul Floyd
afb5867858 Solaris regtest: final iteration for aligned_alloc 2023-03-05 16:24:44 +01:00
Paul Floyd
fd20bb9c67 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.
2023-03-05 15:25:51 +01:00
Paul Floyd
25ebadbdd7 Linux PPC regtest: forgot to add the new expected 2023-03-01 08:20:46 +01:00
Paul Floyd
663bb2ed65 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.
2023-03-01 08:18:09 +01:00
Paul Floyd
3d8c35bbfd Darwin regtest: no malloc.h header on Darwin 2023-03-01 07:42:43 +01:00
Paul Floyd
33ce1bf1cb 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.
2023-02-28 21:21:05 +01:00
Paul Floyd
e862c6f3d2 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.
2023-02-28 13:46:08 +01:00
Paul Floyd
5cf51ca2f6 And here is the updated expected for FreeBSD scalar x86 mknodat 2023-02-25 16:12:14 +01:00
Paul Floyd
615336329b Small update to FreeBSD x86 scalar expected 2023-02-25 16:08:40 +01:00
Paul Floyd
7136cd9876 musl regtest : fix warnings and badly initialized struct msghdr 2023-02-21 23:05:22 +01:00
Paul Floyd
a6101db692 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
2023-02-21 22:05:13 +01:00
Paul Floyd
fe008c8739 regtest: remove compiler warnings with clang 2023-02-19 10:10:59 +01:00