Hi,

I have been having some trouble with the Region Map interface not setting the 
correct permissions in my specified memory region. I am trying to replicate a 
similar functionality to rm_nested:

```cpp
  const addr_t OBJECT_SPACE_START = 0x80000000;
  const addr_t OBJECT_SPACE_SIZE = 0x40000000;

  Genode::Env &_env;
  Genode::Rm_connection _rm{_env};

  // To be attached to env's rm
  Genode::Region_map_client _obj_space{_rm.create(OBJECT_SPACE_SIZE)};

  ...


  Region_map::Attr attributes{.size = OBJECT_SPACE_SIZE,
                                .offset = 0,
                                .use_at = true,
                                .at = OBJECT_SPACE_START,
                                .executable = true,
                                .writeable = true};

    addr_t ptr_obj = 0;
    env.rm()
    .attach(_obj_space.dataspace(), attributes)
        .with_result(
            [&ptr_obj](Genode::Env::Local_rm::Attachment &attachment) {
              ptr_obj = (Genode::addr_t)attachment.ptr;
              attachment.deallocate = false;
            },
            [](auto) {
              error("couldn't attach dataspace!");
              throw;
            });

```

I expect this code snippet to make the region at 0x80000000 to be rwx, however 
when I run my program with GDB I see that the permissions are ---p:

(gdb) info proc mappings
Mapped address spaces:

          Start Addr           End Addr            Size              Offset   
Perms  objfile
        0x80000000         0xc0000000      0x40000000        0x0    ---p

I have also tried adding a dataspace capability to _obj_space ( before 
attaching it to env.rm() ) but that had no effect on the permissions:

```cpp
    _obj_space.attach(env.ram().alloc(OBJECT_SPACE_SIZE), attributes);
```

Any help / suggestions would be greatly appreciated as I have been stuck on 
this for quite a while!

Best,
Rumen

P.S. The permissions are set correctly when I do:

```cpp
    addr_t ptr_obj = 0;
    env.rm()
      .attach(env.ram().alloc(OBJECT_SPACE_SIZE), attributes)
        .with_result(
            [&ptr_obj](Genode::Env::Local_rm::Attachment &attachment) {
              ptr_obj = (Genode::addr_t)attachment.ptr;
              attachment.deallocate = false;
            },
            [](auto) {
              error("couldn't attach dataspace!");
              throw;
            });
```

The problem with this is that later on in my program I get an error as I need 
the _obj_space region map client.
_______________________________________________
users mailing list -- users@lists.genode.org
To unsubscribe send an email to users-le...@lists.genode.org
Archived at 
https://lists.genode.org/mailman3/hyperkitty/list/users@lists.genode.org/message/5SEU7Z7EE7RIWGUB7T5H7F5EHTAU327B/

Reply via email to