From aa05f00e7e155e98aeb9526d3db808948f730960 Mon Sep 17 00:00:00 2001 From: NAKAMURA Gou Date: Wed, 8 Oct 2014 20:05:38 +0900 Subject: [PATCH] don't map syscall pages into process space Request pages, response pages, and a doorbell page are mapped into process space to enable user processes to delegate system calls directly to mcctrl/mcexec. This commit removes these mappings for the following reasons. - These mappings cause a memory leak in current fork() implementation. - These mappings are not used. - These mappings do not function properly. And the fix which corrects function of these mappings is not easy. --- kernel/host.c | 30 +----------------------------- kernel/include/syscall.h | 3 +-- 2 files changed, 2 insertions(+), 31 deletions(-) diff --git a/kernel/host.c b/kernel/host.c index 29a6e64b..cc595b3a 100644 --- a/kernel/host.c +++ b/kernel/host.c @@ -191,38 +191,10 @@ int prepare_process_ranges_args_envs(struct process *proc, proc->vm->region.data_end; #endif - /* Map system call stuffs */ - flags = VR_RESERVED | VR_PROT_READ | VR_PROT_WRITE; - flags |= VRFLAG_PROT_TO_MAXPROT(flags); - addr = proc->vm->region.map_start - PAGE_SIZE * SCD_RESERVED_COUNT; - e = addr + PAGE_SIZE * DOORBELL_PAGE_COUNT; - if(add_process_memory_range(proc, addr, e, - cpu_local_var(scp).doorbell_pa, - VR_REMOTE | flags, NULL, 0) != 0){ - kprintf("ERROR: adding memory range for syscalls dorbell\n"); - goto err; - } - addr = e; - e = addr + PAGE_SIZE * REQUEST_PAGE_COUNT; - if(add_process_memory_range(proc, addr, e, - cpu_local_var(scp).request_pa, - VR_REMOTE | flags, NULL, 0) != 0){ - kprintf("ERROR: adding memory range for syscalls request pa\n"); - goto err; - } - addr = e; - e = addr + PAGE_SIZE * RESPONSE_PAGE_COUNT; - if(add_process_memory_range(proc, addr, e, - cpu_local_var(scp).response_pa, - flags, NULL, 0) != 0){ - kprintf("ERROR: adding memory range for syscalls response pa\n"); - goto err; - } - /* Map, copy and update args and envs */ flags = VR_PROT_READ | VR_PROT_WRITE; flags |= VRFLAG_PROT_TO_MAXPROT(flags); - addr = e; + addr = proc->vm->region.map_start - PAGE_SIZE * SCD_RESERVED_COUNT; e = addr + PAGE_SIZE * ARGENV_PAGE_COUNT; if((args_envs = ihk_mc_alloc_pages(ARGENV_PAGE_COUNT, IHK_MC_AP_NOWAIT)) == NULL){ diff --git a/kernel/include/syscall.h b/kernel/include/syscall.h index 284930aa..543ef47b 100644 --- a/kernel/include/syscall.h +++ b/kernel/include/syscall.h @@ -22,8 +22,7 @@ #define RESPONSE_PAGE_COUNT 16 #define DOORBELL_PAGE_COUNT 1 #define ARGENV_PAGE_COUNT 8 -#define SCD_RESERVED_COUNT \ - (REQUEST_PAGE_COUNT + RESPONSE_PAGE_COUNT + DOORBELL_PAGE_COUNT + ARGENV_PAGE_COUNT) +#define SCD_RESERVED_COUNT ARGENV_PAGE_COUNT #define SCD_MSG_PREPARE_PROCESS 0x1 #define SCD_MSG_PREPARE_PROCESS_ACKED 0x2