Commit graph

10 commits

Author SHA1 Message Date
Vladimir Panteleev
7cdae6e3bb
Add Valgrind GC integration (#15304)
* rt.minfo: Avoid calling realloc with size 0

This is not portable, and memcheck complains about this.

* Add C Valgrind API

Add the BSD-licensed C header files which provide the API for
controlling Valgrind from within programs executed under it.

The files are from Valgrind v3.21.0.

* Add some D bindings for the Valgrind C API

We will use these in the GC implementation to tell Valgrind which
memory operations are OK or not.

* Silence Valgrind warnings caused by GC marking

Allow the conservative GC to scan memory, whether it has been
initialized by the application or not.

* Add test suite for Valgrind

* Unify VALGRIND with MEMSTOMP

The two share the same goal: mark memory which should not be accessed
any more.

* Mask "invalid" access to free lists

The GC stores free lists in the cells of the objects on the list.

We would like to allow the GC to work with these lists, but still
raise a warning if application code attempts to access them.

* Distinguish between writable and unwritable invalidation

Freshly allocated memory should be writable but not readable.

Explicitly deallocated or GC-ed memory should be neither readable or
writable.

* Add use-after-free test

* Invalidate freshly-allocated memory

* Integrate VALGRIND with SENTINEL

* Fix reporting of arrays of structs with destructors

* Re-invalidate reused blocks during malloc/calloc

* Add Changelog entry

* .pre-commit-config.yaml: Exempt vendored files

* etc.valgrind.valgrind: Propagate return values of the vbits functions

* etc.valgrind.valgrind: Add documentation for functions

Copy/adapt the documentation in memcheck.h.

* druntime/test/valgrind: Add no_use_after_gc test

* ci/cirrusci.sh: Install Valgrind on Linux

Run the Druntime Valgrind integration tests.

libc6-dbg is needed to allow Valgrind to redirect certain functions.

* etc.valgrind.valgrind: Add @nogc

Although the GC is the primary user, this is not a restriction of
these Valgrind API wrappers.

* druntime/test/valgrind: Fix no_use_after_gc test with -release

Trick the optimizer to pretend we're doing something with the result
of those invalid memory accesses.
2023-06-15 01:01:42 -07:00
Luís Ferreira
9316ed0163 chore(pre-commit): update hooks
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2023-05-10 08:21:12 +08:00
Luís Ferreira
b2db9ad957
chore(pre-commit): update pre-commit hooks (#14534)
Hook 'sirosen/check-jsonschema' updated from 0.17.1 to 0.18.3.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-10-10 06:42:01 +03:00
Luís Ferreira
3d3d65afcb
chore(pre-commit): update hook versions (#14346)
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-08-02 19:39:48 +08:00
Iain Buclaw
6374bb87b7 Move dmd files into compiler/ 2022-07-09 18:53:07 +02:00
Luís Ferreira
5f62751155 chore(pre-commit): bump hook versions
- Updated hook https://github.com/sirosen/check-jsonschema from version
  0.14.2 to version 0.15.1.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-05-29 22:50:23 +00:00
Luís Ferreira
3cea26d5e0 chore(pre-commit): bump hook versions
Updated versions:
- pre-commit/pre-commit-hooks: v4.1.0 -> v4.2.0
- sirosen/check-jsonschema: 0.14.1 -> 0.14.2

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-04-12 02:30:36 +00:00
Luís Ferreira
bb1f90b6db ci(pre-commit): update sirosen/check-jsonschema hook from 0.14.0 to 0.14.1
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-03-29 21:40:18 +01:00
Luís Ferreira
bf79a034f2 ci(pre-commit): add end-of-file-fixer hook
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-03-22 23:53:31 +00:00
Luís Ferreira
5e1e5c190a
ci(pre-commit): add pre-commit configuration (#13760)
Signed-off-by: Luís Ferreira <contact@lsferreira.net>
2022-03-21 11:31:57 +02:00