ctgrind icon indicating copy to clipboard operation
ctgrind copied to clipboard

Patching not required

Open mpg opened this issue 1 year ago • 0 comments

First of all, I love the idea behind ctgrind, and having a way to actually test whether some piece of code has branches or memory accesses that depend on secret data is a tremendous addition to a developer's toolbox, so a big thank you for that!

I'm afraid some people who may benefit from this might be put off by having to patch valgrind, so to avoid that, I wanted to document that at least with recent versions of valgrind, this doesn't seem to be necessary, as valgrind already provides a macro doing what we want:

#include <valgrind/memcheck.h>
#define ct_poison VALGRIND_MAKE_MEM_UNDEFINED

I hope this helps more people test their code for secret-dependent branches and memory accesses.

mpg avatar Apr 24 '24 10:04 mpg