Hi,

recently i have faced the problem that valgrind fails to start on my
linux amd64 laptop with the following error (specific mmap address may
change depending on checked app, this one for simple "Hello, World"):
 
valgrind: mmap(0x600000, 8192) failed in UME with error 12 (Cannot
allocate memory).

I bisected linux kernel and found, that the problem is bacause of this
patch https://lkml.org/lkml/2015/12/14/72 . Patch classifies all memory
allocation (brk and mmap) in several groups and add checks against
respective rlimits. When memcheck-amd64-linux starts it set RLIMIT_DATA
to 0, but then it tries to mmap part of checked app binary with the
following call (reported by strace):

mmap(0x600000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0)

which fails, because PROT_WRITE MAP_PRIVATE mappings are now classified
as a data (and it sounds reasonable to me, because private writeable mmap
is essentialy an allocation), and therefore check agains RLIMIT_DATA
fails.

I don't know the logic behind setting RLIMIT_DATA to 0, but after i
commend out setrlimit call in the coregrind/m_main.c the problem was
gone. Is it a valgrind bug to assume that mmap isn't subject for
RLIMIT_DATA limit?

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to