Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: sandbox/linux/seccomp/munmap.cc

Issue 997009: Compute and pring the time that it takes to execute system calls. This data... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sandbox/linux/seccomp/mprotect.cc ('k') | sandbox/linux/seccomp/open.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "debug.h" 5 #include "debug.h"
6 #include "sandbox_impl.h" 6 #include "sandbox_impl.h"
7 7
8 namespace playground { 8 namespace playground {
9 9
10 int Sandbox::sandbox_munmap(void* start, size_t length) { 10 int Sandbox::sandbox_munmap(void* start, size_t length) {
11 Debug::syscall(__NR_munmap, "Executing handler"); 11 long long tm;
12 Debug::syscall(&tm, __NR_munmap, "Executing handler");
12 struct { 13 struct {
13 int sysnum; 14 int sysnum;
14 long long cookie; 15 long long cookie;
15 MUnmap munmap_req; 16 MUnmap munmap_req;
16 } __attribute__((packed)) request; 17 } __attribute__((packed)) request;
17 request.sysnum = __NR_munmap; 18 request.sysnum = __NR_munmap;
18 request.cookie = cookie(); 19 request.cookie = cookie();
19 request.munmap_req.start = start; 20 request.munmap_req.start = start;
20 request.munmap_req.length = length; 21 request.munmap_req.length = length;
21 22
22 long rc; 23 long rc;
23 SysCalls sys; 24 SysCalls sys;
24 if (write(sys, processFdPub(), &request, sizeof(request)) != 25 if (write(sys, processFdPub(), &request, sizeof(request)) !=
25 sizeof(request) || 26 sizeof(request) ||
26 read(sys, threadFdPub(), &rc, sizeof(rc)) != sizeof(rc)) { 27 read(sys, threadFdPub(), &rc, sizeof(rc)) != sizeof(rc)) {
27 die("Failed to forward munmap() request [sandbox]"); 28 die("Failed to forward munmap() request [sandbox]");
28 } 29 }
30 Debug::elapsed(tm, __NR_munmap);
29 return static_cast<int>(rc); 31 return static_cast<int>(rc);
30 } 32 }
31 33
32 bool Sandbox::process_munmap(int parentMapsFd, int sandboxFd, int threadFdPub, 34 bool Sandbox::process_munmap(int parentMapsFd, int sandboxFd, int threadFdPub,
33 int threadFd, SecureMem::Args* mem) { 35 int threadFd, SecureMem::Args* mem) {
34 // Read request 36 // Read request
35 SysCalls sys; 37 SysCalls sys;
36 MUnmap munmap_req; 38 MUnmap munmap_req;
37 if (read(sys, sandboxFd, &munmap_req, sizeof(munmap_req)) != 39 if (read(sys, sandboxFd, &munmap_req, sizeof(munmap_req)) !=
38 sizeof(munmap_req)) { 40 sizeof(munmap_req)) {
(...skipping 20 matching lines...) Expand all
59 } 61 }
60 62
61 // Unmapping memory regions that were newly mapped inside of the sandbox 63 // Unmapping memory regions that were newly mapped inside of the sandbox
62 // is OK. 64 // is OK.
63 SecureMem::sendSystemCall(threadFdPub, false, -1, mem, __NR_munmap, 65 SecureMem::sendSystemCall(threadFdPub, false, -1, mem, __NR_munmap,
64 munmap_req.start, munmap_req.length); 66 munmap_req.start, munmap_req.length);
65 return true; 67 return true;
66 } 68 }
67 69
68 } // namespace 70 } // namespace
OLDNEW
« no previous file with comments | « sandbox/linux/seccomp/mprotect.cc ('k') | sandbox/linux/seccomp/open.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698