From 25d12fc0fc51f1fae0f85b4649a6463eb805aa8f Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 16 Aug 2014 02:41:45 -0400 Subject: optimize locking against vm changes for mmap/munmap the whole point of this locking is to prevent munmap, or mmap with MAP_FIXED, from deallocating virtual addresses, or changing the backing a given virtual address refers to, during certain race windows involving self-synchronized unmapping or destruction of pthread synchronization objects. there is no need for exclusion in the other direction, so it suffices to take the lock momentarily and release it before making the syscall, rather than holding it across the syscall. --- src/mman/munmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/mman/munmap.c') diff --git a/src/mman/munmap.c b/src/mman/munmap.c index 8488d75c..359c691f 100644 --- a/src/mman/munmap.c +++ b/src/mman/munmap.c @@ -11,8 +11,8 @@ int __munmap(void *start, size_t len) { int ret; __vm_lock(-1); - ret = syscall(SYS_munmap, start, len); __vm_unlock(); + ret = syscall(SYS_munmap, start, len); return ret; } -- cgit v1.2.1