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

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

Issue 371047: Allow the seccomp sandbox to be enabled, even if the suid sandbox has... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
1 #include "debug.h" 1 #include "debug.h"
2 #include "sandbox_impl.h" 2 #include "sandbox_impl.h"
3 3
4 namespace playground { 4 namespace playground {
5 5
6 int Sandbox::sandbox_munmap(void* start, size_t length) { 6 int Sandbox::sandbox_munmap(void* start, size_t length) {
7 Debug::syscall(__NR_munmap, "Executing handler"); 7 Debug::syscall(__NR_munmap, "Executing handler");
8 struct { 8 struct {
9 int sysnum; 9 int sysnum;
10 long long cookie; 10 long long cookie;
11 MUnmap munmap_req; 11 MUnmap munmap_req;
12 } __attribute__((packed)) request; 12 } __attribute__((packed)) request;
13 request.sysnum = __NR_munmap; 13 request.sysnum = __NR_munmap;
14 request.cookie = cookie(); 14 request.cookie = cookie();
15 request.munmap_req.start = start; 15 request.munmap_req.start = start;
16 request.munmap_req.length = length; 16 request.munmap_req.length = length;
17 17
18 long rc; 18 long rc;
19 SysCalls sys; 19 SysCalls sys;
20 if (write(sys, processFdPub(), &request, sizeof(request)) != 20 if (write(sys, processFdPub(), &request, sizeof(request)) !=
21 sizeof(request) || 21 sizeof(request) ||
22 read(sys, threadFdPub(), &rc, sizeof(rc)) != sizeof(rc)) { 22 read(sys, threadFdPub(), &rc, sizeof(rc)) != sizeof(rc)) {
23 die("Failed to forward munmap() request [sandbox]"); 23 die("Failed to forward munmap() request [sandbox]");
24 } 24 }
25 return static_cast<int>(rc); 25 return static_cast<int>(rc);
26 } 26 }
27 27
28 bool Sandbox::process_munmap(int parentProc, int sandboxFd, int threadFdPub, 28 bool Sandbox::process_munmap(int parentMapsFd, int sandboxFd, int threadFdPub,
29 int threadFd, SecureMem::Args* mem) { 29 int threadFd, SecureMem::Args* mem) {
30 // Read request 30 // Read request
31 SysCalls sys; 31 SysCalls sys;
32 MUnmap munmap_req; 32 MUnmap munmap_req;
33 if (read(sys, sandboxFd, &munmap_req, sizeof(munmap_req)) != 33 if (read(sys, sandboxFd, &munmap_req, sizeof(munmap_req)) !=
34 sizeof(munmap_req)) { 34 sizeof(munmap_req)) {
35 die("Failed to read parameters for munmap() [process]"); 35 die("Failed to read parameters for munmap() [process]");
36 } 36 }
37 37
38 // Cannot unmap any memory region that was part of the original memory 38 // Cannot unmap any memory region that was part of the original memory
(...skipping 16 matching lines...) Expand all
55 } 55 }
56 56
57 // Unmapping memory regions that were newly mapped inside of the sandbox 57 // Unmapping memory regions that were newly mapped inside of the sandbox
58 // is OK. 58 // is OK.
59 SecureMem::sendSystemCall(threadFdPub, false, -1, mem, __NR_munmap, 59 SecureMem::sendSystemCall(threadFdPub, false, -1, mem, __NR_munmap,
60 munmap_req.start, munmap_req.length); 60 munmap_req.start, munmap_req.length);
61 return true; 61 return true;
62 } 62 }
63 63
64 } // namespace 64 } // 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