Bug 470713 - Failure on the Yosys project: valgrind: m_libcfile.c:1802 (Bool vgPlain_realpath(const HChar *, HChar *)): Assertion 'resolved' failed
When using sysctl kern proc pathname with the pid of the guest or -1
we need to intercept the call otherwise the syscall will return the path
of the memcheck tool and not the path of the guest.
This uses VG_(realpath), which asserts if it doesn't get valid
input pointers.
sysctl kern proc pathname can use a NULL pointer in order to
determine the length of the path (so users can allocate the minumum
necessary). The NULL pointer was being passed on to VG_(realpath)
without being checked, resulting in an assert.