Using the below testcase, running the program under valgrind 3.6.1 fails 
with ENOMEM. I am using the openSUSE Factory package (there are some 
patches in there[1]).

[1] 
https://build.opensuse.org/package/files?package=valgrind&project=openSUSE:Factory

---
#define _GNU_SOURCE 1
#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

int main(void)
{
        char buf[256];
        void *area = mmap((void *)0x10000000, 4096, PROT_READ|PROT_WRITE,
                MAP_ANONYMOUS|MAP_PRIVATE,0,0);
        printf("area= %p\n", area);
        strcpy(area, "Hello World");
        void *a2 = mremap((void *)0x10000000, 4096, 40960, 0);
        if (a2 == MAP_FAILED) {
                perror("mremap");
                abort();
        }
        printf("area= %p\n", a2);
        printf("%s\n", a2);
        snprintf(buf, sizeof(buf), "cat /proc/%u/maps", getpid());
        system(buf);
        return 0;
}

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to