|
From: Gilles G. <gil...@gm...> - 2016-03-09 06:37:00
|
Folks, 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. am i right ? if yes, is there any plan to develop such a feature ? Thanks, Gilles FWIW, here is the context. in MPI http://www.mpi-forum.org/, the MPI_Isend() function can be used for a non blocking send. Today's standard mandates the send buffer remains accessible during the send operation, but the end user should not modify it unless the send is complete (for example after MPI_Wait() returns). >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. |
|
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. |
|
From: Christoph N. <nie...@hl...> - 2016-03-14 09:52:31
|
Hi, Regarding your question about marking memory read only and using this for MPI Message checking I would recommend, you read the following paper from a former colleque of mine: Memory Debugging of MPI-Parallel Applications in Open MPI Rainer Keller, Shiqing Fan, and Michael Resch I'm currently re-evaluating the implementation with respect to a major Open MPI version update. If you are interested in it do not hesitate to contact me. Best regards Christoph Niethammer -- Christoph Niethammer High Performance Computing Center Stuttgart (HLRS) Nobelstrasse 19 70569 Stuttgart Tel: ++49(0)711-685-87203 email: nie...@hl... http://www.hlrs.de/people/niethammer ----- Original Message ----- From: "John Reiser" <jr...@bi...> To: "valgrind-users" <val...@li...> Sent: Wednesday, March 9, 2016 5:25:25 PM Subject: Re: [Valgrind-users] can memchecker mark memory as read-only ? > 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. ------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140 _______________________________________________ Valgrind-users mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-users |