Hi,

I currently have some code that tries to use mremap to put a mapping done
by the kernel into a different address, which I previously "reserved" with
an anonymous mmap. Something like this:

void *map;
map = mmap(NULL, BLOCK_POOL_MEMFD_SIZE, PROT_READ | PROT_WRITE,
           MAP_SHARED | MAP_ANONYMOUS, -1, 0);
/* check for MAP_FAILED */

/* some code to setup BO (buffer object) */
gem_handle = anv_gem_create(pool->device, size);
void *newmap;
newmap = anv_gem_mmap(pool->device, gem_handle, 0, size, 0);

/* this fails with MAP_FAILED*/
newmap = mremap(newmap, size, size, MREMAP_MAYMOVE | MREMAP_FIXED,
                     map + pool->size);



My (limited) understanding is that valgrind's mremap doesn't let me remap
an address that was allocated by the ioctl, since valgrind doesn't "own"
that memory. Is there some way around this, or this is never supposed to
work?

I also tried using VALGRIND_MAKE_MEM_DEFINED on the "newmap", but that
didn't make any difference.


Thank you,
Rafael

PS: Sorry for the formatting, sending this from gmail :-/
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to