Seccomp BPF: handle EINTR in error reporting setup.
Wrap dup2 with HANDLE_EINTR in the error reporting set-up for the BPF support detection process. We also print errno as an attempt to obtain more information on this puzzling bug. BUG=152530 Review URL: https://chromiumcodereview.appspot.com/11103021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161443 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@ -84,11 +84,16 @@ bool Sandbox::RunFunctionInPolicy(void (*CodeInSandbox)(),
|
||||
// Test a very simple sandbox policy to verify that we can
|
||||
// successfully turn on sandboxing.
|
||||
Die::EnableSimpleExit();
|
||||
errno = 0;
|
||||
if (HANDLE_EINTR(close(fds[0])) ||
|
||||
dup2(fds[1], 2) != 2 ||
|
||||
HANDLE_EINTR(dup2(fds[1], 2)) != 2 ||
|
||||
HANDLE_EINTR(close(fds[1]))) {
|
||||
static const char msg[] = "Failed to set up stderr\n";
|
||||
if (HANDLE_EINTR(write(fds[1], msg, sizeof(msg)-1))) { }
|
||||
const char* error_string = strerror(errno);
|
||||
static const char msg[] = "Failed to set up stderr: ";
|
||||
if (HANDLE_EINTR(write(fds[1], msg, sizeof(msg)-1)) > 0 && error_string &&
|
||||
HANDLE_EINTR(write(fds[1], error_string, strlen(error_string))) > 0 &&
|
||||
HANDLE_EINTR(write(fds[1], "\n", 1))) {
|
||||
}
|
||||
} else {
|
||||
evaluators_.clear();
|
||||
setSandboxPolicy(syscallEvaluator, NULL);
|
||||
|
Reference in New Issue
Block a user