forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate syscall broker policies and signal handling.
No functional change intended, just duplicate code reduction. Adds the common signal handler to broker_process.cc, since all it does is call back into BrokerProcess methods. Change-Id: Ie8f1604888465fb9996c34a7f0f42811b8cddb30 Reviewed-on: https://chromium-review.googlesource.com/773109 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Robert Sesek <rsesek@chromium.org> Cr-Commit-Position: refs/heads/master@{#517454}
- Loading branch information
Showing
19 changed files
with
129 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include_rules = [ | ||
"+sandbox/linux/system_headers", | ||
"+sandbox/linux/bpf_dsl", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
services/service_manager/sandbox/linux/bpf_broker_policy_linux.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "services/service_manager/sandbox/linux/bpf_broker_policy_linux.h" | ||
|
||
#include "sandbox/linux/bpf_dsl/bpf_dsl.h" | ||
#include "sandbox/linux/system_headers/linux_syscalls.h" | ||
|
||
using sandbox::bpf_dsl::Allow; | ||
using sandbox::bpf_dsl::ResultExpr; | ||
|
||
namespace service_manager { | ||
|
||
BrokerProcessPolicy::BrokerProcessPolicy() {} | ||
|
||
BrokerProcessPolicy::~BrokerProcessPolicy() {} | ||
|
||
ResultExpr BrokerProcessPolicy::EvaluateSyscall(int sysno) const { | ||
switch (sysno) { | ||
#if !defined(__aarch64__) | ||
case __NR_access: | ||
case __NR_open: | ||
#endif // !defined(__aarch64__) | ||
case __NR_faccessat: | ||
case __NR_openat: | ||
#if !defined(OS_CHROMEOS) && !defined(__aarch64__) | ||
// The broker process needs to able to unlink the temporary | ||
// files that it may create. | ||
case __NR_unlink: | ||
#endif | ||
return Allow(); | ||
default: | ||
return GpuProcessPolicy::EvaluateSyscall(sysno); | ||
} | ||
} | ||
|
||
} // namespace service_manager |
33 changes: 33 additions & 0 deletions
33
services/service_manager/sandbox/linux/bpf_broker_policy_linux.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef SERVICES_SERVICE_MANAGER_SANDBOX_LINUX_BPF_BROKER_POLICY_LINUX_H_ | ||
#define SERVICES_SERVICE_MANAGER_SANDBOX_LINUX_BPF_BROKER_POLICY_LINUX_H_ | ||
|
||
#include "sandbox/linux/bpf_dsl/bpf_dsl.h" | ||
#include "services/service_manager/sandbox/export.h" | ||
#include "services/service_manager/sandbox/linux/bpf_gpu_policy_linux.h" | ||
|
||
namespace service_manager { | ||
|
||
// A broker policy is one for a privileged syscall broker that allows | ||
// access, open, openat, and (in the non-Chrome OS case) unlink. | ||
// TODO(tsepez): probably should not inherit from any other process policy, | ||
// since that may include random syscalls that this does not need. | ||
class SERVICE_MANAGER_SANDBOX_EXPORT BrokerProcessPolicy | ||
: public GpuProcessPolicy { | ||
public: | ||
BrokerProcessPolicy(); | ||
~BrokerProcessPolicy() override; | ||
|
||
sandbox::bpf_dsl::ResultExpr EvaluateSyscall( | ||
int system_call_number) const override; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(BrokerProcessPolicy); | ||
}; | ||
|
||
} // namespace service_manager | ||
|
||
#endif // SERVICES_SERVICE_MANAGER_SANDBOX_LINUX_BPF_BROKER_POLICY_LINUX_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.