Jinoh Kang (@iamahuman) commented about server/mapping.c:
return page_mask + 1;
}
+struct object *create_object_mapping( struct object *object, mem_size_t size, void **ptr ) +{
- static const unsigned int access = FILE_READ_DATA | FILE_WRITE_DATA;
- struct mapping *mapping;
- void *tmp;
- if (!(mapping = create_mapping( object, NULL, 0, size, SEC_COMMIT, 0, access, NULL ))) return NULL;
- if ((tmp = mmap( NULL, mapping->size, PROT_WRITE, MAP_SHARED, get_unix_fd( mapping->fd ), 0 )) == MAP_FAILED)
Unlike `user_shared_data`, the server sometimes actually *read* from the object mapping. Therefore, we need `PROT_READ` to make it clear, keep any potential mprotect-sensitive sandboxes happy, and be portable for future architectures that don't have write-implies-read (which are admittedly rare).
```suggestion:-0+0 if ((tmp = mmap( NULL, mapping->size, PROT_READ | PROT_WRITE, MAP_SHARED, get_unix_fd( mapping->fd ), 0 )) == MAP_FAILED) ```