17338 Commits

Author SHA1 Message Date
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
2fa68c1cc7 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
2023-03-07 23:49:22 +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
2715ad4ab5 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.
2023-03-07 08:00:03 +01:00
Paul Floyd
e8d4d64e46 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.
2023-03-06 21:50:01 +01:00
Paul Floyd
43880cb199 Linux musl: fix code refactor that missed one usage 2023-03-05 17:41:27 +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
15fdfa8464 Fix a compiler warning 2023-03-05 16:34:50 +01:00
Paul Floyd
dc8af61b5a Linux musl: alligned_alloc accepts alignment of zero 2023-03-05 16:30:44 +01:00
Paul Floyd
afb5867858 Solaris regtest: final iteration for aligned_alloc 2023-03-05 16:24:44 +01:00
Paul Floyd
4ca2fa7b1f Solaris: bump alignment to next power of two for aligned_alloc
I'm not changing the Valgrind allocator to fit Solaris, too bad.
2023-03-05 16:13:09 +01:00
Paul Floyd
bf8d5b9a52 Solaris: copy paste error in alignment check for aligned_alloc 2023-03-05 16:01:23 +01:00
Paul Floyd
b723d03bb3 Solaris: adapt to aligned_alloc only enforcing a multiple of 4 2023-03-05 15:42:39 +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
cb7adf4a9e 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.
2023-03-05 08:42:42 +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
9fa27e001e Typo in comment 2023-02-28 23:27:22 +01:00
Paul Floyd
40c196b0ca Fix Darwin compilation
Removed memalign wrapper on Darwin, so valloc can't use it any more.
2023-02-28 22:58:14 +01:00
Paul Floyd
94a41e050c 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.
2023-02-28 22:17:25 +01:00
Paul Floyd
189ea2bf9e Remove unused helgrind expected
I don't think that this can match any more.
2023-02-28 21:52:54 +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
19dc72931b 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.
2023-02-28 19:56:52 +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
f6f7cae623 FreeBSD mknodat syscall dev arg is 64bits so the syscall needs splitting into amd64 and x86 versions 2023-02-25 16:09:41 +01:00
Paul Floyd
615336329b Small update to FreeBSD x86 scalar expected 2023-02-25 16:08:40 +01:00
Paul Floyd
b861458d3d 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
2023-02-25 15:16:35 +01:00
Paul Floyd
e61a04babc bug465435 - m_libcfile.c:66 (vgPlain_safe_fd): Assertion 'newfd >= VG_(fd_hard_limit)' failed. 2023-02-24 21:32:08 +01:00
Paul Floyd
342e76ced1 One small typo 2023-02-23 22:15:59 +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
7b97ba6f17 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
2023-02-21 21:29:18 +01:00
Paul Floyd
fe008c8739 regtest: remove compiler warnings with clang 2023-02-19 10:10:59 +01:00
Paul Floyd
3a92995a85 DRD aarch64: Add some suppressions for DRD libstdc++
Also fix building drd/tests/std_mutex, needs -pthread.
2023-02-17 22:25:41 +01:00
Mark Wielaard
61da760afe README_DEVELOPERS: Explain how to set VALGRIND_LIB to gdb valgrind 2023-02-16 13:44:08 +01:00
Paul Floyd
6e4eb0b674 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.
2023-02-08 22:54:57 +01:00
Paul Floyd
9fb974c359 Regtest: rationalize filters for new/delete 2023-02-05 12:50:13 +01:00
Paul Floyd
0eb7257254 Darwin regtest: add filtering for zone functions and realloc
For test of C++17 new/delete variations
2023-02-05 11:35:28 +01:00
Paul Floyd
60303f4316 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.
2023-02-04 22:01:08 +01:00
Paul Floyd
add5fe9832 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.
2023-02-03 19:27:39 +01:00