On Wed, 2013-08-07 at 08:13 -0700, John Reiser wrote:
> > Is there any support in memcheck for a client request to treat a block of memory as read-only? I know memory can be defined as accessible/not accessible or defined/undefined, but I don’t see anything for “writable”. It would be really nice to be able to add client requests so that after a block of
> > memory is initialized, to be able to tell memcheck that certain bytes should never be written again, because they have been initialized (e.g. pointer to another object).
>
> No; "read only" is not one of the states in the current memory accounting info.
Effectively.
memcheck/mc_main.c gives some background info:
Aside: the V+A bits are less precise than they could be -- we have no way
of marking memory as read-only. It would be great if we could add an
extra state VA_BITSn_READONLY. But then we'd have 5 different states,
which requires 2.3 bits to hold, and there's no way to do that elegantly
-- we'd have to double up to 4 bits of metadata per byte, which doesn't
seem worth it.
|