diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-02-09 09:45:33 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2015-02-09 09:45:33 +0000 |
commit | efc2f7e3500ed7ddfa59e7e4e508c6700447a16c (patch) | |
tree | b5c40f26d05c6664c1e3c1c6dcc31b7c732ed515 /xserver/Xext/shm.c | |
parent | 21b767444a3096f0cb7d14b9c04f803fd103b483 (diff) |
Use __MAP_NOFAULT to map shared memory passed through file descriptors. This
completely avoids the risk of getting killed by a signal because the backing
storage isn't there.
Use the __-prefixed name for now, as we might still change the name.
ok deraadt@, matthieu@
Diffstat (limited to 'xserver/Xext/shm.c')
-rw-r--r-- | xserver/Xext/shm.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/xserver/Xext/shm.c b/xserver/Xext/shm.c index b78791836..744b93c42 100644 --- a/xserver/Xext/shm.c +++ b/xserver/Xext/shm.c @@ -1143,7 +1143,7 @@ ProcShmAttachFd(ClientPtr client) shmdesc->is_fd = TRUE; shmdesc->addr = mmap(NULL, statb.st_size, stuff->readOnly ? PROT_READ : PROT_READ|PROT_WRITE, - MAP_SHARED, + MAP_SHARED|__MAP_NOFAULT, fd, 0); close(fd); @@ -1234,7 +1234,7 @@ ProcShmCreateSegment(ClientPtr client) shmdesc->is_fd = TRUE; shmdesc->addr = mmap(NULL, stuff->size, stuff->readOnly ? PROT_READ : PROT_READ|PROT_WRITE, - MAP_SHARED, + MAP_SHARED|__MAP_NOFAULT, fd, 0); if ((shmdesc->addr == ((char *) -1))) { |