Anticipating Valgrind 3.27.0

We’ll release Valgrind 3.27.0 later today. While making sure the NEWS file was up to date I wrote about all the contributions made this release.

Thanks all, and apologies if I missed something or someone.

Aaron Merey added two new options to helgrind.

To control helgrind tracing of internal synchronization, threading and memory events use –show-events=1|2|3.

Use –track-destroy=no|yes|all to checks for missing pthread_mutex_destroy and pthread_rwlock_destroy calls. With yes, helgrind warns when pthread_mutex_init or pthread_rwlock_init is called on the address of a live (undestroyed) lock. With all, Helgrind also reports undestroyed locks at process exit.

Valgrind has separate VEX IR translators for AMD64 and x86 (32 bit) code. While the AMD64 translator has seen support for new encodings and instruction sets, the x86 translator has not.

Alexandra Hájková decided to port the SSE4.1 instruction set from the AMD64 translator to the x86 translator and add backend support. This is ongoing work, see the bug dependency tree.

But many more 32bit programs using SSE4.1 should now run under Valgrind.

Andreas Arnez and Florian Krohm did a lot of work on the s390x support.

Andreas added support for new s390x z/Architecture features from the 15th edition. This enables running binaries compiled with -march=arch15 or -march=z17 and exploiting the new MSA extensions 10-13.

Florian Krohm integrated binutils objdump for s390x disassembly in VEX. And did a lot of s390x code and facilities cleanups.
s390x machine models older than z196 are no longer supported.

Andreas also showed there are still meaningful optimizations to be made on how memcheck tracks undefinedness bits as outlined in the original “Using Valgrind to detect undefined value errors with bit-precision” paper.

His optimization of memcheck instrumenting a bitwise AND/OR with a constant is clever and simplifies the generated code.

Martin Cermak maintains the Linux Test Program (LTP) valgrind integration, which checks our syscall wrappers work correctly. And he makes sure newer linux syscalls are wrapped. Valgrind 3.27.0 adds support for file_getattr, file_setattr, lsm_get_self_attr, lsm_set_self_attr, lsm_list_modules. And corrects various syscall and ioctl corner cases.

Martin also added Valgrind address space manager support for tracking linux kernel lightweight guard pages, created through madvise (MADV_GUARD_INSTALL).

These guard pages are very low overhead for the kernel because they aren’t tracked as separate VMAs and don’t show up in the process proc maps. But Valgrind does still need to know whether the addresses are accessible. A new –max-guard-pages option controls the memory Valgrind reserves for tracking these pages.

Paul Floyd had more commits than all others combined for this release. Paul takes care of the alternative toolchains, Solaris/illumos, FreeBSD and Darwin/MacOS ports.

Tested Oracle Solaris 11.4, OpenIndiana Hipster and OmniOS.
FreeBSD works on both amd64 and arm64, support for 16.0-CURRENT has been added.

Supported MacOS versions, 10.13 (bug fixes), 10.14, 10.15, 11.0 (Intel only), 12.0 (Intel only), 13.0 (Intel only, preliminary). No arm64 support yet.

A lot of code in valgrind 3.27.0 to support MacOS was previously maintained by Louis Brunner out of tree.

There are two new client requests (macros defined in valgrind.h)

  • VALGRIND_REPLACES_MALLOC Returns 1 if the tool replaces malloc (e.g., memcheck). Returns 0 if the tool does not replace malloc (e.g., cachegrind and callgrind) or if the executable is not running under Valgrind.
  • VALGRIND_GET_TOOLNAME Get the running tool name as a string. Takes two arguments, an input buffer pointer and the length of that buffer.

classpath.org domain is back!

The classpath.org domain expired a couple of days ago and none of the subdomain, like planet, devel, icedtea resolved. Oops. It has been renewed for at least 5 years now.

Supporting Software Freedom Conservancy in 2025

Lots of vintage sfconservancy t-shirts

The Software Freedom Conservancy Fundraiser runs for another 2 weeks. Please become a Sustainer, renew your existing membership or donate before January 15th to maximize your contribution to furthering the goals of software freedom!

They have been a great partner to Sourceware, putting users, developers and community first.

dancing banana
Become a Conservancy Sustainer!

Valgrind 3.23.0-RC1

Valgrind 3.23.0-RC1. Please help test.

FreeBSD arm64 support. --track-fds=yes now warns against double close, generates (suppressible) errors and supports XML output. s390x supports more z16 instructions. More accurate x86_64-v3 instruction support. Wrappers for wcpncpy, memccpy, strlcat and strlcpy. Support Linux syscalls mlock2, fchmodat2, pidfd_getfd. And much more. 50+ bug fixes, 280+ commits by 14 developers since 3.22.0.

Fedora rawhide binary packages are available for aarch64, i686, ppc64le, s390x and s390x.

Software Freedom Conservancy Fundraiser

The Software Freedom Conservancy Fundraiser runs for another 4 days. We urge you to become a Sustainer, renew your existing membership or donate before January 15th to maximize your contribution to furthering the goals of software freedom!

They have been a great partner to Sourceware, helping with the GNU Toolchain Infrastructure, putting developers and community first.

Valgrind 3.22.0

We are pleased to announce a new release of Valgrind, version 3.22.0, available from https://valgrind.org/downloads/current.html.

See the release notes for details of changes.

Our thanks to all those who contribute to Valgrind’s development. This release represents a great deal of time, energy and effort on the part of many people.

Happy and productive debugging and profiling,

— The Valgrind Developers

Sourceware 25 Roadmap

Sourceware has been running for almost 25 years, providing a worry-free, developer friendly home for Free Software core toolchain and developer tool communities. And we would like to keep providing that for the next 25 years.

That is why in the last couple of years we have started to diversify our hardware partners, setup new services using containers and isolated VMs, investigated secure supply chain issues, added redundant mirrors, created a non-profit home, collected funds, invested in open communication, open office hours and introduced community oversight by a Sourceware Project Leadership Committee with the help from the Software Freedom Conservancy.

Please participate and let us know what more we (and you!) can do to make Sourceware and all hosted projects a success for the next 25 years.

Full history and roadmap for the next 25 on sourceware.org: Sourceware 25 Roadmap.

Checking usage of realloc with Valgrind

Full article: Checking usage of realloc with Valgrind

Summary: realloc has a surprising number of tricky corner cases to watch out for. Valgrind Memcheck will help you find various issues like using it with bad arguments, pointers that might have become invalid, and leaks of blocks that have been resized.

Also, don’t forget to use GCC with -fanalyzer, -Wuse-after-free, and -Wfree-nonheap-object to catch some of these issues early.

Finally, there is the almost philosophical question of what it means to have a zero-sized memory block. Since different implementations of (and standards describing) realloc answer that question differently, it is best to avoid ever calling realloc with size zero.

If you do then Valgrind 3.21.0 has two options to help:

  • --show-realloc-size-zero=no|yes. Warn for size zero realloc calls.
  • --realloc-zero-bytes-frees=yes|no. Whether size zero returns NULL or not.

Both options were implemented by Paul Floyd.

Sourceware joins the fediverse

A few weeks back Sourceware joined the Software Freedom Conservancy. This week Sourceware joins the fediverse at @sourceware@fosstodon.org.

The account will be used for Sourceware announcements, notices about downtime and temporary issues with our network.

Sourceware is run by volunteers who can be contacted on the public overseers@sourceware.org mailinglist [inbox].

Or you can file an issue in the Sourceware Infrastructure bugzilla component.

There is also an irc channel #overseers on irc.libera.chat. Overseers Open Office hours take place in the same irc channel every second Friday of the month at UTC 18:00.

Sourceware joins Software Freedom Conservancy

Sourceware
Software Freedom Conservancy

After various discussions and lots of positive feedback Software Freedom Conservancy and Sourceware proudly announce that Sourceware today joins SFC as a member project!

For almost 25 years Sourceware has been the long-time home of various core toolchain project communities. Projects like Cygwin, a UNIX API for Win32 systems, the GNU Toolchain, including GCC, the GNU Compiler Colection, two C libraries, glibc and newlib, binary tools, binutils and elfutils, debuggers and profilers, GDB, systemtap and valgrind. Sourceware also hosts standard groups like gnu-gabi and the DWARF Debugging Standard. See the full list project hosted and services provided on the Sourceware projects page.

As the fiscal host of Sourceware, Software Freedom Conservancy will provide a home for fundraising, legal protection and governance that will benefit all projects under Sourceware’s care.  We share one mission: developing, distributing and advocating for Software Freedom.  Together we will offer a worry-free, friendly home for core toolchain and developer tool projects.