From 6e53f60e2c2aea57ecee63ff46dbc8ce0f617989 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 25 Jan 2005 22:13:10 +0000 Subject: [PATCH] Added support for protection flag B_USER_CLONEABLE_AREA. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11045 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/core/vm/vm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kernel/core/vm/vm.c b/src/kernel/core/vm/vm.c index 176f48e11f..77273d6d29 100755 --- a/src/kernel/core/vm/vm.c +++ b/src/kernel/core/vm/vm.c @@ -1127,8 +1127,10 @@ vm_clone_area(aspace_id aid, const char *name, void **address, uint32 addressSpe return ERR_VM_INVALID_REGION; } - if (sourceArea->aspace == kernel_aspace && aspace != kernel_aspace) { - // kernel areas must not be cloned in userland + if (sourceArea->aspace == kernel_aspace && aspace != kernel_aspace + && !(sourceArea->protection & B_USER_CLONEABLE_AREA)) { + // kernel areas must not be cloned in userland, unless explicitly + // declared user-cloneable upon construction status = B_NOT_ALLOWED; } else { vm_cache_acquire_ref(sourceArea->cache_ref, true);