xref: /aosp_15_r20/external/crosvm/jail/seccomp/README.md (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1*bb4ee6a4SAndroid Build Coastguard Worker# Policy files for crosvm
2*bb4ee6a4SAndroid Build Coastguard Worker
3*bb4ee6a4SAndroid Build Coastguard WorkerThis folder holds the seccomp policies for crosvm devices, organized by architecture.
4*bb4ee6a4SAndroid Build Coastguard Worker
5*bb4ee6a4SAndroid Build Coastguard WorkerEach crosvm device can run within its owned jailed process. A jailed process is only able to perform
6*bb4ee6a4SAndroid Build Coastguard Workerthe system calls specified in the seccomp policy file the jail has been created with, which improves
7*bb4ee6a4SAndroid Build Coastguard Workersecurity as a rogue process cannot perform any system call it wants.
8*bb4ee6a4SAndroid Build Coastguard Worker
9*bb4ee6a4SAndroid Build Coastguard WorkerEach device can run from different contexts, which require a different set of authorized system
10*bb4ee6a4SAndroid Build Coastguard Workercalls. This file explains how the policy files are named in order to allow these various scenario.
11*bb4ee6a4SAndroid Build Coastguard Worker
12*bb4ee6a4SAndroid Build Coastguard Worker## Naming conventions
13*bb4ee6a4SAndroid Build Coastguard Worker
14*bb4ee6a4SAndroid Build Coastguard WorkerSince Minijail only allows for one level of policy inclusion, we need to be a little bit creative in
15*bb4ee6a4SAndroid Build Coastguard Workerorder to minimize policy duplication.
16*bb4ee6a4SAndroid Build Coastguard Worker
17*bb4ee6a4SAndroid Build Coastguard Worker- `common_device.policy` contains a set of syscalls that are common to all devices, and is never
18*bb4ee6a4SAndroid Build Coastguard Worker  loaded directly - only included from other policy files.
19*bb4ee6a4SAndroid Build Coastguard Worker- `foo.policy` contains the set of syscalls that device `foo` is susceptible to use, regardless of
20*bb4ee6a4SAndroid Build Coastguard Worker  the underlying virtio transport. This policy is also never loaded directly.
21*bb4ee6a4SAndroid Build Coastguard Worker- `foo_device.policy` is the policy that is loaded when device `foo` is used as an in-VMM (i.e.
22*bb4ee6a4SAndroid Build Coastguard Worker  regular virtio) device. It will generally simply include `common_device.policy` as well as
23*bb4ee6a4SAndroid Build Coastguard Worker  `foo.policy`.
24*bb4ee6a4SAndroid Build Coastguard Worker
25*bb4ee6a4SAndroid Build Coastguard WorkerWhen using vhost-user, the virtio protocol needs to be sent over a different medium, e.g. a Unix
26*bb4ee6a4SAndroid Build Coastguard Workersocket. Supporting this transport requires some extra system calls after the device is jailed, and
27*bb4ee6a4SAndroid Build Coastguard Workerthus dedicated policies:
28*bb4ee6a4SAndroid Build Coastguard Worker
29*bb4ee6a4SAndroid Build Coastguard Worker- `vhost_user.policy` contains the set of syscalls required by the regular (i.e. socket-based)
30*bb4ee6a4SAndroid Build Coastguard Worker  vhost-user listener. It is never loaded directly.
31*bb4ee6a4SAndroid Build Coastguard Worker- `foo_device_vhost_user.policy` is the policy that is loaded when device `foo` is used as a regular
32*bb4ee6a4SAndroid Build Coastguard Worker  vhost-user device. It will generally include `common_device.policy`, `vhost_user.policy` and
33*bb4ee6a4SAndroid Build Coastguard Worker  `foo.policy`.
34