1167 Commits

Author SHA1 Message Date
Paul Floyd
eca0ea6e9a Darwin: add most of the missing bits for Darwin 18 support
Code merged from Louis Brunner. Also add a but of doc about the
oldest OSX that we support. Unfortunately I don't know which version
that is.
2025-12-09 08:58:46 +01:00
Paul Floyd
bf7c22738b Darwin: many fixes for OSX 10.13
Most of these changes are from Louis Brunner's GitHub repo.
The most imortant changes are to the memory space and to the code
related to getting the host filename during startup. This means
that when Valgrind crashes or hits an assert we now get a legible
host stacktrrace.

This also fixes none/tests/darwin/bug228343
2025-11-27 13:26:57 +01:00
Paul Floyd
a0e79f983b A few more syscall comments and doc tweaks 2025-11-26 20:27:43 +01:00
Paul Floyd
f15425fa0a doc: add client_syscall_arguments.txt to EXTRA_DIST 2025-11-06 18:43:17 +01:00
Paul Floyd
85a06581cc doc: add a text file describing client syscall argument handling
To help understand all of the shuffling that gets done for
"syscall syscall".
2025-11-06 08:33:42 +01:00
Mark Wielaard
48d64d0e6b Document FdBadUse in xml-output-protocol5.txt
The core error FdBadUse was added in commit 22971a15d6
"Report track-fd errors for fd used which was not opened or already closed"
But not documented. Add it to the protocol documentation now.
2025-10-20 19:04:34 +02:00
Alexandra Hájková
7902019817 vgdb.c: Update --vargs documentation 2025-10-20 19:01:53 +02:00
Mark Wielaard
3392155359 Upgrade to GNU General Public License version 3
- Update COPYING and VEX/LICENSE.GPL to version 3.
- Update README, NEWS, docs/manual license and contributing text.
- Update file headers to say either version 3 of the License,
  or (at your option) any later version.
- Leave tests and perf file headers as is, unless the code is derived
  from Valgrind/VEX.
- Leave valgrind.h, cachegrind.h, callgrind.h, drd.h, helgrind.h,
  memcheck.h and dhat.h Hybrid-BSD licensed.
2025-10-18 00:55:07 +02:00
Florian Krohm
9c0c0e41d8 Control building documentation (BZ 495483)
Introduce Makefile variable BUILD_DOCS with these possible values:
none - does not build any documentation
all  - builds all documentation
html - builds HTML docs but skips building PDFs

BUILD_ALL_DOCS is still recognised for backward compatibility and
is mapped to BUILD_DOCS like so:
If not specified   --> BUILD_DOCS=all
BUILD_ALL_DOCS=yes --> BUILD_DOCS=all
BUILD_ALL_DOCS=no  --> BUILD_DOCS=html

README_DEVELOPERS adjusted.

Fixes https://bugs.kde.org/show_bug.cgi?id=495483
2025-10-03 16:26:55 +00:00
Mark Wielaard
da81ebf0c5 docs/xml/FAQ.xml: listitems contain paras, not raw CDATA
Fixes: b5c89ee983 ("Doc: add item on tcmalloc >= 2.16 hangs to FAQ")
2025-09-21 21:38:36 +02:00
Paul Floyd
86242303aa doc: missed closing itemizedlist 2025-09-21 20:57:04 +02:00
Paul Floyd
b5c89ee983 Doc: add item on tcmalloc >= 2.16 hangs to FAQ 2025-09-21 20:53:33 +02:00
Paul Floyd
0d5ccba573 docs: add internals files to EXTRA_DIST 2025-09-12 21:06:25 +02:00
Paul Floyd
51f5a56a66 doc: Add a HOWTO for building tcmalloc to test C23 functions 2025-09-11 21:42:00 +02:00
Alexandra Hájková
2942c04c48 Add "bad" option for --track-fds.
When --track-fds=bad is specified, do not warn about
leaked file descriptors and only warn about file decriptors
which was not opened or already closed.

Update the documentation in docs/xml/manual-core.xml.

Add none/tests/track_bad test to test the new option.

Adjust none/tests/cmdline1 and  none/tests/cmdline2 expected
outputs.

https://bugs.kde.org/show_bug.cgi?id=493434
2025-06-26 20:48:55 +02:00
Paul Floyd
b13cc3d1ab doc: add xml protocol 5 and 6 files to EXTRA_DIST 2025-06-01 08:09:14 +02:00
Paul Floyd
7786b075ab Bug 390310 - Output summaries in XML files
Original patch contributed by renaultd@free.fr
2025-05-25 21:04:25 +02:00
Alexandra Hájková
ebd7dd5ea9 Add "yes" argument for the --modify-fds option.
Use --modify-fds=yes to restrict the option from affecting
the 0/1/2 file descriptors as they're often used for
stdin/tdout/stderr redirection.

The new possibility is named "yes" because "yes" is used
as the default in general. The default behaviour of the --modify-fds
option is then such, that highest available file descriptor is returned
execept when the lowest stdin/stdout/stderr (0, 1, 2) are available.

For example, if we want to redirect stdout to stderr by closing stdout
(file descriptor 1) and then calling dup (), file descriptor 1 will be
returned and not the highest number available. This is because the
following is a common pattern to redirect stdout to stderr:

close (1);
/* stdout becomes stderr */
ret = dup (2);

Add none/tests/track_yes.vgtest and none/tests/track_high.vgtest
tests to test --modify-fds=yes/high behave as expected.

https://bugs.kde.org/show_bug.cgi?id=502359
2025-05-22 16:13:56 +02:00
Mark Wielaard
7279362391 Set version to 3.25.0-RC1
Also update vg-lifespan which is used for documentation copyright years.
2025-04-18 15:01:01 +02:00
Alexandra Hájková
4c78562419 Add --modify-fds=[no|high] option
Normally a newly recreated file descriptor gets the lowest number
available. This might cause old file descriptor numbers to be reused
and hides bad file descriptor accesses (because the old number is
new again).

When enabled, when the program opens a new file descriptor,
the highest available file descriptor is returned instead of the
lowest one.

Add the none/tests/track_new.stderr.exp test to test this new option.

Adjust none/tests/filter_fdleak to filter the track_new.vgtest,
removing some internal glibc functions from the backtraces and remove
symbol versioning. The output of the use_after_close test also had to
be adjusted. Also adjust the none/tests/cmdline1 and
none/tests/cmdline2 output as the new --modify-fds=no|high is
displayed.

https://bugs.kde.org/show_bug.cgi?id=493433
2025-04-16 16:39:06 +02:00
Andreas Arnez
5cb67042c8 s390x: Support the PPA instruction
The perform processor assist (PPA) instruction provides the CPU with
special execution hints.  It belongs to the processor-assist facility,
which shares facility bit 49 with the execution-hint and load-and-trap
facilities and with the miscellaneous-instruction-extensions facility 1.

Implementing PPA enables setting facility bit 49 to one.  Similar to other
execution hint instructions, implement PPA as a no-op for now.
2025-04-03 19:17:06 +02:00
Andreas Arnez
a2e2a41425 s390x: Reflect renaming of DFP insns in opcode checker
After renaming various DFP instructions to their new name, reflect this in
s390-check-opcodes.pl by ignoring their old names, so the checker doesn't
complain about mismatches.

Also, add the missing documentation in s390-opcodes.csv about the fact
that the "with rounding mode" instruction versions cgdtra, cgxtra, and
cxgtra are implemented.
2025-04-03 19:17:06 +02:00
Andreas Arnez
957b7e0a7e s390x: Reflect ppno -> prno renaming in opcode checker
After consequently renaming ppno to prno, the tool s390-check-opcodes.pl
complains:

  *** opcode prno is implemented but CSV file does not say so
  *** opcode ppno is not implemented but CSV file says so
  *** opcode ppno is not handled by the decoder

Fix this by renaming to "prno" in s390-opcodes.csv as well and declaring
"ppno" instead of "prno" as an alias in s390-check-opcodes.pl.
2025-04-01 16:50:19 +02:00
Andreas Arnez
6b8148b825 Bug 498421 - s390x: Add BPP, BPRP, and NIAI insns
Add support for the branch prediction preload (BPP), branch prediction
relative preload (BPRP), and next instruction access intent (NIAI)
instructions.  These instructions just provide performance hints to the
CPU and have no other effect on program execution.  Thus implement them as
no-ops.
2025-04-01 16:50:12 +02:00
Mark Wielaard
9f956db3e5 docs/Makefile.am: Make sure xml catalog file exists for xmllint check
When XML_CATALOG_FILES don't exist on the system xmllint will have to
query those files through various websites. When there is a network
error xmllint will fail. So make sure to only run the validity tests
when both xmllint and XML_CATALOG_FILES exists.
2025-03-09 16:46:56 +01:00
Petr Pavlu
32fc9cc751 riscv64: Add initial support: Valgrind modifications
The following people contributed to the initial RISC-V support:
Petr Pavlu <petr.pavlu@dagobah.cz>
Xeonacid <h.dwwwwww@gmail.com>
laokz <laokz@foxmail.com>
Chelsea E. Manning <me@xychelsea.is>
zhaomingxin <zhaomingxin.zmx@alibaba-inc.com>
Jojo R <rjiejie@linux.alibaba.com>

https://bugs.kde.org/show_bug.cgi?id=493507
2025-02-25 17:04:36 +01:00
Petr Pavlu
949abd0472 riscv64: Add initial support: new port-specific Valgrind files
The following people contributed to the initial RISC-V support:
Petr Pavlu <petr.pavlu@dagobah.cz>
Xeonacid <h.dwwwwww@gmail.com>
laokz <laokz@foxmail.com>
Chelsea E. Manning <me@xychelsea.is>
zhaomingxin <zhaomingxin.zmx@alibaba-inc.com>
Jojo R <rjiejie@linux.alibaba.com>

Some integration fixes were added by Mark Wielaard <mark@klomp.org>
- Remove POST handler from sys_close
- Define VKI_O_DIRECT in vki-riscv64-linux.h
- Wrap riscv64-linux mlock2
- Add POST handler for sys_readlinkat

https://bugs.kde.org/show_bug.cgi?id=493507
2025-02-25 17:02:45 +01:00
Paul Floyd
a355202c8d Add use of QT_ENABLE_REGEXP_JIT env var to FAQ
Prevents huge numbers of errors with Qt apps.
2025-01-03 22:04:27 +01:00
Philippe Waroquiers
4e42cc21d6 Minor changes to the documentation and commends related to demangling. 2024-12-25 16:08:04 +01:00
Andreas Arnez
bdd2e5cd04 s390x: Update instruction list with arch15 insns
Recent commits in Binutils added arch15 instructions to s390-opc.txt.
Since then, the script s390-check-opcodes.pl complains about many insns
that are not known to Valgrind.

Update Valgrind's instruction list to be in synch with Binutils again.
Add the new instructions to s390-opcodes.csv and declare them as "not
implemented".
2024-12-04 17:03:12 +01:00
Paul Floyd
9ec2c7e2e9 Fix typo in FAQ. 2024-12-01 21:13:18 +01:00
Paul Floyd
910519674a Manual: C23 is now officially released 2024-11-26 08:08:37 +01:00
Mikhail Gorodetsky
309d96d3e4 Bug 469782 - Valgrind does not support zstd-compressed debug sections 2024-11-19 08:59:16 +01:00
Paul Floyd
dc1276745f Correct typos and spelling mistakes 2024-11-03 10:55:57 +01:00
Andreas Arnez
54c0a49bca Bug 495470 - s390x: Add s390-opcodes.csv to distribution
Include s390-opcodes.csv in the distribution, since it is referenced in
README.s390.
2024-10-29 18:23:25 +01:00
Mark Wielaard
1ad4fbf86a Set version to 3.24.0-RC1
Also update vg-lifespan which is used for documentation copyright years.
2024-10-28 00:19:45 +01:00
Andreas Arnez
5d404b97d4 s390x: Add MSA support
Handle instructions that were added to z/Architecture with the
message-security assist (MSA) facility or with one of its extensions up to
MSA extension 9:

   km -- ``cipher message''
   kmc -- ``cipher message with chaining''
   kimd -- ``compute intermediate message digest''
   klmd -- ``compute last message digest''
   kmac -- ``compute message authentication code''
   kmf -- ``cipher message with cipher feedback''
   kmctr -- ``cipher message with counter''
   kmo -- ``cipher message with output feedback''
   pcc -- ``perform cryptographic computation''
   kma -- ``cipher message with authentication''
   kdsa -- ``compute digital signature authentication''

Each of these instructions has multiple functions.  Support all functions
described by MSA levels up to extension 9.  Handle the instructions as
"extensions" and essentially forward them to the instructions themselves,
as long as they are available on the host.

Note that the MSA-3 instruction

   pkcmo -- ``perform cryptographic key management operation''

will not be handled by this change, since it is privileged and should not
occur in user-space programs.

The MSA facilities are typically used by cryptographic libraries like
OpenSSL or openCryptoki.  So far Valgrind suppresses the facility bits
indicating any MSA support, which causes such libraries to revert to a
software implementation.

This change enables running cryptographic applications under Valgrind
without reverting to an alternate code path.
2024-09-10 18:38:49 +02:00
Paul Floyd
022fc29d5f doc FAQ: add items for common code causes of 'Mismatched' errors
(when there is no fault in the code).
2024-06-16 21:13:16 +02:00
Andreas Arnez
fef1d8f01d s390x: Support the deflate-conversion facility (DFLTCC)
So far the DFLTCC (deflate conversion call) instruction is not supported
by Valgrind.  Similar to PRNO and NNPA, it is a "complex" instruction
whose memory effects cannot be adequately expressed with a dirty helper.

Add support for the DFLTCC instruction using the new "extension" mechanism
and reflect this accordingly in the supported facilities and HWCAPs.
2024-05-15 14:32:42 +02:00
Mark Wielaard
ef25b48d4f Add some website spelling fixes to xml files
Pick up some commits from valgrind-htdocs:

commit d97a1a24e

    Fix description of memory xtree.

    Was referring to function g2 which is not present in the screenshot.

    Suggested by Fabien Launay on valgrind-developers.

commit bc2801d98

Fix a few "the the" usages.

    One reported by Fabien Launay on valgrind-developers. The other
    two found with grep. There's a fourth one, but it's in a patch
    file so I've left it for now.

commit acc56391e

    Consistent spelling of visualize(r)

    Suggested by Fabien Launay on valgrind-developers

    I checked my Shorter Oxford English Dictionary, and there it is
    with a z. Good enough for me.
2024-04-26 21:21:08 +02:00
Andreas Arnez
0d1e0c997b s390x: Add support for the `NNPA' instruction
Finalize the NNPA facility support by handling the NNPA instruction
itself, using the new "extension" approach.  Also reflect NNPA facility
support in HWCAP and in the STFLE bits.
2024-04-25 14:38:49 +02:00
Alexandra Hájková
09b5ad416c Improve file descriptor xml output, add fd and path elements
Add needs_xml_output to none tool so it can also output xml when
--track-fds enabled.

Use xml protocolversion 5 when clo_track_fds is enabled

Split OpenFD pathname and description. Add description when a file
descriptor is closed so it can be used in a future error. On error
print <fd> element and (if known) a <path> element.

Add docs/internals/xml-output-protocol5.txt.

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

Co-Authored-By: Mark Wielaard <mark@klomp.org>
2024-04-19 02:04:21 +02:00
Philippe Waroquiers
97386027d6 Allow to see more details about suppressed errors.
Extend --show-error-list=no|yes with all to allow to look also the
list of suppressed errors and see which supp entry is suppressing it.
Add an option also_suppressed in the monitor command 'c.vinfo all_errors'
to similarly be able to show the suppressed errors.

Small fix in check_makefile_consistency: avoid it considers emacs ~ files.
2024-04-14 15:39:06 +02:00
Andreas Arnez
901df047ce s390x: Update tracking of implemented insns for z16
List the instructions first introduced with z16 in s390-opcodes.csv.  Also
mention the unimplemented ones in guest_s390_toIR.c and add new extended
mnemonics to the script s390-check-opcodes.pl.  For ease of use, add
support for invoking the script without command line arguments.
2024-03-28 19:11:43 +01:00
Paul Floyd
62cda3da36 manpage: a few changes for realloc size zero and give FreeBSD a few mentions 2024-02-09 21:55:21 +01:00
Nicholas Nethercote
bc2f62950c Fix an error in docs/README. 2023-08-23 16:45:36 +10: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
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
96a66dfda6 doc: Add asan equivalent to --realloc-zero-bytes-frees to manual-core 2023-03-11 16:47:56 +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