RPCEmu on Genode

Norman Feske norman.feske at genode-labs.com
Thu Oct 15 22:02:14 CEST 2020


Hi Michael,

> Thanks for the example , however .. I didn't say at first , the engine
> already has a area and uses mprotect on it.
> So now passing local address -> region conflict error.

Genode does not allow the changing of mapping attributes after the fact.
Hence, mprotect cannot work. I'm afraid that there is no way around
modifying the engine with respect to the allocation of the buffer used
for the JIT instructions.

Since you are using the libc, the cleanest way forward would be the mmap
(PROT_EXEC) approach. You are right that (our current version of) mmap
does not support the passing of -1 as fd. But passing a valid file
descriptor is supposed to work, for example:

  int const zero_fd = open("/dev/zero", O_RDWR);

  void *ptr = mmap((void *)-1, 1024*512,
                   PROT_EXEC, MAP_ANONYMOUS, zero_fd, 0);

  close(zero_fd);

  printf("mmap returned ptr=%p\n", ptr);

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

https://www.genode-labs.com · https://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth



More information about the users mailing list