summaryrefslogtreecommitdiffstats
path: root/sandbox/linux/seccomp/access.cc
diff options
context:
space:
mode:
authormarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-22 23:20:17 +0000
committermarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-22 23:20:17 +0000
commita1170ed12a730f79d4224779b90e35923c7bb729 (patch)
tree5991ab0bc1bf159e16fde015952704c04a9b8277 /sandbox/linux/seccomp/access.cc
parent18cec742ac18f7c99a357e57a659eed68397f8c6 (diff)
downloadchromium_src-a1170ed12a730f79d4224779b90e35923c7bb729.zip
chromium_src-a1170ed12a730f79d4224779b90e35923c7bb729.tar.gz
chromium_src-a1170ed12a730f79d4224779b90e35923c7bb729.tar.bz2
Merged Mark Seaborn's changes:
Add some automated tests for seccomp-sandbox This covers some of the syscalls that are proxied by the trusted process. This adds a basic test runner framework. Fix error return code for open() and other syscalls on x86-64 On error, the open() syscall was returning errno & 0xffffffff in %rax on x86-64 instead of -errno. This stops glibc from regarding this as an error, and so its syscall wrapper returns -errno instead of -1 and does not set errno. I have fixed up the other syscalls to use long (64-bit) instead of int (32-bit) as well. Not all of them were affected by the problem: it depends on gcc's code generation. Sometimes casting to int truncates a value, sometimes it doesn't. It seems better to be consistent though. Adds a test for open() and some other syscalls. TODO: Need to figure out how to run the tests automatically BUG=none TEST=none Review URL: http://codereview.chromium.org/1729003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/linux/seccomp/access.cc')
-rw-r--r--sandbox/linux/seccomp/access.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sandbox/linux/seccomp/access.cc b/sandbox/linux/seccomp/access.cc
index 50e94bb..a318e92 100644
--- a/sandbox/linux/seccomp/access.cc
+++ b/sandbox/linux/seccomp/access.cc
@@ -7,7 +7,7 @@
namespace playground {
-int Sandbox::sandbox_access(const char *pathname, int mode) {
+long Sandbox::sandbox_access(const char *pathname, int mode) {
long long tm;
Debug::syscall(&tm, __NR_access, "Executing handler");
size_t len = strlen(pathname);
@@ -32,7 +32,7 @@ int Sandbox::sandbox_access(const char *pathname, int mode) {
die("Failed to forward access() request [sandbox]");
}
Debug::elapsed(tm, __NR_access);
- return static_cast<int>(rc);
+ return rc;
}
bool Sandbox::process_access(int parentMapsFd, int sandboxFd, int threadFdPub,