diff --git a/build.rs b/build.rs index 196344f1..9e2b96a5 100644 --- a/build.rs +++ b/build.rs @@ -12,10 +12,21 @@ // See the License for the specific language governing permissions and // limitations under the License. +use std::path::PathBuf; + +fn get_proto_files(dir: &str) -> Vec { + std::fs::read_dir(dir).expect("read_dir failed") + .map(|file| file.unwrap().path()) + .filter(|path| path.extension() == Some(std::ffi::OsStr::new("proto"))) + .collect() +} fn main() { - prost_build::compile_protos(&["proto/img-streamer.proto", - "proto/image.proto"], - &["proto/"]) - .expect("Failed to generate protobuf wrappers"); + prost_build::compile_protos(&get_proto_files("proto/"), + &[PathBuf::from("proto/")]) + .expect("Failed to generate protobuf wrappers ./proto/*.proto"); + + prost_build::compile_protos(&get_proto_files("proto/criu"), + &[PathBuf::from("proto/criu")]) + .expect("Failed to generate protobuf wrappers for ./proto/criu/*.proto"); } diff --git a/proto/criu/LICENSE b/proto/criu/LICENSE new file mode 100644 index 00000000..3c6395a1 --- /dev/null +++ b/proto/criu/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2020 The CRIU developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/proto/criu/apparmor.proto b/proto/criu/apparmor.proto new file mode 100644 index 00000000..0e4d8259 --- /dev/null +++ b/proto/criu/apparmor.proto @@ -0,0 +1,20 @@ + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message aa_policy { + required string name = 1; + required bytes blob = 2; +} + +message aa_namespace { + required string name = 1; + repeated aa_policy policies = 2; + repeated aa_namespace namespaces = 3; +} + +message apparmor_entry { + repeated aa_namespace namespaces = 1; +} diff --git a/proto/criu/autofs.proto b/proto/criu/autofs.proto new file mode 100644 index 00000000..7752212d --- /dev/null +++ b/proto/criu/autofs.proto @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message autofs_entry { + required int32 fd = 1; + required int32 pgrp = 2; + required int32 timeout = 3; + required int32 minproto = 4; + required int32 maxproto = 5; + required int32 mode = 6; + + optional int32 uid = 7; + optional int32 gid = 8; + + optional int32 read_fd = 9; +} diff --git a/proto/criu/binfmt-misc.proto b/proto/criu/binfmt-misc.proto new file mode 100644 index 00000000..f13bbf97 --- /dev/null +++ b/proto/criu/binfmt-misc.proto @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message binfmt_misc_entry { + required string name = 1; + required bool enabled = 2; + required string interpreter = 3; + optional string flags = 4; + optional string extension = 5; + optional string magic = 6; + optional string mask = 7; + optional int32 offset = 8; +} diff --git a/proto/criu/bpfmap-data.proto b/proto/criu/bpfmap-data.proto new file mode 100644 index 00000000..90fcb696 --- /dev/null +++ b/proto/criu/bpfmap-data.proto @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message bpfmap_data_entry { + required uint32 map_id = 1; + required uint32 keys_bytes = 2; /* Bytes required to store keys */ + required uint32 values_bytes = 3; /* Bytes required to store values */ + required uint32 count = 4; /* Number of key-value pairs stored */ +} diff --git a/proto/criu/bpfmap-file.proto b/proto/criu/bpfmap-file.proto new file mode 100644 index 00000000..dfdc83bc --- /dev/null +++ b/proto/criu/bpfmap-file.proto @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; + +message bpfmap_file_entry { + required uint32 id = 1; + required uint32 flags = 2 [(criu).flags = "rfile.flags"]; + required uint64 pos = 3; + required fown_entry fown = 4; + required uint32 map_type = 5; + required uint32 key_size = 6; + required uint32 value_size = 7; + required uint32 map_id = 8; + required uint32 max_entries = 9; + required uint32 map_flags = 10; + required uint64 memlock = 11; + required bool frozen = 12 [default = false]; + required string map_name = 13; + required uint32 ifindex = 14 [default = 0]; + optional sint32 mnt_id = 15 [default = -1]; +} diff --git a/proto/criu/cgroup.proto b/proto/criu/cgroup.proto new file mode 100644 index 00000000..9bec59bf --- /dev/null +++ b/proto/criu/cgroup.proto @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message cgroup_perms { + required uint32 mode = 1; + required uint32 uid = 2; + required uint32 gid = 3; +} + +message cgroup_prop_entry { + required string name = 1; + required string value = 2; + optional cgroup_perms perms = 3; +} + +message cgroup_dir_entry { + required string dir_name = 1; + repeated cgroup_dir_entry children = 2; + repeated cgroup_prop_entry properties = 3; + optional cgroup_perms dir_perms = 4; +} + +message cg_controller_entry { + repeated string cnames = 1; + repeated cgroup_dir_entry dirs = 2; +} + +message cg_member_entry { + required string name = 1; + required string path = 2; + optional uint32 cgns_prefix = 3; +} + +message cg_set_entry { + required uint32 id = 1; + repeated cg_member_entry ctls = 2; +} + +message cgroup_entry { + repeated cg_set_entry sets = 1; + repeated cg_controller_entry controllers = 2; +} diff --git a/proto/criu/core-aarch64.proto b/proto/criu/core-aarch64.proto new file mode 100644 index 00000000..0a98a310 --- /dev/null +++ b/proto/criu/core-aarch64.proto @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message user_aarch64_regs_entry { + repeated uint64 regs = 1; + required uint64 sp = 2; + required uint64 pc = 3; + required uint64 pstate = 4; +} + +message user_aarch64_fpsimd_context_entry { + repeated uint64 vregs = 1; + required uint32 fpsr = 2; + required uint32 fpcr = 3; +} + +message thread_info_aarch64 { + required uint64 clear_tid_addr = 1[(criu).hex = true]; + required uint64 tls = 2; + required user_aarch64_regs_entry gpregs = 3[(criu).hex = true]; + required user_aarch64_fpsimd_context_entry fpsimd = 4; +} diff --git a/proto/criu/core-arm.proto b/proto/criu/core-arm.proto new file mode 100644 index 00000000..a9ca70f5 --- /dev/null +++ b/proto/criu/core-arm.proto @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message user_arm_regs_entry { + required uint32 r0 = 1; + required uint32 r1 = 2; + required uint32 r2 = 3; + required uint32 r3 = 4; + required uint32 r4 = 5; + required uint32 r5 = 6; + required uint32 r6 = 7; + required uint32 r7 = 8; + required uint32 r8 = 9; + required uint32 r9 = 10; + required uint32 r10 = 11; + required uint32 fp = 12; + required uint32 ip = 13; + required uint32 sp = 14; + required uint32 lr = 15; + required uint32 pc = 16; + required uint32 cpsr = 17; + required uint32 orig_r0 = 18; +} + +message user_arm_vfpstate_entry { + repeated uint64 vfp_regs = 1; + required uint32 fpscr = 2; + required uint32 fpexc = 3; + required uint32 fpinst = 4; + required uint32 fpinst2 = 5; +} + +message thread_info_arm { + required uint64 clear_tid_addr = 1[(criu).hex = true]; + required uint32 tls = 2; + required user_arm_regs_entry gpregs = 3[(criu).hex = true]; + required user_arm_vfpstate_entry fpstate = 4; +} diff --git a/proto/criu/core-mips.proto b/proto/criu/core-mips.proto new file mode 100644 index 00000000..98494084 --- /dev/null +++ b/proto/criu/core-mips.proto @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message user_mips_regs_entry { + required uint64 r0 = 1; + required uint64 r1 = 2; + required uint64 r2 = 3; + required uint64 r3 = 4; + required uint64 r4 = 5; + required uint64 r5 = 6; + required uint64 r6 = 7; + required uint64 r7 = 8; + required uint64 r8 = 9; + required uint64 r9 = 10; + required uint64 r10 = 11; + required uint64 r11 = 12; + required uint64 r12 = 13; + required uint64 r13 = 14; + required uint64 r14 = 15; + required uint64 r15 = 16; + required uint64 r16 = 17; + required uint64 r17 = 18; + required uint64 r18 = 19; + required uint64 r19 = 20; + required uint64 r20 = 21; + required uint64 r21 = 22; + required uint64 r22 = 23; + required uint64 r23 = 24; + required uint64 r24 = 25; + required uint64 r25 = 26; + required uint64 r26 = 27; + required uint64 r27 = 28; + required uint64 r28 = 29; + required uint64 r29 = 30; + required uint64 r30 = 31; + required uint64 r31 = 32; + required uint64 lo = 33; + required uint64 hi = 34; + required uint64 cp0_epc = 35; + required uint64 cp0_badvaddr = 36; + required uint64 cp0_status = 37; + required uint64 cp0_cause = 38; +} + +message user_mips_fpregs_entry { + required uint64 r0 = 1; + required uint64 r1 = 2; + required uint64 r2 = 3; + required uint64 r3 = 4; + required uint64 r4 = 5; + required uint64 r5 = 6; + required uint64 r6 = 7; + required uint64 r7 = 8; + required uint64 r8 = 9; + required uint64 r9 = 10; + required uint64 r10 = 11; + required uint64 r11 = 12; + required uint64 r12 = 13; + required uint64 r13 = 14; + required uint64 r14 = 15; + required uint64 r15 = 16; + required uint64 r16 = 17; + required uint64 r17 = 18; + required uint64 r18 = 19; + required uint64 r19 = 20; + required uint64 r20 = 21; + required uint64 r21 = 22; + required uint64 r22 = 23; + required uint64 r23 = 24; + required uint64 r24 = 25; + required uint64 r25 = 26; + required uint64 r26 = 27; + required uint64 r27 = 28; + required uint64 r28 = 29; + required uint64 r29 = 30; + required uint64 r30 = 31; + required uint64 r31 = 32; + required uint64 lo = 33; + required uint64 hi = 34; + required uint32 fpu_fcr31 = 35; + required uint32 fpu_id = 36; +} + +message thread_info_mips { + required uint64 clear_tid_addr = 1[(criu).hex = true]; + required uint64 tls = 2; + required user_mips_regs_entry gpregs = 3[(criu).hex = true]; + required user_mips_fpregs_entry fpregs = 4[(criu).hex = true]; +} diff --git a/proto/criu/core-ppc64.proto b/proto/criu/core-ppc64.proto new file mode 100644 index 00000000..208f1aac --- /dev/null +++ b/proto/criu/core-ppc64.proto @@ -0,0 +1,77 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message user_ppc64_regs_entry { + /* Following is the list of regiters starting at r0. */ + repeated uint64 gpr = 1; + required uint64 nip = 2; + required uint64 msr = 3; + required uint64 orig_gpr3 = 4; + required uint64 ctr = 5; + required uint64 link = 6; + required uint64 xer = 7; + required uint64 ccr = 8; + required uint64 trap = 9; + /* For Transactional memory support since P8 */ + optional uint64 texasr = 10; + optional uint64 tfhar = 11; + optional uint64 tfiar = 12; +} + +message user_ppc64_fpstate_entry { + /* Following is the list of regiters starting at fpr0 */ + repeated uint64 fpregs = 1; +} + +message user_ppc64_vrstate_entry { + /* + * Altivec registers + * The vector registers are 128bit registers (VSR[32..63]). + * The following vregs entry will store first the high part then the + * low one: + * VR0 = vrregs[0] << 64 | vrregs[1]; + * VR1 = vrregs[2] << 64 | vrregs[3]; + * .. + * The last entry stores in a 128bit field the VSCR which is a 32bit + * value returned by the kernel in a 128 field. + */ + repeated uint64 vrregs = 1; + required uint32 vrsave = 2; +} + +message user_ppc64_vsxstate_entry { + /* + * VSX registers + * The vector-scale registers are 128bit registers (VSR[0..64]). + * Since there is an overlapping over the VSX registers by the FPR and + * the Altivec registers, only the lower part of the first 32 VSX + * registers have to be saved. + */ + repeated uint64 vsxregs = 1; +} + +/* + * Transactional memory operation's state + */ +message user_ppc64_tm_regs_entry { + required user_ppc64_regs_entry gpregs = 1; + optional user_ppc64_fpstate_entry fpstate = 2; + optional user_ppc64_vrstate_entry vrstate = 3; + optional user_ppc64_vsxstate_entry vsxstate = 4; +} + +message thread_info_ppc64 { + required uint64 clear_tid_addr = 1[(criu).hex = true]; + required user_ppc64_regs_entry gpregs = 2[(criu).hex = true]; + optional user_ppc64_fpstate_entry fpstate = 3; + optional user_ppc64_vrstate_entry vrstate = 4; + optional user_ppc64_vsxstate_entry vsxstate = 5; + optional user_ppc64_tm_regs_entry tmstate = 6; +} diff --git a/proto/criu/core-s390.proto b/proto/criu/core-s390.proto new file mode 100644 index 00000000..507870bc --- /dev/null +++ b/proto/criu/core-s390.proto @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message user_s390_regs_entry { + required uint64 psw_mask = 1; + required uint64 psw_addr = 2; + repeated uint64 gprs = 3; + repeated uint32 acrs = 4; + required uint64 orig_gpr2 = 5; + required uint32 system_call = 6; +} + +message user_s390_vxrs_low_entry { + repeated uint64 regs = 1; +} + +/* + * The vxrs_high registers have 128 bit: + * + * vxrs_high_0 = regs[0] << 64 | regs[1]; + * vxrs_high_1 = regs[2] << 64 | regs[3]; + */ +message user_s390_vxrs_high_entry { + repeated uint64 regs = 1; +} + +message user_s390_fpregs_entry { + required uint32 fpc = 1; + repeated uint64 fprs = 2; +} + +message user_s390_gs_cb_entry { + repeated uint64 regs = 1; +} + +message user_s390_ri_entry { + required uint32 ri_on = 1; + repeated uint64 regs = 2; +} + +message thread_info_s390 { + required uint64 clear_tid_addr = 1[(criu).hex = true]; + required user_s390_regs_entry gpregs = 2[(criu).hex = true]; + required user_s390_fpregs_entry fpregs = 3[(criu).hex = true]; + optional user_s390_vxrs_low_entry vxrs_low = 4[(criu).hex = true]; + optional user_s390_vxrs_high_entry vxrs_high = 5[(criu).hex = true]; + optional user_s390_gs_cb_entry gs_cb = 6[(criu).hex = true]; + optional user_s390_gs_cb_entry gs_bc = 7[(criu).hex = true]; + optional user_s390_ri_entry ri_cb = 8[(criu).hex = true]; +} diff --git a/proto/criu/core-x86.proto b/proto/criu/core-x86.proto new file mode 100644 index 00000000..d973f610 --- /dev/null +++ b/proto/criu/core-x86.proto @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +enum user_x86_regs_mode { + NATIVE = 1; + COMPAT = 2; +} + +/* Reusing entry for both 64 and 32 bits register sets */ +message user_x86_regs_entry { + required uint64 r15 = 1; + required uint64 r14 = 2; + required uint64 r13 = 3; + required uint64 r12 = 4; + required uint64 bp = 5; + required uint64 bx = 6; + required uint64 r11 = 7; + required uint64 r10 = 8; + required uint64 r9 = 9; + required uint64 r8 = 10; + required uint64 ax = 11; + required uint64 cx = 12; + required uint64 dx = 13; + required uint64 si = 14; + required uint64 di = 15; + required uint64 orig_ax = 16; + required uint64 ip = 17; + required uint64 cs = 18; + required uint64 flags = 19; + required uint64 sp = 20; + required uint64 ss = 21; + required uint64 fs_base = 22; + required uint64 gs_base = 23; + required uint64 ds = 24; + required uint64 es = 25; + required uint64 fs = 26; + required uint64 gs = 27; + optional user_x86_regs_mode mode = 28 [default = NATIVE]; +} + +message user_x86_xsave_entry { + /* standart xsave features */ + required uint64 xstate_bv = 1; + + /* AVX components: 16x 256-bit ymm registers, hi 128 bits */ + repeated uint32 ymmh_space = 2; + + /* MPX components */ + repeated uint64 bndreg_state = 3; + repeated uint64 bndcsr_state = 4; + + /* AVX512 components: k0-k7, ZMM_Hi256, Hi16_ZMM */ + repeated uint64 opmask_reg = 5; + repeated uint64 zmm_upper = 6; + repeated uint64 hi16_zmm = 7; + + /* Protected keys */ + repeated uint32 pkru = 8; + + /* + * Processor trace (PT) and hardware duty cycling (HDC) + * are supervisor state components and only managed by + * xsaves/xrstors on cpl=0, so ignore them. + */ +} + +message user_x86_fpregs_entry { + + /* fxsave data */ + required uint32 cwd = 1; + required uint32 swd = 2; + required uint32 twd = 3; + required uint32 fop = 4; + required uint64 rip = 5; + required uint64 rdp = 6; + required uint32 mxcsr = 7; + required uint32 mxcsr_mask = 8; + repeated uint32 st_space = 9; + repeated uint32 xmm_space = 10; + + /* Unused, but present for backward compatibility */ + repeated uint32 padding = 11; + + /* xsave extension */ + optional user_x86_xsave_entry xsave = 13; +} + +message user_desc_t { + required uint32 entry_number = 1; + /* this is for GDT, not for MSRs - 32-bit base */ + required uint32 base_addr = 2; + required uint32 limit = 3; + required bool seg_32bit = 4; + required bool contents_h = 5; + required bool contents_l = 6; + required bool read_exec_only = 7 [default = true]; + required bool limit_in_pages = 8; + required bool seg_not_present = 9 [default = true]; + required bool useable = 10; +} + +message thread_info_x86 { + required uint64 clear_tid_addr = 1[(criu).hex = true]; + required user_x86_regs_entry gpregs = 2[(criu).hex = true]; + required user_x86_fpregs_entry fpregs = 3; + repeated user_desc_t tls = 4; +} diff --git a/proto/criu/core.proto b/proto/criu/core.proto new file mode 100644 index 00000000..064bc8db --- /dev/null +++ b/proto/criu/core.proto @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "core-x86.proto"; +import "core-arm.proto"; +import "core-aarch64.proto"; +import "core-ppc64.proto"; +import "core-s390.proto"; +import "core-mips.proto"; + +import "rlimit.proto"; +import "timer.proto"; +import "creds.proto"; +import "sa.proto"; +import "siginfo.proto"; + +import "opts.proto"; + +/* + * These match the SECCOMP_MODE_* flags from . + */ +enum seccomp_mode { + disabled = 0; + strict = 1; + filter = 2; +}; + +message task_core_entry { + required uint32 task_state = 1 [(criu).dict = "gen"]; + required uint32 exit_code = 2; + + required uint32 personality = 3; + required uint32 flags = 4; + required uint64 blk_sigset = 5[(criu).hex = true]; + + required string comm = 6; + + optional task_timers_entry timers = 7; + optional task_rlimits_entry rlimits = 8; + + optional uint32 cg_set = 9; + + optional signal_queue_entry signals_s = 10; + + /* These two are deprecated, should be per-thread */ + optional seccomp_mode old_seccomp_mode = 11; + optional uint32 old_seccomp_filter = 12; + + optional uint32 loginuid = 13; + + optional int32 oom_score_adj = 14; + repeated sa_entry sigactions = 15; + // Reserved for tty inheritance + //optional int32 tty_nr = 16; + //optional int32 tty_pgrp = 17; + + optional bool child_subreaper = 18; + // Reserved for container relative start time + //optional uint64 start_time = 19; + optional uint64 blk_sigset_extended = 20[(criu).hex = true]; +} + +message task_kobj_ids_entry { + required uint32 vm_id = 1; + required uint32 files_id = 2; + required uint32 fs_id = 3; + required uint32 sighand_id = 4; + + optional uint32 pid_ns_id = 5; + optional uint32 net_ns_id = 6; + optional uint32 ipc_ns_id = 7; + optional uint32 uts_ns_id = 8; + optional uint32 mnt_ns_id = 9; + optional uint32 user_ns_id = 10; + optional uint32 cgroup_ns_id = 11; + optional uint32 time_ns_id = 12; +} + +message thread_sas_entry { + required uint64 ss_sp = 1; + required uint64 ss_size = 2; + required uint32 ss_flags = 3; +} + +message thread_core_entry { + required uint64 futex_rla = 1; + required uint32 futex_rla_len = 2; + optional sint32 sched_nice = 3; + optional uint32 sched_policy = 4; + optional uint32 sched_prio = 5; + optional uint64 blk_sigset = 6; + optional thread_sas_entry sas = 7; + optional uint32 pdeath_sig = 8; + + optional signal_queue_entry signals_p = 9; + optional creds_entry creds = 10; + + optional seccomp_mode seccomp_mode = 11; + optional uint32 seccomp_filter = 12; + + optional string comm = 13; + optional uint64 blk_sigset_extended = 14; +} + +message task_rlimits_entry { + repeated rlimit_entry rlimits = 1; +}; + +message core_entry { + enum march { + UNKNOWN = 0; + X86_64 = 1; + ARM = 2; + AARCH64 = 3; + PPC64 = 4; + S390 = 5; + MIPS = 6; + } + + required march mtype = 1; + optional thread_info_x86 thread_info = 2; + optional thread_info_arm ti_arm = 6; + optional thread_info_aarch64 ti_aarch64 = 8; + optional thread_info_ppc64 ti_ppc64 = 9; + optional thread_info_s390 ti_s390 = 10; + optional thread_info_mips ti_mips = 11; + + optional task_core_entry tc = 3; + optional task_kobj_ids_entry ids = 4; + optional thread_core_entry thread_core = 5; +} diff --git a/proto/criu/cpuinfo.proto b/proto/criu/cpuinfo.proto new file mode 100644 index 00000000..823280b4 --- /dev/null +++ b/proto/criu/cpuinfo.proto @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message cpuinfo_x86_entry { + enum vendor { + UNKNOWN = 0; + INTEL = 1; + AMD = 2; + } + + required vendor vendor_id = 1; + required uint32 cpu_family = 2; + required uint32 model = 3; + required uint32 stepping = 4; + required uint32 capability_ver = 5; + repeated uint32 capability = 6; + + optional string model_id = 7; + + optional uint64 xfeatures_mask = 8; + optional uint32 xsave_size = 9; + optional uint32 xsave_size_max = 10; +} + +message cpuinfo_ppc64_entry { + enum endianness { + BIGENDIAN = 0; + LITTLEENDIAN = 1; + } + + required endianness endian = 1; + repeated uint64 hwcap = 2; +} + +message cpuinfo_s390_entry { + repeated uint64 hwcap = 2; +} + +message cpuinfo_entry { + /* + * Usually on SMP system there should be same CPUs + * installed, but it might happen that system carries + * various CPUs so @repeated used. + */ + repeated cpuinfo_x86_entry x86_entry = 1; + repeated cpuinfo_ppc64_entry ppc64_entry = 2; + repeated cpuinfo_s390_entry s390_entry = 3; +} diff --git a/proto/criu/creds.proto b/proto/criu/creds.proto new file mode 100644 index 00000000..31a30977 --- /dev/null +++ b/proto/criu/creds.proto @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message creds_entry { + required uint32 uid = 1; + required uint32 gid = 2; + required uint32 euid = 3; + required uint32 egid = 4; + required uint32 suid = 5; + required uint32 sgid = 6; + required uint32 fsuid = 7; + required uint32 fsgid = 8; + + repeated uint32 cap_inh = 9; + repeated uint32 cap_prm = 10; + repeated uint32 cap_eff = 11; + repeated uint32 cap_bnd = 12; + + required uint32 secbits = 13; + + repeated uint32 groups = 14; + + optional string lsm_profile = 15; + optional string lsm_sockcreate = 16; + optional bytes apparmor_data = 17; +} diff --git a/proto/criu/eventfd.proto b/proto/criu/eventfd.proto new file mode 100644 index 00000000..5dbcf969 --- /dev/null +++ b/proto/criu/eventfd.proto @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "fown.proto"; + +message eventfd_file_entry { + required uint32 id = 1; + required uint32 flags = 2; + required fown_entry fown = 3; + required uint64 counter = 4; +} diff --git a/proto/criu/eventpoll.proto b/proto/criu/eventpoll.proto new file mode 100644 index 00000000..0d90266d --- /dev/null +++ b/proto/criu/eventpoll.proto @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "fown.proto"; + +message eventpoll_tfd_entry { + required uint32 id = 1; + required uint32 tfd = 2; + required uint32 events = 3; + required uint64 data = 4; + + /* to find dup'ed target files */ + optional uint32 dev = 5; + optional uint64 inode = 6; + optional uint64 pos = 7; +} + +message eventpoll_file_entry { + required uint32 id = 1; + required uint32 flags = 2; + required fown_entry fown = 3; + repeated eventpoll_tfd_entry tfd = 4; +} diff --git a/proto/criu/ext-file.proto b/proto/criu/ext-file.proto new file mode 100644 index 00000000..97556f50 --- /dev/null +++ b/proto/criu/ext-file.proto @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "fown.proto"; + +message ext_file_entry { + required uint32 id = 1; + required fown_entry fown = 5; +} diff --git a/proto/criu/fdinfo.proto b/proto/criu/fdinfo.proto new file mode 100644 index 00000000..af82ba9a --- /dev/null +++ b/proto/criu/fdinfo.proto @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "regfile.proto"; +import "sk-inet.proto"; +import "ns.proto"; +import "packet-sock.proto"; +import "sk-netlink.proto"; +import "eventfd.proto"; +import "eventpoll.proto"; +import "signalfd.proto"; +import "tun.proto"; +import "timerfd.proto"; +import "fsnotify.proto"; +import "ext-file.proto"; +import "sk-unix.proto"; +import "fifo.proto"; +import "pipe.proto"; +import "tty.proto"; +import "memfd.proto"; +import "bpfmap-file.proto"; + +enum fd_types { + UND = 0; + REG = 1; + PIPE = 2; + FIFO = 3; + INETSK = 4; + UNIXSK = 5; + EVENTFD = 6; + EVENTPOLL = 7; + INOTIFY = 8; + SIGNALFD = 9; + PACKETSK = 10; + TTY = 11; + FANOTIFY = 12; + NETLINKSK = 13; + NS = 14; + TUNF = 15; + EXT = 16; + TIMERFD = 17; + MEMFD = 18; + BPFMAP = 19; + + /* Any number above the real used. Not stored to image */ + CTL_TTY = 65534; + AUTOFS_PIPE = 65535; +} + +message fdinfo_entry { + required uint32 id = 1; + required uint32 flags = 2; + required fd_types type = 3; + required uint32 fd = 4; + optional string xattr_security_selinux = 5; +} + +message file_entry { + required fd_types type = 1; + required uint32 id = 2; + optional reg_file_entry reg = 3; + optional inet_sk_entry isk = 4; + optional ns_file_entry nsf = 5; + optional packet_sock_entry psk = 6; + optional netlink_sk_entry nlsk = 7; + optional eventfd_file_entry efd = 8; + optional eventpoll_file_entry epfd = 9; + optional signalfd_entry sgfd = 10; + optional tunfile_entry tunf = 11; + optional timerfd_entry tfd = 12; + optional inotify_file_entry ify = 13; + optional fanotify_file_entry ffy = 14; + optional ext_file_entry ext = 15; + optional unix_sk_entry usk = 16; + optional fifo_entry fifo = 17; + optional pipe_entry pipe = 18; + optional tty_file_entry tty = 19; + optional memfd_file_entry memfd = 20; + optional bpfmap_file_entry bpf = 21; +} diff --git a/proto/criu/fh.proto b/proto/criu/fh.proto new file mode 100644 index 00000000..e992efe6 --- /dev/null +++ b/proto/criu/fh.proto @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +enum fh_entry_sizes { + min_entries = 16; +} + +message fh_entry { + required uint32 bytes = 1; + required uint32 type = 2; + + /* The minimum is fh_n_handle repetitions */ + repeated uint64 handle = 3; + optional string path = 4; + optional uint32 mnt_id = 5; +} + +message irmap_cache_entry { + required uint32 dev = 1 [(criu).dev = true, (criu).odev = true]; + required uint64 inode = 2; + required string path = 3; +} diff --git a/proto/criu/fifo.proto b/proto/criu/fifo.proto new file mode 100644 index 00000000..a63dcfe3 --- /dev/null +++ b/proto/criu/fifo.proto @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message fifo_entry { + required uint32 id = 1; + required uint32 pipe_id = 2; + optional uint32 regf_id = 3; +} diff --git a/proto/criu/file-lock.proto b/proto/criu/file-lock.proto new file mode 100644 index 00000000..6f393d6a --- /dev/null +++ b/proto/criu/file-lock.proto @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message file_lock_entry { + required uint32 flag = 1; + required uint32 type = 2; + required int32 pid = 3; + required int32 fd = 4; + required int64 start = 5; + required int64 len = 6; +} diff --git a/proto/criu/fown.proto b/proto/criu/fown.proto new file mode 100644 index 00000000..eefb9f5c --- /dev/null +++ b/proto/criu/fown.proto @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message fown_entry { + required uint32 uid = 1; + required uint32 euid = 2; + required uint32 signum = 3; + required uint32 pid_type = 4; + required uint32 pid = 5; +} diff --git a/proto/criu/fs.proto b/proto/criu/fs.proto new file mode 100644 index 00000000..415d3a44 --- /dev/null +++ b/proto/criu/fs.proto @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message fs_entry { + required uint32 cwd_id = 1; + required uint32 root_id = 2; + optional uint32 umask = 3; +} diff --git a/proto/criu/fsnotify.proto b/proto/criu/fsnotify.proto new file mode 100644 index 00000000..b8c349ce --- /dev/null +++ b/proto/criu/fsnotify.proto @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fh.proto"; +import "fown.proto"; + +message inotify_wd_entry { + required uint32 id = 1; + required uint64 i_ino = 2; + required uint32 mask = 3 [(criu).hex = true]; + required uint32 ignored_mask = 4 [(criu).hex = true]; + required uint32 s_dev = 5 [(criu).dev = true]; + required uint32 wd = 6; + required fh_entry f_handle = 7; +} + +message inotify_file_entry { + required uint32 id = 1; + required uint32 flags = 2 [(criu).hex = true]; + required fown_entry fown = 4; + repeated inotify_wd_entry wd = 5; +} + +enum mark_type { + INODE = 1; + MOUNT = 2; +} + +message fanotify_inode_mark_entry { + required uint64 i_ino = 1; + required fh_entry f_handle = 2; +} + +message fanotify_mount_mark_entry { + required uint32 mnt_id = 1; + optional string path = 2; +} + +message fanotify_mark_entry { + required uint32 id = 1; + required mark_type type = 2; + + required uint32 mflags = 3 [(criu).hex = true]; + required uint32 mask = 4 [(criu).hex = true]; + required uint32 ignored_mask = 5 [(criu).hex = true]; + required uint32 s_dev = 6 [(criu).dev = true]; + + optional fanotify_inode_mark_entry ie = 7; + optional fanotify_mount_mark_entry me = 8; +} + +message fanotify_file_entry { + required uint32 id = 1; + required uint32 flags = 2 [(criu).hex = true]; + required fown_entry fown = 3; + + required uint32 faflags = 4 [(criu).hex = true]; + required uint32 evflags = 5 [(criu).hex = true]; + repeated fanotify_mark_entry mark = 6; +} diff --git a/proto/criu/ghost-file.proto b/proto/criu/ghost-file.proto new file mode 100644 index 00000000..a7558caf --- /dev/null +++ b/proto/criu/ghost-file.proto @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "time.proto"; + +message ghost_file_entry { + required uint32 uid = 1; + required uint32 gid = 2; + required uint32 mode = 3; + + optional uint32 dev = 4 [(criu).dev = true]; + optional uint64 ino = 5; + optional uint32 rdev = 6 [(criu).dev = true, (criu).odev = true]; + optional timeval atim = 7; + optional timeval mtim = 8; + optional bool chunks = 9; + optional uint64 size = 10; + /* this field makes sense only when S_ISLNK(mode) */ + optional string symlnk_target = 11; +} + +message ghost_chunk_entry { + required uint64 len = 1; + required uint64 off = 2; +} diff --git a/proto/img-streamer.proto b/proto/criu/img-streamer.proto similarity index 63% rename from proto/img-streamer.proto rename to proto/criu/img-streamer.proto index 31792695..ccfa980f 100644 --- a/proto/img-streamer.proto +++ b/proto/criu/img-streamer.proto @@ -1,11 +1,14 @@ -// Taken from CRIU codebase: criu/images/img-streamer.proto +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh syntax = "proto2"; package criu; // This message is sent from CRIU to the streamer. -// * During dump, it is used to communicate the name of the file that is about to -// be sent to the streamer. +// * During dump, it communicates the name of the file that is about to be sent +// to the streamer. // * During restore, CRIU requests image files from the streamer. The message is // used to communicate the name of the desired file. message img_streamer_request_entry { @@ -13,7 +16,7 @@ message img_streamer_request_entry { } // This message is sent from the streamer to CRIU. It is only used during -// restore operations to communicates whether the requested file exists. +// restore to report whether the requested file exists. message img_streamer_reply_entry { required bool exists = 1; } diff --git a/proto/criu/inventory.proto b/proto/criu/inventory.proto new file mode 100644 index 00000000..56951649 --- /dev/null +++ b/proto/criu/inventory.proto @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "core.proto"; + +enum lsmtype { + NO_LSM = 0; + SELINUX = 1; + APPARMOR = 2; +} + +message inventory_entry { + required uint32 img_version = 1; + optional bool fdinfo_per_id = 2; + optional task_kobj_ids_entry root_ids = 3; + optional bool ns_per_id = 4; + optional uint32 root_cg_set = 5; + optional lsmtype lsmtype = 6; + optional uint64 dump_uptime = 8; + optional uint32 pre_dump_mode = 9; + optional bool tcp_close = 10; +} diff --git a/proto/criu/ipc-desc.proto b/proto/criu/ipc-desc.proto new file mode 100644 index 00000000..bd89390b --- /dev/null +++ b/proto/criu/ipc-desc.proto @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message ipc_desc_entry { + required uint32 key = 1; + required uint32 uid = 2; + required uint32 gid = 3; + required uint32 cuid = 4; + required uint32 cgid = 5; + required uint32 mode = 6; + required uint32 id = 7; +} diff --git a/proto/criu/ipc-msg.proto b/proto/criu/ipc-msg.proto new file mode 100644 index 00000000..6357e5a3 --- /dev/null +++ b/proto/criu/ipc-msg.proto @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "ipc-desc.proto"; + +message ipc_msg { + required uint64 mtype = 1; + required uint32 msize = 2; +} + +message ipc_msg_entry { + required ipc_desc_entry desc = 1; + required uint32 qbytes = 2; + required uint32 qnum = 3; +} diff --git a/proto/criu/ipc-sem.proto b/proto/criu/ipc-sem.proto new file mode 100644 index 00000000..eaf31df3 --- /dev/null +++ b/proto/criu/ipc-sem.proto @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "ipc-desc.proto"; + +message ipc_sem_entry { + required ipc_desc_entry desc = 1; + required uint32 nsems = 2; +} diff --git a/proto/criu/ipc-shm.proto b/proto/criu/ipc-shm.proto new file mode 100644 index 00000000..8070498c --- /dev/null +++ b/proto/criu/ipc-shm.proto @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "ipc-desc.proto"; + +message ipc_shm_entry { + required ipc_desc_entry desc = 1; + required uint64 size = 2; + optional bool in_pagemaps = 3; +} diff --git a/proto/criu/ipc-var.proto b/proto/criu/ipc-var.proto new file mode 100644 index 00000000..650d09d6 --- /dev/null +++ b/proto/criu/ipc-var.proto @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message ipc_var_entry { + repeated uint32 sem_ctls = 1; + required uint32 msg_ctlmax = 2; + required uint32 msg_ctlmnb = 3; + required uint32 msg_ctlmni = 4; + required uint32 auto_msgmni = 5; + required uint64 shm_ctlmax = 6; + required uint64 shm_ctlall = 7; + required uint32 shm_ctlmni = 8; + required uint32 shm_rmid_forced = 9; + required uint32 mq_queues_max = 10; + required uint32 mq_msg_max = 11; + required uint32 mq_msgsize_max = 12; + optional uint32 mq_msg_default = 13; + optional uint32 mq_msgsize_default = 14; + optional uint32 msg_next_id = 15; + optional uint32 sem_next_id = 16; + optional uint32 shm_next_id = 17; +} diff --git a/proto/criu/macvlan.proto b/proto/criu/macvlan.proto new file mode 100644 index 00000000..7e7bb9d5 --- /dev/null +++ b/proto/criu/macvlan.proto @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message macvlan_link_entry { + required uint32 mode = 1; + optional uint32 flags = 2; +} diff --git a/proto/criu/memfd.proto b/proto/criu/memfd.proto new file mode 100644 index 00000000..b565edcf --- /dev/null +++ b/proto/criu/memfd.proto @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; + +message memfd_file_entry { + required uint32 id = 1; + required uint32 flags = 2 [(criu).flags = "rfile.flags"]; + required uint64 pos = 3; + required fown_entry fown = 4; + required uint32 inode_id = 5; +}; + +message memfd_inode_entry { + required string name = 1; + required uint32 uid = 2; + required uint32 gid = 3; + required uint64 size = 4; + required uint32 shmid = 5; + required uint32 seals = 6 [(criu).flags = "seals.flags"]; + required uint64 inode_id = 7; +}; diff --git a/proto/criu/mm.proto b/proto/criu/mm.proto new file mode 100644 index 00000000..79306bdd --- /dev/null +++ b/proto/criu/mm.proto @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "vma.proto"; + +message aio_ring_entry { + required uint64 id = 1; + required uint32 nr_req = 2; + required uint32 ring_len = 3; +} + +message mm_entry { + required uint64 mm_start_code = 1 [(criu).hex = true]; + required uint64 mm_end_code = 2 [(criu).hex = true]; + required uint64 mm_start_data = 3 [(criu).hex = true]; + required uint64 mm_end_data = 4 [(criu).hex = true]; + required uint64 mm_start_stack = 5 [(criu).hex = true]; + required uint64 mm_start_brk = 6 [(criu).hex = true]; + required uint64 mm_brk = 7 [(criu).hex = true]; + required uint64 mm_arg_start = 8 [(criu).hex = true]; + required uint64 mm_arg_end = 9 [(criu).hex = true]; + required uint64 mm_env_start = 10 [(criu).hex = true]; + required uint64 mm_env_end = 11 [(criu).hex = true]; + required uint32 exe_file_id = 12; + + repeated uint64 mm_saved_auxv = 13; + + repeated vma_entry vmas = 14; + + optional int32 dumpable = 15; + repeated aio_ring_entry aios = 16; + optional bool thp_disabled = 17; +} diff --git a/proto/criu/mnt.proto b/proto/criu/mnt.proto new file mode 100644 index 00000000..0bc71f86 --- /dev/null +++ b/proto/criu/mnt.proto @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +enum fstype { + UNSUPPORTED = 0; + PROC = 1; + SYSFS = 2; + DEVTMPFS = 3; + BINFMT_MISC = 4; + TMPFS = 5; + DEVPTS = 6; + SIMFS = 7; + PSTORE = 8; + SECURITYFS = 9; + FUSECTL = 10; + DEBUGFS = 11; + CGROUP = 12; + AUFS = 13; + MQUEUE = 14; + FUSE = 15; + AUTO = 16; + OVERLAYFS = 17; + AUTOFS = 18; + TRACEFS = 19; + + /* These three are reserved for NFS support */ + // RPC_PIPEFS = 20; + // NFS = 21; + // NFS4 = 22; + + CGROUP2 = 23; +}; + +message mnt_entry { + required uint32 fstype = 1; + required uint32 mnt_id = 2; + required uint32 root_dev = 3 [(criu).dev = true]; + required uint32 parent_mnt_id = 4; + required uint32 flags = 5 [(criu).hex = true]; + + required string root = 6; + required string mountpoint = 7; + required string source = 8; + required string options = 9; + + optional uint32 shared_id = 10; + optional uint32 master_id = 11; + + optional bool with_plugin = 12; + optional bool ext_mount = 13; + + optional string fsname = 14; + optional bool internal_sharing = 15; + + optional bool deleted = 16; + optional uint32 sb_flags = 17 [(criu).hex = true]; + /* user defined mapping for external mount */ + optional string ext_key = 18; +} diff --git a/proto/criu/netdev.proto b/proto/criu/netdev.proto new file mode 100644 index 00000000..e9bc2322 --- /dev/null +++ b/proto/criu/netdev.proto @@ -0,0 +1,81 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "macvlan.proto"; +import "opts.proto"; +import "tun.proto"; +import "sysctl.proto"; +import "sit.proto"; + +enum nd_type { + LOOPBACK = 1; + VETH = 2; + TUN = 3; + /* + * External link -- for those CRIU only dumps and restores + * link parameters such as flags, address, MTU, etc. The + * existence of the link on restore should be provided + * by the setup-namespaces script. + */ + EXTLINK = 4; + VENET = 5; /* OpenVZ device */ + BRIDGE = 6; + MACVLAN = 7; + SIT = 8; +} + +message net_device_entry { + required nd_type type = 1; + required uint32 ifindex = 2; + required uint32 mtu = 3; + required uint32 flags = 4 [(criu).hex = true]; + required string name = 5; + + optional tun_link_entry tun = 6; + + optional bytes address = 7; + + repeated int32 conf = 8; + + repeated sysctl_entry conf4 = 9; + + repeated sysctl_entry conf6 = 10; + + optional macvlan_link_entry macvlan = 11; + + optional uint32 peer_ifindex = 12; + optional uint32 peer_nsid = 13; + optional uint32 master = 14; + optional sit_entry sit = 15; +} + +message netns_id { + /* This is CRIU's id which is allocated for each namespace */ + required uint32 target_ns_id = 1; + /* + * This is an id which can be used to address this namespace + * from another network namespace. Each network namespace has + * one set of id-s for other namespaces. + */ + required int32 netnsid_value = 2; +} + +message netns_entry { + repeated int32 def_conf = 1; + repeated int32 all_conf = 2; + + repeated sysctl_entry def_conf4 = 3; + repeated sysctl_entry all_conf4 = 4; + + repeated sysctl_entry def_conf6 = 5; + repeated sysctl_entry all_conf6 = 6; + + repeated netns_id nsids = 7; + optional string ext_key = 8; + repeated sysctl_entry unix_conf = 9; +} diff --git a/proto/criu/ns.proto b/proto/criu/ns.proto new file mode 100644 index 00000000..f5e9ffd7 --- /dev/null +++ b/proto/criu/ns.proto @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message ns_file_entry { + required uint32 id = 1; + required uint32 ns_id = 2; + required uint32 ns_cflag = 3; + required uint32 flags = 4; +} diff --git a/proto/criu/opts.proto b/proto/criu/opts.proto new file mode 100644 index 00000000..80e6ba92 --- /dev/null +++ b/proto/criu/opts.proto @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "google/protobuf/descriptor.proto"; + +message CRIU_Opts_pb { + optional bool hex = 1; // Idicate that CRIT should treat this field as hex. + optional bool ipadd = 2; // The field is IPv4/v6 address + optional string flags = 3; + optional bool dev = 4; // Device major:minor packed + optional bool odev = 5; // ... in old format + optional string dict = 6; + optional string conv = 7; +} + +extend google.protobuf.FieldOptions { + // Registered unique number to use for all kinds of custom options. + optional CRIU_Opts_pb criu = 1018; +} diff --git a/proto/criu/packet-sock.proto b/proto/criu/packet-sock.proto new file mode 100644 index 00000000..1339782d --- /dev/null +++ b/proto/criu/packet-sock.proto @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; +import "sk-opts.proto"; + +message packet_mclist { + required uint32 index = 1; + required uint32 type = 2; + required bytes addr = 3; +} + +message packet_ring { + required uint32 block_size = 1; + required uint32 block_nr = 2; + required uint32 frame_size = 3; + required uint32 frame_nr = 4; + + required uint32 retire_tmo = 5; + required uint32 sizeof_priv = 6; + required uint32 features = 7; +} + +message packet_sock_entry { + required uint32 id = 1; + required uint32 type = 2; + required uint32 protocol = 3; + required uint32 flags = 4 [(criu).hex = true]; + required uint32 ifindex = 5; + + required fown_entry fown = 6; + required sk_opts_entry opts = 7; + + required uint32 version = 8; + required uint32 reserve = 9; + required bool aux_data = 10; + required bool orig_dev = 11; + required bool vnet_hdr = 12; + required bool loss = 13; + required uint32 timestamp = 14; + required uint32 copy_thresh = 15; + repeated packet_mclist mclist = 16; + optional uint32 fanout = 17 [ default = 0xffffffff ]; + optional packet_ring rx_ring = 18; + optional packet_ring tx_ring = 19; + optional uint32 ns_id = 20; +} diff --git a/proto/criu/pagemap.proto b/proto/criu/pagemap.proto new file mode 100644 index 00000000..801c68df --- /dev/null +++ b/proto/criu/pagemap.proto @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message pagemap_head { + required uint32 pages_id = 1; +} + +message pagemap_entry { + required uint64 vaddr = 1 [(criu).hex = true]; + required uint32 nr_pages = 2; + optional bool in_parent = 3; + optional uint32 flags = 4 [(criu).flags = "pmap.flags" ]; +} diff --git a/proto/criu/pidns.proto b/proto/criu/pidns.proto new file mode 100644 index 00000000..48aee47d --- /dev/null +++ b/proto/criu/pidns.proto @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message pidns_entry { + optional string ext_key = 1; +} diff --git a/proto/criu/pipe-data.proto b/proto/criu/pipe-data.proto new file mode 100644 index 00000000..7938ba4f --- /dev/null +++ b/proto/criu/pipe-data.proto @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message pipe_data_entry { + required uint32 pipe_id = 1; + required uint32 bytes = 2; + optional uint32 size = 3; +} diff --git a/proto/criu/pipe.proto b/proto/criu/pipe.proto new file mode 100644 index 00000000..82d79be0 --- /dev/null +++ b/proto/criu/pipe.proto @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; + +message pipe_entry { + required uint32 id = 1; + required uint32 pipe_id = 2; + required uint32 flags = 3 [(criu).hex = true]; + required fown_entry fown = 4; +} diff --git a/proto/criu/pstree.proto b/proto/criu/pstree.proto new file mode 100644 index 00000000..5fbfc088 --- /dev/null +++ b/proto/criu/pstree.proto @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message pstree_entry { + required uint32 pid = 1; + required uint32 ppid = 2; + required uint32 pgid = 3; + required uint32 sid = 4; + repeated uint32 threads = 5; +} diff --git a/proto/criu/regfile.proto b/proto/criu/regfile.proto new file mode 100644 index 00000000..3558e4dd --- /dev/null +++ b/proto/criu/regfile.proto @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; + +message reg_file_entry { + required uint32 id = 1; + required uint32 flags = 2 [(criu).flags = "rfile.flags"]; + required uint64 pos = 3; + required fown_entry fown = 5; + required string name = 6; + optional sint32 mnt_id = 7 [default = -1]; + optional uint64 size = 8; + optional bool ext = 9; + optional uint32 mode = 10; + + /* This field stores the build-ID of the file if it could be obtained. */ + repeated uint32 build_id = 11; + + /* This field stores the CRC32C checksum of the file if it could be obtained. */ + optional uint32 checksum = 12; + + /* + * This field stores the configuration of bytes which were used in the + * calculation of the checksum, if it could be obtained. + */ + optional uint32 checksum_config = 13; + + /* + * This field stores the checksum parameter if it was used in the calculation + * of the checksum, if it could be obtained. + */ + optional uint32 checksum_parameter = 14; +} \ No newline at end of file diff --git a/proto/criu/remap-file-path.proto b/proto/criu/remap-file-path.proto new file mode 100644 index 00000000..7fac73b1 --- /dev/null +++ b/proto/criu/remap-file-path.proto @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +enum remap_type { + LINKED = 0; + GHOST = 1; + PROCFS = 2; + // Reserved for spfs manager + // SPFS = 3; + // SPFS_LINKED = 4; +}; + +message remap_file_path_entry { + required uint32 orig_id = 1; + required uint32 remap_id = 2; + optional remap_type remap_type = 3; +} diff --git a/proto/criu/rlimit.proto b/proto/criu/rlimit.proto new file mode 100644 index 00000000..d2d96e41 --- /dev/null +++ b/proto/criu/rlimit.proto @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message rlimit_entry { + required uint64 cur = 1; + required uint64 max = 2; +} diff --git a/proto/criu/rpc.proto b/proto/criu/rpc.proto new file mode 100644 index 00000000..2d157d17 --- /dev/null +++ b/proto/criu/rpc.proto @@ -0,0 +1,243 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message criu_page_server_info { + optional string address = 1; + optional int32 port = 2; + optional int32 pid = 3; + optional int32 fd = 4; +} + +message criu_veth_pair { + required string if_in = 1; + required string if_out = 2; +}; + +message ext_mount_map { + required string key = 1; + required string val = 2; +}; + +message join_namespace { + required string ns = 1; + required string ns_file = 2; + optional string extra_opt = 3; +} + +message inherit_fd { + required string key = 1; + required int32 fd = 2; +}; + +message cgroup_root { + optional string ctrl = 1; + required string path = 2; +}; + +message unix_sk { + required uint32 inode = 1; +}; + +enum criu_cg_mode { + IGNORE = 0; + CG_NONE = 1; + PROPS = 2; + SOFT = 3; + FULL = 4; + STRICT = 5; + DEFAULT = 6; +}; + +enum criu_pre_dump_mode { + SPLICE = 1; + VM_READ = 2; +}; + +message criu_opts { + required int32 images_dir_fd = 1; + optional int32 pid = 2; /* if not set on dump, will dump requesting process */ + + optional bool leave_running = 3; + optional bool ext_unix_sk = 4; + optional bool tcp_established = 5; + optional bool evasive_devices = 6; + optional bool shell_job = 7; + optional bool file_locks = 8; + optional int32 log_level = 9 [default = 2]; + optional string log_file = 10; /* No subdirs are allowed. Consider using work-dir */ + + optional criu_page_server_info ps = 11; + + optional bool notify_scripts = 12; + + optional string root = 13; + optional string parent_img = 14; + optional bool track_mem = 15; + optional bool auto_dedup = 16; + + optional int32 work_dir_fd = 17; + optional bool link_remap = 18; + repeated criu_veth_pair veths = 19; /* DEPRECATED, use external instead */ + + optional uint32 cpu_cap = 20 [default = 0xffffffff]; + optional bool force_irmap = 21; + repeated string exec_cmd = 22; + + repeated ext_mount_map ext_mnt = 23; /* DEPRECATED, use external instead */ + optional bool manage_cgroups = 24; /* backward compatibility */ + repeated cgroup_root cg_root = 25; + + optional bool rst_sibling = 26; /* swrk only */ + repeated inherit_fd inherit_fd = 27; /* swrk only */ + + optional bool auto_ext_mnt = 28; + optional bool ext_sharing = 29; + optional bool ext_masters = 30; + + repeated string skip_mnt = 31; + repeated string enable_fs = 32; + + repeated unix_sk unix_sk_ino = 33; /* DEPRECATED, use external instead */ + + optional criu_cg_mode manage_cgroups_mode = 34; + optional uint32 ghost_limit = 35 [default = 0x100000]; + repeated string irmap_scan_paths = 36; + repeated string external = 37; + optional uint32 empty_ns = 38; + repeated join_namespace join_ns = 39; + + optional string cgroup_props = 41; + optional string cgroup_props_file = 42; + repeated string cgroup_dump_controller = 43; + + optional string freeze_cgroup = 44; + optional uint32 timeout = 45; + optional bool tcp_skip_in_flight = 46; + optional bool weak_sysctls = 47; + optional bool lazy_pages = 48; + optional int32 status_fd = 49; + optional bool orphan_pts_master = 50; + optional string config_file = 51; + optional bool tcp_close = 52; + optional string lsm_profile = 53; + optional string tls_cacert = 54; + optional string tls_cacrl = 55; + optional string tls_cert = 56; + optional string tls_key = 57; + optional bool tls = 58; + optional bool tls_no_cn_verify = 59; + optional string cgroup_yard = 60; + optional criu_pre_dump_mode pre_dump_mode = 61 [default = SPLICE]; + optional int32 pidfd_store_sk = 62; + optional string lsm_mount_context = 63; +/* optional bool check_mounts = 128; */ +} + +message criu_dump_resp { + optional bool restored = 1; +} + +message criu_restore_resp { + required int32 pid = 1; +} + +message criu_notify { + optional string script = 1; + optional int32 pid = 2; +} + +enum criu_req_type { + EMPTY = 0; + DUMP = 1; + RESTORE = 2; + CHECK = 3; + PRE_DUMP = 4; + PAGE_SERVER = 5; + + NOTIFY = 6; + + CPUINFO_DUMP = 7; + CPUINFO_CHECK = 8; + + FEATURE_CHECK = 9; + + VERSION = 10; + + WAIT_PID = 11; + PAGE_SERVER_CHLD = 12; +} + +/* + * List of features which can queried via + * CRIU_REQ_TYPE__FEATURE_CHECK + */ +message criu_features { + optional bool mem_track = 1; + optional bool lazy_pages = 2; + optional bool pidfd_store = 3; +} + +/* + * Request -- each type corresponds to must-be-there + * request arguments of respective type + */ + +message criu_req { + required criu_req_type type = 1; + + optional criu_opts opts = 2; + optional bool notify_success = 3; + + /* + * When set service won't close the connection but + * will wait for more req-s to appear. Works not + * for all request types. + */ + optional bool keep_open = 4; + /* + * 'features' can be used to query which features + * are supported by the installed criu/kernel + * via RPC. + */ + optional criu_features features = 5; + + /* 'pid' is used for WAIT_PID */ + optional uint32 pid = 6; +} + +/* + * Response -- it states whether the request was served + * and additional request-specific information + */ + +message criu_resp { + required criu_req_type type = 1; + required bool success = 2; + + optional criu_dump_resp dump = 3; + optional criu_restore_resp restore = 4; + optional criu_notify notify = 5; + optional criu_page_server_info ps = 6; + + optional int32 cr_errno = 7; + optional criu_features features = 8; + optional string cr_errmsg = 9; + optional criu_version version = 10; + + optional int32 status = 11; +} + +/* Answer for criu_req_type.VERSION requests */ +message criu_version { + required int32 major_number = 1; + required int32 minor_number = 2; + optional string gitid = 3; + optional int32 sublevel = 4; + optional int32 extra = 5; + optional string name = 6; +} diff --git a/proto/criu/sa.proto b/proto/criu/sa.proto new file mode 100644 index 00000000..c2a09faf --- /dev/null +++ b/proto/criu/sa.proto @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message sa_entry { + required uint64 sigaction = 1 [(criu).hex = true]; + required uint64 flags = 2 [(criu).hex = true]; + required uint64 restorer = 3 [(criu).hex = true]; + required uint64 mask = 4 [(criu).hex = true]; + optional bool compat_sigaction = 5; + optional uint64 mask_extended = 6 [(criu).hex = true]; +} diff --git a/proto/criu/seccomp.proto b/proto/criu/seccomp.proto new file mode 100644 index 00000000..4d2882a8 --- /dev/null +++ b/proto/criu/seccomp.proto @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message seccomp_filter { + required bytes filter = 1; + optional uint32 prev = 2; + optional uint32 flags = 3; +} + +message seccomp_entry { + repeated seccomp_filter seccomp_filters = 1; +} diff --git a/proto/criu/siginfo.proto b/proto/criu/siginfo.proto new file mode 100644 index 00000000..eba5c5b9 --- /dev/null +++ b/proto/criu/siginfo.proto @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message siginfo_entry { + required bytes siginfo = 1; +} + +message signal_queue_entry { + repeated siginfo_entry signals = 1; +} diff --git a/proto/criu/signalfd.proto b/proto/criu/signalfd.proto new file mode 100644 index 00000000..3e7cef6b --- /dev/null +++ b/proto/criu/signalfd.proto @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; + +message signalfd_entry { + required uint32 id = 1; + required uint32 flags = 2 [(criu).hex = true]; + required fown_entry fown = 3; + required uint64 sigmask = 4 [(criu).hex = true]; +}; diff --git a/proto/criu/sit.proto b/proto/criu/sit.proto new file mode 100644 index 00000000..a660a48b --- /dev/null +++ b/proto/criu/sit.proto @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message sit_entry { + optional uint32 link = 1; + repeated uint32 local = 2 [(criu).ipadd = true]; + repeated uint32 remote = 3 [(criu).ipadd = true]; + optional uint32 ttl = 4; + optional uint32 tos = 5; + optional bool pmtudisc = 6; + optional uint32 proto = 7; + optional uint32 flags = 8; + optional uint32 encap_type = 9; + optional uint32 encap_flags = 10; + optional uint32 encap_sport = 11; + optional uint32 encap_dport = 12; + optional uint32 rd_prefixlen = 13; + repeated uint32 rd_prefix = 14 [(criu).ipadd = true]; + optional uint32 relay_prefixlen = 15; + repeated uint32 relay_prefix = 16 [(criu).ipadd = true]; +}; diff --git a/proto/criu/sk-inet.proto b/proto/criu/sk-inet.proto new file mode 100644 index 00000000..e4ceda9b --- /dev/null +++ b/proto/criu/sk-inet.proto @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; +import "sk-opts.proto"; + +message ip_opts_raw_entry { + optional bool hdrincl = 1; + optional bool nodefrag = 2; + optional bool checksum = 3; + repeated uint32 icmpv_filter = 4; +} + +message ip_opts_entry { + optional bool freebind = 1; + // Fields 2 and 3 are reserved for vz7 use + optional ip_opts_raw_entry raw = 4; +} + +message inet_sk_entry { + /* + * We have two IDs here -- id and ino. The first one + * is used when restoring socket behind a file descriprot. + * The fdinfo image's id is it. The second one is used + * in sk-inet.c internally, in particular we identify + * a TCP stream to restore into this socket using the + * ino value. + */ + required uint32 id = 1; + required uint32 ino = 2; + required uint32 family = 3 [(criu).dict = "sk"]; + required uint32 type = 4 [(criu).dict = "sk"]; + required uint32 proto = 5 [(criu).dict = "sk"]; + required uint32 state = 6 [(criu).dict = "sk"]; + required uint32 src_port = 7; + required uint32 dst_port = 8; + required uint32 flags = 9 [(criu).hex = true]; + required uint32 backlog = 10; + + repeated uint32 src_addr = 11 [(criu).ipadd = true]; + repeated uint32 dst_addr = 12 [(criu).ipadd = true]; + + required fown_entry fown = 13; + required sk_opts_entry opts = 14; + optional bool v6only = 15; + optional ip_opts_entry ip_opts = 16; + + /* for ipv6, we need to send the ifindex to bind(); we keep the ifname + * here and convert it on restore */ + optional string ifname = 17; + optional uint32 ns_id = 18; + optional sk_shutdown shutdown = 19; +} diff --git a/proto/criu/sk-netlink.proto b/proto/criu/sk-netlink.proto new file mode 100644 index 00000000..203b1b6d --- /dev/null +++ b/proto/criu/sk-netlink.proto @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; +import "sk-opts.proto"; + +message netlink_sk_entry { + required uint32 id = 1; + required uint32 ino = 2; + required uint32 protocol = 3; + required uint32 state = 4; + required uint32 flags = 6 [(criu).hex = true]; + required uint32 portid = 7; + repeated uint32 groups = 8; + required uint32 dst_portid = 9; + required uint32 dst_group = 10; + required fown_entry fown = 11; + required sk_opts_entry opts = 12; + optional uint32 ns_id = 13; + // For netlink queued messages + // optional nl_sk_opts_entry nl_opts = 14; +} diff --git a/proto/criu/sk-opts.proto b/proto/criu/sk-opts.proto new file mode 100644 index 00000000..faafbe7c --- /dev/null +++ b/proto/criu/sk-opts.proto @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message sk_opts_entry { + required uint32 so_sndbuf = 1; + required uint32 so_rcvbuf = 2; + + required uint64 so_snd_tmo_sec = 3; + required uint64 so_snd_tmo_usec = 4; + required uint64 so_rcv_tmo_sec = 5; + required uint64 so_rcv_tmo_usec = 6; + optional bool reuseaddr = 7; + + optional uint32 so_priority = 8; + optional uint32 so_rcvlowat = 9; + optional uint32 so_mark = 10; + optional bool so_passcred = 11; + optional bool so_passsec = 12; + optional bool so_dontroute = 13; + optional bool so_no_check = 14; + + optional string so_bound_dev = 15; + + repeated fixed64 so_filter = 16; + optional bool so_reuseport = 17; + optional bool so_broadcast = 18; + optional bool so_keepalive = 19; + optional uint32 tcp_keepcnt = 20; + optional uint32 tcp_keepidle = 21; + optional uint32 tcp_keepintvl = 22; + optional uint32 so_oobinline = 23; + optional uint32 so_linger = 24; +} + +enum sk_shutdown { + NONE = 0; + READ = 1; + WRITE = 2; + BOTH = 3; +} diff --git a/proto/criu/sk-packet.proto b/proto/criu/sk-packet.proto new file mode 100644 index 00000000..3e7e3d27 --- /dev/null +++ b/proto/criu/sk-packet.proto @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message scm_entry { + required uint32 type = 1; + repeated uint32 rights = 2; +} + +message sk_packet_entry { + required uint32 id_for = 1; + required uint32 length = 2; + // Reserved for message address + // optional bytes addr = 3; + repeated scm_entry scm = 4; + // Reserved for ucred restore + // optional sk_ucred_entry ucred = 128; +} diff --git a/proto/criu/sk-unix.proto b/proto/criu/sk-unix.proto new file mode 100644 index 00000000..c9544642 --- /dev/null +++ b/proto/criu/sk-unix.proto @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; +import "sk-opts.proto"; + +message file_perms_entry { + required uint32 mode = 1; + required uint32 uid = 2; + required uint32 gid = 3; +} + +message unix_sk_entry { + /* + * Few words about why we need both -- id and ino. + * + * The former one is used to link file descriptor from + * fdinfo image with the unix_sk_entry that should be + * opened under it. + * + * The latter one ties together unix peers -- the peer + * member on this structure is the ino one of its peer + * and simetimes vise-versa. + */ + required uint32 id = 1; + required uint32 ino = 2; + required uint32 type = 3 [(criu).dict = "sk"]; + required uint32 state = 4 [(criu).dict = "sk"]; + required uint32 flags = 5 [(criu).hex = true]; + required uint32 uflags = 6 [(criu).hex = true]; + required uint32 backlog = 7; + required uint32 peer = 8; + required fown_entry fown = 9; + required sk_opts_entry opts = 10; + + /* + * Abstract name may contain \0 at any point, + * so we need to carry it as byte sequence... + */ + required bytes name = 11 [(criu).conv = "unix_name"]; + + optional sk_shutdown shutdown = 12; + + optional file_perms_entry file_perms = 13; + + /* + * Relative socket name may have prefix. + */ + optional string name_dir = 14; + optional bool deleted = 15; + + optional uint32 ns_id = 16; + optional sint32 mnt_id = 17 [default = -1]; + /* Please, don't use field with number 18. */ +} diff --git a/proto/criu/stats.proto b/proto/criu/stats.proto new file mode 100644 index 00000000..aa3d26f1 --- /dev/null +++ b/proto/criu/stats.proto @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +// This one contains statistics about dump/restore process +message dump_stats_entry { + required uint32 freezing_time = 1; + required uint32 frozen_time = 2; + required uint32 memdump_time = 3; + required uint32 memwrite_time = 4; + + required uint64 pages_scanned = 5; + required uint64 pages_skipped_parent = 6; + required uint64 pages_written = 7; + + optional uint32 irmap_resolve = 8; + + required uint64 pages_lazy = 9; + optional uint64 page_pipes = 10; + optional uint64 page_pipe_bufs = 11; + + optional uint64 shpages_scanned = 12; + optional uint64 shpages_skipped_parent = 13; + optional uint64 shpages_written = 14; +} + +message restore_stats_entry { + required uint64 pages_compared = 1; + required uint64 pages_skipped_cow = 2; + + required uint32 forking_time = 3; + required uint32 restore_time = 4; + + optional uint64 pages_restored = 5; +} + +message stats_entry { + optional dump_stats_entry dump = 1; + optional restore_stats_entry restore = 2; +} diff --git a/proto/criu/sysctl.proto b/proto/criu/sysctl.proto new file mode 100644 index 00000000..a1297486 --- /dev/null +++ b/proto/criu/sysctl.proto @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +enum SysctlType { + CTL_STR = 5; + CTL_32 = 6; +} + +message sysctl_entry { + required SysctlType type = 1; + + optional int32 iarg = 2; + optional string sarg = 3; +} diff --git a/proto/criu/tcp-stream.proto b/proto/criu/tcp-stream.proto new file mode 100644 index 00000000..ae0c83a8 --- /dev/null +++ b/proto/criu/tcp-stream.proto @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message tcp_stream_entry { + required uint32 inq_len = 1; + required uint32 inq_seq = 2; + required uint32 outq_len = 3; /* unsent and sent data in the send queue*/ + required uint32 outq_seq = 4; + + required uint32 opt_mask = 5 [(criu).hex = true]; /* TCPI_OPT_ bits */ + required uint32 snd_wscale = 6; + required uint32 mss_clamp = 7; + optional uint32 rcv_wscale = 8; + optional uint32 timestamp = 9; + + optional bool cork = 10; + optional bool nodelay = 11; + + optional uint32 unsq_len = 12; /* unsent data in the send queue */ + + optional uint32 snd_wl1 = 13; + optional uint32 snd_wnd = 14; + optional uint32 max_window = 15; + optional uint32 rcv_wnd = 16; + optional uint32 rcv_wup = 17; +} diff --git a/proto/criu/time.proto b/proto/criu/time.proto new file mode 100644 index 00000000..152d800c --- /dev/null +++ b/proto/criu/time.proto @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message timeval { + required uint64 tv_sec = 1; + required uint64 tv_usec = 2; +} diff --git a/proto/criu/timens.proto b/proto/criu/timens.proto new file mode 100644 index 00000000..ad8eb79d --- /dev/null +++ b/proto/criu/timens.proto @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message timespec { + required uint64 tv_sec = 1; + required uint64 tv_nsec = 2; +} +message timens_entry { + required timespec monotonic = 1; + required timespec boottime = 2; +} diff --git a/proto/criu/timer.proto b/proto/criu/timer.proto new file mode 100644 index 00000000..c8f443fa --- /dev/null +++ b/proto/criu/timer.proto @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message itimer_entry { + required uint64 isec = 1; + required uint64 iusec = 2; + required uint64 vsec = 3; + required uint64 vusec = 4; +} + +message posix_timer_entry { + required uint32 it_id = 1; + required uint32 clock_id = 2; + required uint32 si_signo = 3; + required uint32 it_sigev_notify = 4; + required uint64 sival_ptr = 5; + required uint32 overrun = 6; + + required uint64 isec = 7; + required uint64 insec = 8; + required uint64 vsec = 9; + required uint64 vnsec = 10; + optional int32 notify_thread_id= 11; +} + +message task_timers_entry { + required itimer_entry real = 1; + required itimer_entry virt = 2; + required itimer_entry prof = 3; + repeated posix_timer_entry posix = 4; +} diff --git a/proto/criu/timerfd.proto b/proto/criu/timerfd.proto new file mode 100644 index 00000000..b817d9c9 --- /dev/null +++ b/proto/criu/timerfd.proto @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; + +message timerfd_entry { + required uint32 id = 1; + required uint32 flags = 2 [(criu).hex = true]; + required fown_entry fown = 3; + + required uint32 clockid = 4; + required uint64 ticks = 5; + required uint32 settime_flags = 6 [(criu).hex = true]; + + required uint64 vsec = 7; + required uint64 vnsec = 8; + required uint64 isec = 9; + required uint64 insec = 10; +} diff --git a/proto/criu/tty.proto b/proto/criu/tty.proto new file mode 100644 index 00000000..5e68aaca --- /dev/null +++ b/proto/criu/tty.proto @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; +import "fown.proto"; + +message winsize_entry { + required uint32 ws_row = 1; + required uint32 ws_col = 2; + required uint32 ws_xpixel = 3; + required uint32 ws_ypixel = 4; +}; + +message termios_entry { + required uint32 c_iflag = 1; + required uint32 c_oflag = 2; + required uint32 c_cflag = 3; + required uint32 c_lflag = 4; + required uint32 c_line = 5; + required uint32 c_ispeed = 6; + required uint32 c_ospeed = 7; + + repeated uint32 c_cc = 8; +} + +message tty_pty_entry { + required uint32 index = 1; +} + +enum TtyType { + UNKNOWN = 0; + PTY = 1; + CONSOLE = 2; + VT = 3; + CTTY = 4; + EXT_TTY = 5; + SERIAL = 6; +} + +message tty_data_entry { + required uint32 tty_id = 1; + required bytes data = 2; + + // optional sint32 mnt_id = 3 [default = 0]; +} + +message tty_info_entry { + required uint32 id = 1; + + required TtyType type = 2; + + required bool locked = 3; /* Unix98 PTY only */ + required bool exclusive = 4; + required bool packet_mode = 5; /* Unix98 PTY only */ + + required uint32 sid = 6; + required uint32 pgrp = 7; + + /* + * Convenient for printing errors and such, with this + * device encoded we can figure out major and minor + * numbers. + */ + required uint32 rdev = 8; + + optional termios_entry termios = 9; + optional termios_entry termios_locked = 10; + optional winsize_entry winsize = 11; + + /* + * These are optional fields which presence depends on + * TTY type. + */ + optional tty_pty_entry pty = 12; + optional uint32 dev = 13; + + optional uint32 uid = 14; + optional uint32 gid = 15; + + // optional sint32 mnt_id = 16 [default = 0]; +}; + +message tty_file_entry { + required uint32 id = 1; + required uint32 tty_info_id = 2; + + required uint32 flags = 3 [(criu).hex = true]; + required fown_entry fown = 4; + // optional sint32 mnt_id = 5 [default = 0]; + optional uint32 regf_id = 6; +} diff --git a/proto/criu/tun.proto b/proto/criu/tun.proto new file mode 100644 index 00000000..54c6257d --- /dev/null +++ b/proto/criu/tun.proto @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message tunfile_entry { + required uint32 id = 1; + optional string netdev = 2; + optional bool detached = 3; + optional uint32 ns_id = 4; +}; + +message tun_link_entry { + required uint32 flags = 1 [(criu).hex = true]; + required int32 owner = 2; + required int32 group = 3; + required uint32 vnethdr = 4; + required uint32 sndbuf = 5; +}; diff --git a/proto/criu/userns.proto b/proto/criu/userns.proto new file mode 100644 index 00000000..f644dbce --- /dev/null +++ b/proto/criu/userns.proto @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message uid_gid_extent { + required uint32 first = 1; + required uint32 lower_first = 2; + required uint32 count = 3; +} + +message userns_entry { + repeated uid_gid_extent uid_map = 1; + repeated uid_gid_extent gid_map = 2; +} diff --git a/proto/criu/utsns.proto b/proto/criu/utsns.proto new file mode 100644 index 00000000..9d256dc2 --- /dev/null +++ b/proto/criu/utsns.proto @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +message utsns_entry { + required string nodename = 1; + required string domainname = 2; +} diff --git a/proto/criu/vma.proto b/proto/criu/vma.proto new file mode 100644 index 00000000..ac58e594 --- /dev/null +++ b/proto/criu/vma.proto @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + + +// File imported by sync_criu_proto_files.sh + +syntax = "proto2"; +package criu; + +import "opts.proto"; + +message vma_entry { + required uint64 start = 1 [(criu).hex = true]; + required uint64 end = 2 [(criu).hex = true]; + required uint64 pgoff = 3; + required uint64 shmid = 4; + required uint32 prot = 5 [(criu).flags = "mmap.prot" ]; + required uint32 flags = 6 [(criu).flags = "mmap.flags" ]; + required uint32 status = 7 [(criu).flags = "mmap.status" ]; + /* + * This fd thing is unused in the image, it was lost + * while switching from execve restore model. It is + * -1 by default. + */ + required sint64 fd = 8; + + /* madvise flags bitmap */ + optional uint64 madv = 9 [(criu).hex = true]; + + /* file status flags */ + optional uint32 fdflags = 10 [(criu).hex = true]; +} diff --git a/proto/sync_criu_proto_files.sh b/proto/sync_criu_proto_files.sh new file mode 100755 index 00000000..cd55e73c --- /dev/null +++ b/proto/sync_criu_proto_files.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -eux + +sed --version > /dev/null # This commeand fails on BSD, and we don't want the BSD version of sed + +if [ $# != 1 ]; then + echo "Usage: $0 /path/to/criu/project" + exit 1 +fi + +cd ./criu + +CRIU_SRC=$1 +cp -a "$CRIU_SRC"/images/LICENSE . +cp -a "$CRIU_SRC"/images/*.proto . +sed -i -E "s/^(syntax =.*)$/\\ +\/\/ File imported by sync_criu_proto_files.sh\n\n\1\npackage criu;/g" ./*.proto +# This is to avoid a conflict with "message criu_opts" in rpc.proto +sed -i -E "s/CRIU_Opts/CRIU_Opts_pb/g" opts.proto +chmod 644 ./*.proto