1// Copyright 2019 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package sandbox2; 18 19import "sandboxed_api/sandbox2/mount_tree.proto"; 20 21enum PBViolationType { 22 VIOLATION_TYPE_UNSPECIFIED = 0; 23 DISALLOWED_SYSCALL = 1; 24 RESOURCE_LIMIT_EXCEEDED = 2; 25 SYSCALL_ARCHITECTURE_MISMATCH = 3; 26} 27 28message RegisterX8664 { 29 uint64 r15 = 1; 30 uint64 r14 = 2; 31 uint64 r13 = 3; 32 uint64 r12 = 4; 33 uint64 rbp = 5; 34 uint64 rbx = 6; 35 uint64 r11 = 7; 36 uint64 r10 = 8; 37 uint64 r9 = 9; 38 uint64 r8 = 10; 39 uint64 rax = 11; 40 uint64 rcx = 12; 41 uint64 rdx = 13; 42 uint64 rsi = 14; 43 uint64 rdi = 15; 44 uint64 orig_rax = 16; 45 uint64 rip = 17; 46 uint64 cs = 18; 47 uint64 eflags = 19; 48 uint64 rsp = 20; 49 uint64 ss = 21; 50 uint64 fs_base = 22; 51 uint64 gs_base = 23; 52 uint64 ds = 24; 53 uint64 es = 25; 54 uint64 fs = 26; 55 uint64 gs = 27; 56} 57 58message RegisterPowerpc64 { 59 repeated uint64 gpr = 1; 60 uint64 nip = 2; 61 uint64 msr = 3; 62 uint64 orig_gpr3 = 4; 63 uint64 ctr = 5; 64 uint64 link = 6; 65 uint64 xer = 7; 66 uint64 ccr = 8; 67 uint64 softe = 9; 68 uint64 trap = 10; 69 uint64 dar = 11; 70 uint64 dsisr = 12; 71 uint64 result = 13; 72 73 uint64 zero0 = 14; 74 uint64 zero1 = 15; 75 uint64 zero2 = 16; 76 uint64 zero3 = 17; 77} 78 79message RegisterAarch64 { 80 repeated uint64 regs = 1; 81 uint64 sp = 2; 82 uint64 pc = 3; 83 uint64 pstate = 4; 84} 85 86message RegisterArm { 87 repeated uint32 regs = 1; 88 uint32 pc = 2; 89 uint32 cpsr = 3; 90 uint32 orig_x0 = 4; 91} 92 93message RegisterValues { 94 // Architecture architecture = 1; 95 oneof register_values { 96 RegisterX8664 register_x86_64 = 2; 97 RegisterPowerpc64 register_powerpc64 = 3; 98 RegisterAarch64 register_aarch64 = 4; 99 RegisterArm register_arm = 5; 100 } 101} 102 103message SyscallDescription { 104 int32 syscall = 1; 105 // Should we have a second one with the raw value? 106 // This would be redundant (We dump all registers) + should not be as useful 107 // for debugging as the decoded values. 108 repeated string argument = 2; 109 // Store the architecture of the desired syscall in here as well? Might be 110 // useful when the violation type was a change in syscall architecture. 111} 112 113message PolicyBuilderDescription { 114 repeated int32 handled_syscalls = 1; 115 repeated string bind_mounts = 2; 116 string built_at_sloc = 3; 117} 118 119message NamespaceDescription { 120 int32 clone_flags = 1; 121 // Do we want to have the mount tree in here? 122 MountTree mount_tree_mounts = 2; 123} 124 125message PolicyDescription { 126 bytes user_bpf_policy = 1; 127 reserved 2 to 5; 128 // This requires additional fields. (e.g. allowed syscall numbers) 129 PolicyBuilderDescription policy_builder_description = 6; 130 131 // namespace 132 NamespaceDescription namespace_description = 7; 133 134 repeated int32 capabilities = 8; 135} 136 137message Violation { 138 string legacy_fatal_message = 1; 139 PBViolationType violation_type = 2; 140 int32 pid = 3; 141 string prog_name = 4; 142 PolicyDescription policy = 5; 143 string stack_trace = 6; 144 SyscallDescription syscall_information = 7; 145 RegisterValues register_values = 8; 146 reserved 9; 147 string proc_maps = 10; 148 // Contains the received signal that caused the death if applicable. 149 int32 signal = 11; 150} 151