|
From: John R. <jr...@bi...> - 2016-03-09 16:25:34
|
> Currently, my understanding is that valgrind memchecker can mark a > memory area as non accessible via the VALGRIND_MAKE_MEM_NOACCESS() > macro, but there is currently no way to mark it as read-only. Yes. READ_ONLY is not a recognized state. > if yes, is there any plan to develop such a feature ? No. The accounting bits are organized into two phases: is the address legal at all, and is the byte writable and initialized. Adding a new state READ_ONLY would be a large task with significant runtime costs. It might be best applied to the first phase, but complications regarding overlap [or splitting] between existing regions and new READ_ONLY regions, plus granularity assumptions (pages now, bytes for READ_ONLY) probably would be messy. >>From an OpenMPI developer point of view, it would be nice to mark the send > buffer as read-only between MPI_Isend() and MPI_Wait() so valgrind can trap > incorrect user code that modifies the send buffer when it is not allowed. Use LD_PRELOAD to intercept MPI_Isend() [etc.]. Allocate a new buffer, copy the message into it, mark the original buffer as NOACCESS, call the original MPI_Isend on the new buffer. Reverse the effects after the original MPI_Isend() is complete, waited, and checked. See the manual page for "man dlsym" and the RTLD_NEXT functionality. Search the web, too. |