From 5c6d7e2d2ba4c2ac9ae37c9d64091d2b49395a0e Mon Sep 17 00:00:00 2001 From: Mark Seaborn Date: Tue, 28 Apr 2009 22:36:30 +0100 Subject: [PATCH] Tidy ups of mapping code Remove unnecessary differences from upstream --- service_runtime/nacl_desc_io.c | 2 +- service_runtime/nacl_syscall_common.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/service_runtime/nacl_desc_io.c b/service_runtime/nacl_desc_io.c index efe617fc..b35984c8 100644 --- a/service_runtime/nacl_desc_io.c +++ b/service_runtime/nacl_desc_io.c @@ -149,7 +149,7 @@ int NaClDescIoDescMap(struct NaClDesc *vself, /* * prot must be PROT_NONE or a combination of PROT_{READ|WRITE} */ - if (0 != (~(NACL_ABI_PROT_READ | NACL_ABI_PROT_WRITE | NACL_ABI_PROT_EXEC) & prot)) { + if (0 != (~(NACL_ABI_PROT_READ | NACL_ABI_PROT_WRITE) & prot)) { NaClLog(LOG_INFO, ("NaClDescImcDescMap: prot has other bits" " than PROT_{READ|WRITE}\n")); diff --git a/service_runtime/nacl_syscall_common.c b/service_runtime/nacl_syscall_common.c index 7ec1b01b..fc02ee0d 100644 --- a/service_runtime/nacl_syscall_common.c +++ b/service_runtime/nacl_syscall_common.c @@ -1051,7 +1051,6 @@ int32_t NaClCommonSysMmap(struct NaClAppThread *natp, uintptr_t usraddr; uintptr_t usrpage; uintptr_t sysaddr; - uintptr_t sysaddr_code; uintptr_t endaddr; void *map_result; int holding_app_lock; @@ -1321,9 +1320,7 @@ int32_t NaClCommonSysMmap(struct NaClAppThread *natp, goto cleanup; } - /* Some later code converts this back to a relative address. */ - sysaddr = natp->nap->data_mem_start + usraddr; - sysaddr_code = natp->nap->code_mem_start + usraddr; + sysaddr = NaClUserToSys(natp->nap, usraddr); /* [0, length) */ if (length > 0) { @@ -1358,6 +1355,7 @@ int32_t NaClCommonSysMmap(struct NaClAppThread *natp, /* We could map the code into the data segment as well, if there are programs that really need this, but so far that is not necessary. */ + uintptr_t sysaddr_code = natp->nap->code_mem_start + usraddr; retval = VerifyAndMapCode(natp, ndp, sysaddr_code, offset, length); if (NaClIsNegErrno(retval)) goto cleanup; -- 2.11.4.GIT