5891 Commits

Author SHA1 Message Date
Mark Wielaard
b4ec6a6ff7 Support SCV_FLAG also on VGP_ppc64be_linux
Running on a kernel that supports the SCV instruction (sets
PPC_FEATURE2_SCV in auxv AT_HWCAPS2) valgrind will assert: valgrind:
m_syswrap/syswrap-main.c:549 (getSyscallArgsFromGuestState): Assertion
'gst->guest_syscall_flag == SC_FLAG' failed.

Removing that assert makes most things work. But also filter out
PPC_FEATURE2_SCV from AT_HWCAPS2 for the client, so it shouldn't try
using the SCV instruction.

https://bugs.kde.org/show_bug.cgi?id=469097
2023-04-28 15:08:44 +02:00
Alexandra Hájková
476d036084 vgdb: Use --wait argument in multi mode
when waiting for valgrind to start.
2023-04-26 21:35:30 +02:00
Mark Wielaard
f83f269dd1 Fix typos in NEWS and valgrind-monitor-def.py
NEWS: who_point_at -> who_points_at
valgrind-monitor-def.py: MEN -> LEN
2023-04-26 21:31: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
Mark Wielaard
8360205968 vgdb: Always check the result from asprintf and write calls 2023-04-22 18:04:21 +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
Mark Wielaard
9fcac92ab3 vgdb --multi: fix various typos, indentation and such (followup)
commit 56ccb1e36c4722b56e3e602b986bc45025cb685d missed a few small
fixlets:

- one more comment at the top describing the three usages of vgdb.
- fixed up a few places where tabs were used for indentation (we are
  not very consistent in that either, after the release we'll look
  into adopting something like clang-format so you don't have to do
  all this by hand).
- Add a missing newline in coregrind/m_main.c to make
  none/tests/cmdline2 pass.
2023-04-20 15:04:03 +02:00
Alexandra Hájková
56ccb1e36c vgdb --multi: fix various typos, indentation and such
Remove --launched-with-multi from --help-debug output since it is not
a real user option. Do add a comment in m_main.c explaining the
internal usage.

Add a top-level comment describing the three usages of vgdb.

Fix comment description of decode_hexstring, create_packet,
split_hexdecode.

Consistently use 3 space indention in send_packet and receive_packet
and next_delim_string and split_hexdecode, count_delims,
do_multi_mode.

Fix return type of count_delims to size_t.

Add a note in coregrind/m_gdbserver/server.c to sync qSupported
replies with coregrind/vgdb.c.

Use vgdb (all lowercase) and GDB (all caps) consistently in the
manual.
2023-04-20 14:29:45 +02:00
Mark Wielaard
0ead4c39f0 vgdb: Handle EAGAIN in read_buf
The file descriptor is on non-blocking mode and read_buf should only
be called when poll gave us an POLLIN event signaling the file
descriptor is ready for reading from. Still sometimes we do get an
occasional EAGAIN. Just do as told in that case and try to read again.

Also fix an ERROR errno in getpkt. This has never been observed, but
not getting the actual errno if the write fails in that case would be
really confusing.
2023-04-20 13:00:49 +02:00
Igor Nunes
b8a9da078b Enable getcpu on arm 32
https://bugs.kde.org/show_bug.cgi?id=419054
2023-04-19 23:54:28 +02:00
Mark Wielaard
932332e660 Use pipe in vgdb if system doesn't have pipe2
Add a configure check for pipe2. If it isn't available use pipe
and fcntl F_SETFD FD_CLOEXEC in vgdb.c.

https://bugs.kde.org/show_bug.cgi?id=468556
2023-04-16 13:18:00 +02:00
Mark Wielaard
03d9229f0b Fixup vgdb --help message
The --valgrind and the --vargs were missingin the OPTIONS summary.
A \n was missing after the --vargs description.
2023-04-16 01:55:55 +02:00
Earl Chew
d387566dd7 Support Linux syscall 434 pidfd_open 2023-04-14 23:06:48 +02:00
Alexandra Petlanova Hajkova
0432ce486d vgdb: implement the extended-remote protocol
Executing vgdb --multi makes vgdb talk the gdb extended-remote
protocol. This means that the gdb run command is supported and
vgdb will start up the program under valgrind. Which means you
don't need to run gdb and valgrind from different terminals.
Also vgdb keeps being connected to gdb after valgrind exits. So
you can easily rerun the program with the same breakpoints in
place.

vgdb now implements a minimal gdbserver that just recognizes
a few extended-remote protocol packets. Once it starts up valgrind
it sets up noack and qsupported then it will forward packets
between gdb and valgrind gdbserver. After valgrind shutsdown it
resumes handling gdb packets itself.

https://bugs.kde.org/show_bug.cgi?id=434057

Co-authored-by: Mark Wielaard <mark@klomp.org>
2023-04-14 00:08:53 +02:00
Paul Floyd
0ae17c117e FreeBSD: auxv changes for FreeBSD 13.2 2023-04-13 22:45:46 +02:00
Paul Floyd
28a164761f Darwin: missed removing a couple of delete wrappers 2023-04-02 14:05:40 +02:00
Paul Floyd
e27f24c165 Darwin and FreeBSD: new / delete wrappers
A few typos in the FreeBSD soname wrappers
Many missing Darwin wrappers
And no need to repeat that GNU mangling is used
2023-04-02 13:43:14 +02:00
Paul Floyd
421693f432 Darwin: add support for setting errno from alloc wrappers 2023-04-02 11:06:18 +02:00
Paul Floyd
3f4052623c Darwin: try to improve posix_memalign / zone_memalign wrapper
It still doesn't set errno though.
2023-04-01 22:28:36 +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
c7e01d28b4 Solaris: improve syscall trace for sysfs
More than just fix the format warning
2023-03-26 18:21:42 +02:00
Paul Floyd
6bbe320a1a Solaris: format warnings in syswrap functions 2023-03-26 10:48:08 +02:00
Paul Floyd
394fa9223a Solaris: fix build, another aligned alloc typo 2023-03-21 22:11:11 +01:00
Paul Floyd
022a9caf40 Bug 467482 - Build failure on aarch64 Alpine
Patch submitted by
	fanquake@gmail.com
2023-03-17 19:48:08 +01:00
Paul Floyd
50f6533612 coverity: a couple of potential buffer overruns 2023-03-12 11:12:29 +01:00
Paul Floyd
d3a49926ad coverity: printf args format mismatch 2023-03-12 09:39:35 +01:00
Paul Floyd
18c278f386 coverity: copy paste error 2023-03-12 09:22:10 +01:00
Paul Floyd
a1bb70bbf1 FreeBSD: fix a syswrap compiler warning 2023-03-12 08:21:55 +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
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
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
f6ee38b419 Malloc replacements: add some C++14/17 comments
Rearrange the code to group C++ 14 operator deeltes together.
2023-03-09 20:58:12 +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
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
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
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
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
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
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