Is there any way to revoke write permissions to shared memory by the process who created that shared object, s.t. any other process who has mapped the shared memory to its virtual space with write permissions will fail when trying to actually write after the permissions were revoked?
At first I actually expected when revoking write permissions with
fchmod() on a shared memory object created with
shm_open(), that all subsequent writes by other processes who had the shared memory object already mapped with
mmap() will cause a segfault. But this is not the case.
Now I was wondering, if there is any other approach (syscall, shared memory API..) how to achieve my desired behavior?
I need the write permissions when registering the shared memory object for RDMA usage while bootstrapping my application. However, eventually I’d like to ensure that the local process is not able to write to the shared memory object.