Files
mbedtls-framework/tests
Gilles Peskine be3764a69f Work around Valgrind hooking into _exit()
When running tests that use mbedtls_test_fork_run_child() under Valgrind,
bad things happen. Specifically:

* Valgrind reports leaks in the child. Those leaks do exist, but they're
  deliberate since we avoid cleaning up in the child (because we want to
  do as little as possible in the child, and because cleanups such as
  destroying PSA persistent keys would have undesirable effects outside
  the child process).
* Valgrind's overridden `_exit()` doesn't just perform checks, but also for
  some reason it causes the file description on the .datax file to seek
  backwards, causing tests to run again in a loop.

Avoid this by calling `execve()` (via `execlp()`) rather than `_exit()` if
it looks like the test is run under Valgrind. This is safe as long as
Valgrind isn't run with `--trace-children=yes`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2026-03-23 19:24:18 +01:00
..
2025-02-19 15:17:23 +00:00
2025-02-19 15:17:23 +00:00