https://bugs.kde.org/show_bug.cgi?id=357833

            Bug ID: 357833
           Summary: Valgrind is broken on recent linux kernel
           Product: valgrind
           Version: 3.10.0
          Platform: Compiled Sources
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: memcheck
          Assignee: jsew...@acm.org
          Reporter: krinkin....@gmail.com

Valgrind fails to start on recent linux-next with the following error:

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.

Reproducible: Always

Steps to Reproduce:
1. git clone
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
2. cd linux-next
3. git checkout 1f4ea4be97bea8f6d10ebbfef15d32511a81bcc4
4. configure and build linux kernel
5. create and compile a simple "Hello, World"
6. run the program under valgrind on the compiled linux kernel

Actual Results:  
valgrind fails with error:
valgrind: mmap(0x600000, 8192) failed in UME with error 12 (Cannot allocate
memory)

Expected Results:  
valgrind finishes successfully without errors

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to