├── .gitignore ├── types ├── paths.go └── handshake.go ├── dhcp ├── iana │ ├── iana.go │ └── entid.go ├── dhcpv4 │ ├── defaults.go │ ├── option_message_type.go │ ├── bindtointerface.go │ ├── bsdp │ │ ├── vendor_class_identifier.go │ │ ├── doc.go │ │ └── vendor_class_identifier_darwin.go │ ├── server4 │ │ └── conn_windows.go │ ├── option_generic.go │ └── option_misc.go ├── .stickler.yml ├── .gitignore ├── interfaces │ ├── bindtodevice_linux.go │ ├── bindtodevice_windows.go │ ├── bindtodevice_js.go │ ├── bindtodevice_darwin.go │ └── bindtodevice_bsd.go └── CONTRIBUTORS.md ├── gvisor ├── pkg │ ├── fd │ │ └── fd_state_autogen.go │ ├── p9 │ │ └── p9_state_autogen.go │ ├── abi │ │ ├── abi_state_autogen.go │ │ ├── gasket │ │ │ └── gasket_state_autogen.go │ │ ├── nvgpu │ │ │ ├── nvgpu_state_autogen.go │ │ │ ├── nvgpu_unsafe_state_autogen.go │ │ │ ├── nvgpu_unsafe_abi_autogen_unsafe.go │ │ │ └── status.go │ │ ├── linux │ │ │ ├── errno │ │ │ │ └── errno_state_autogen.go │ │ │ ├── exec.go │ │ │ ├── uio.go │ │ │ ├── eventfd.go │ │ │ ├── splice.go │ │ │ ├── timer.go │ │ │ ├── arch_amd64.go │ │ │ ├── fadvise.go │ │ │ ├── audit.go │ │ │ ├── mm_amd64.go │ │ │ ├── mm_arm64.go │ │ │ ├── sem_arm64.go │ │ │ ├── keyctl.go │ │ │ ├── epoll_arm64.go │ │ │ └── sem_amd64.go │ │ ├── abi_linux_state_autogen.go │ │ └── abi_linux.go │ ├── pool │ │ └── pool_state_autogen.go │ ├── refs │ │ └── refs_state_autogen.go │ ├── unet │ │ ├── unet_state_autogen.go │ │ └── unet_unsafe_state_autogen.go │ ├── urpc │ │ └── urpc_state_autogen.go │ ├── secio │ │ └── secio_state_autogen.go │ ├── xdp │ │ ├── xdp_unsafe_state_autogen.go │ │ └── xdp_state_autogen.go │ ├── binary │ │ └── binary_state_autogen.go │ ├── cleanup │ │ └── cleanup_state_autogen.go │ ├── context │ │ └── context_state_autogen.go │ ├── coretag │ │ ├── coretag_state_autogen.go │ │ └── coretag_unsafe_state_autogen.go │ ├── errors │ │ ├── errors_state_autogen.go │ │ └── linuxerr │ │ │ └── linuxerr_state_autogen.go │ ├── eventfd │ │ ├── eventfd_state_autogen.go │ │ └── eventfd_unsafe_state_autogen.go │ ├── fspath │ │ └── fspath_state_autogen.go │ ├── fsutil │ │ ├── fsutil_state_autogen.go │ │ ├── fsutil_unsafe_state_autogen.go │ │ ├── fsutil_amd64_unsafe_state_autogen.go │ │ ├── fsutil_arm64_unsafe_state_autogen.go │ │ └── fsutil.go │ ├── hostos │ │ └── hostos_state_autogen.go │ ├── hosttid │ │ └── hosttid_state_autogen.go │ ├── marshal │ │ ├── marshal_state_autogen.go │ │ └── primitive │ │ │ └── primitive_state_autogen.go │ ├── rand │ │ ├── rand_linux_state_autogen.go │ │ ├── rand_state_autogen.go │ │ └── rand.go │ ├── ring0 │ │ ├── ring0_unsafe_state_autogen.go │ │ ├── pagetables │ │ │ ├── pagetables_state_autogen.go │ │ │ ├── pagetables_unsafe_state_autogen.go │ │ │ ├── pagetables_amd64_state_autogen.go │ │ │ ├── pagetables_arm64_state_autogen.go │ │ │ ├── pagetables_aarch64_state_autogen.go │ │ │ ├── pagetables_x86_state_autogen.go │ │ │ └── pcids_x86.go │ │ ├── ring0_state_autogen.go │ │ ├── ring0_amd64_state_autogen.go │ │ ├── ring0_arm64_state_autogen.go │ │ └── ring0.go │ ├── safemem │ │ ├── safemem_state_autogen.go │ │ ├── safemem_unsafe_state_autogen.go │ │ └── safemem.go │ ├── seccomp │ │ ├── seccomp_state_autogen.go │ │ ├── seccomp_unsafe_state_autogen.go │ │ ├── seccomp_amd64_state_autogen.go │ │ ├── seccomp_arm64_state_autogen.go │ │ ├── seccomp_amd64.go │ │ └── seccomp_arm64.go │ ├── sentry │ │ ├── arch │ │ │ ├── fpu │ │ │ │ ├── fpu_state_autogen.go │ │ │ │ ├── fpu_unsafe_state_autogen.go │ │ │ │ ├── fpu_arm64_state_autogen.go │ │ │ │ ├── fpu_amd64_state_autogen.go │ │ │ │ ├── fpu_abi_autogen_unsafe.go │ │ │ │ ├── fpu_amd64_unsafe_state_autogen.go │ │ │ │ ├── fpu_unsafe_abi_autogen_unsafe.go │ │ │ │ ├── fpu_arm64_abi_autogen_unsafe.go │ │ │ │ └── fpu_amd64_unsafe_abi_autogen_unsafe.go │ │ │ ├── arch_unsafe_state_autogen.go │ │ │ ├── arch_abi_autogen_unsafe.go │ │ │ ├── arch_unsafe_abi_autogen_unsafe.go │ │ │ ├── arch_aarch64_abi_autogen_unsafe.go │ │ │ ├── arch_x86_impl_abi_autogen_unsafe.go │ │ │ ├── arch_x86_abi_autogen_unsafe.go │ │ │ ├── arch_state_x86.go │ │ │ ├── arch_amd64_state_autogen.go │ │ │ ├── arch_x86_state_autogen.go │ │ │ ├── arch_x86_impl_state_autogen.go │ │ │ ├── auxv.go │ │ │ └── arch_arm64_state_autogen.go │ │ ├── time │ │ │ ├── time_state_autogen.go │ │ │ ├── time_unsafe_state_autogen.go │ │ │ ├── time_amd64_state_autogen.go │ │ │ ├── time_arm64_state_autogen.go │ │ │ ├── vdso.go │ │ │ ├── tsc_arm64.s │ │ │ ├── vdso_arm64.s │ │ │ ├── sampler_amd64.go │ │ │ └── tsc_amd64.s │ │ ├── fsimpl │ │ │ ├── user │ │ │ │ └── user_state_autogen.go │ │ │ ├── gofer │ │ │ │ └── gofer_impl_state_autogen.go │ │ │ ├── host │ │ │ │ └── host_unsafe_state_autogen.go │ │ │ ├── iouringfs │ │ │ │ └── iouringfs_unsafe_state_autogen.go │ │ │ ├── fuse │ │ │ │ └── dev_state.go │ │ │ ├── devtmpfs │ │ │ │ └── save_restore.go │ │ │ └── erofs │ │ │ │ └── save_restore.go │ │ ├── hostfd │ │ │ ├── hostfd_state_autogen.go │ │ │ ├── hostfd_unsafe_state_autogen.go │ │ │ └── hostfd_linux_state_autogen.go │ │ ├── hostmm │ │ │ └── hostmm_state_autogen.go │ │ ├── strace │ │ │ ├── strace_state_autogen.go │ │ │ ├── strace_amd64_state_autogen.go │ │ │ └── strace_arm64_state_autogen.go │ │ ├── unimpl │ │ │ └── unimpl_state_autogen.go │ │ ├── vfs │ │ │ ├── vfs_unsafe_state_autogen.go │ │ │ ├── vfs_testonly_state_autogen.go │ │ │ ├── debug_testonly.go │ │ │ ├── debug.go │ │ │ └── memxattr │ │ │ │ └── memxattr_state_autogen.go │ │ ├── control │ │ │ ├── control_state_autogen.go │ │ │ └── control.go │ │ ├── fdimport │ │ │ └── fdimport_state_autogen.go │ │ ├── fsmetric │ │ │ └── fsmetric_state_autogen.go │ │ ├── fsutil │ │ │ ├── fsutil_unsafe_state_autogen.go │ │ │ ├── fsutil.go │ │ │ └── host_file_mapper_state.go │ │ ├── hostcpu │ │ │ ├── hostcpu_state_autogen.go │ │ │ └── getcpu_amd64.s │ │ ├── kernel │ │ │ ├── sched │ │ │ │ ├── sched_state_autogen.go │ │ │ │ └── sched.go │ │ │ ├── pipe │ │ │ │ ├── pipe_unsafe_state_autogen.go │ │ │ │ └── save_restore.go │ │ │ ├── memevent │ │ │ │ └── memevent_state_autogen.go │ │ │ ├── kernel_amd64_state_autogen.go │ │ │ ├── kernel_arm64_state_autogen.go │ │ │ ├── auth │ │ │ │ └── auth_unsafe_abi_autogen_unsafe.go │ │ │ ├── kernel_unsafe_abi_autogen_unsafe.go │ │ │ ├── kernel_amd64_abi_autogen_unsafe.go │ │ │ ├── kernel_arm64_abi_autogen_unsafe.go │ │ │ ├── kernel_impl_abi_autogen_unsafe.go │ │ │ ├── kernel_opts_abi_autogen_unsafe.go │ │ │ ├── kernel_opts_state_autogen.go │ │ │ ├── kernel_impl_state_autogen.go │ │ │ ├── kernel_opts.go │ │ │ ├── ipc │ │ │ │ └── ns.go │ │ │ ├── futex │ │ │ │ └── futex_unsafe_state_autogen.go │ │ │ └── ptrace_arm64.go │ │ ├── platform │ │ │ ├── platform_state_autogen.go │ │ │ ├── ptrace │ │ │ │ ├── ptrace_state_autogen.go │ │ │ │ ├── ptrace_arm64_state_autogen.go │ │ │ │ ├── ptrace_linux_state_autogen.go │ │ │ │ ├── ptrace_unsafe_state_autogen.go │ │ │ │ ├── ptrace_arm64_unsafe_state_autogen.go │ │ │ │ ├── ptrace_amd64_state_autogen.go │ │ │ │ └── ptrace_linux_unsafe_state_autogen.go │ │ │ ├── systrap │ │ │ │ ├── sysmsg │ │ │ │ │ ├── sysmsg_state_autogen.go │ │ │ │ │ ├── sysmsg_unsafe_state_autogen.go │ │ │ │ │ ├── sysmsg_amd64_state_autogen.go │ │ │ │ │ ├── sysmsg_arm64_state_autogen.go │ │ │ │ │ ├── sighandler.built-in.amd64.bin │ │ │ │ │ ├── sighandler.built-in.arm64.bin │ │ │ │ │ ├── sighandler_amd64.go │ │ │ │ │ └── sighandler_arm64.go │ │ │ │ ├── usertrap │ │ │ │ │ ├── usertrap_state_autogen.go │ │ │ │ │ ├── usertrap_amd64_unsafe_state_autogen.go │ │ │ │ │ ├── usertrap_abi_autogen_unsafe.go │ │ │ │ │ ├── usertrap_arm64_abi_autogen_unsafe.go │ │ │ │ │ ├── usertrap_amd64_unsafe_abi_autogen_unsafe.go │ │ │ │ │ ├── usertrap_arm64_state_autogen.go │ │ │ │ │ └── usertrap_amd64_state_autogen.go │ │ │ │ ├── systrap_race_state_autogen.go │ │ │ │ ├── systrap_linux_state_autogen.go │ │ │ │ ├── systrap_norace_state_autogen.go │ │ │ │ ├── systrap_unsafe_state_autogen.go │ │ │ │ ├── systrap_arm64_unsafe_state_autogen.go │ │ │ │ ├── systrap_linux_unsafe_state_autogen.go │ │ │ │ ├── systrap_amd64_state_autogen.go │ │ │ │ ├── systrap_arm64_state_autogen.go │ │ │ │ ├── lib_arm64.s │ │ │ │ ├── lib_amd64.s │ │ │ │ ├── shared_context_race.go │ │ │ │ ├── systrap_arm64.go │ │ │ │ ├── shared_context_norace.go │ │ │ │ ├── sysmsg_thread_arm64.go │ │ │ │ ├── filters_amd64.go │ │ │ │ └── context_queue_unsafe.go │ │ │ ├── interrupt │ │ │ │ └── interrupt_state_autogen.go │ │ │ ├── platform_amd64_state_autogen.go │ │ │ ├── platform_arm64_state_autogen.go │ │ │ ├── kvm │ │ │ │ ├── kvm_amd64_state_autogen.go │ │ │ │ ├── kvm_amd64_unsafe_state_autogen.go │ │ │ │ ├── kvm_arm64_unsafe_state_autogen.go │ │ │ │ ├── kvm_arm64_state_autogen.go │ │ │ │ ├── kvm_state_autogen.go │ │ │ │ ├── physical_map_arm64.go │ │ │ │ ├── kvm_const_amd64.go │ │ │ │ ├── physical_map_amd64.go │ │ │ │ ├── address_space_arm64.go │ │ │ │ └── address_space_amd64.go │ │ │ └── cpuid_arm64.go │ │ ├── seccheck │ │ │ ├── seccheck_state_autogen.go │ │ │ ├── sinks │ │ │ │ ├── null │ │ │ │ │ └── null_state_autogen.go │ │ │ │ └── remote │ │ │ │ │ ├── remote_state_autogen.go │ │ │ │ │ └── wire │ │ │ │ │ └── wire_state_autogen.go │ │ │ ├── seccheck_unsafe_state_autogen.go │ │ │ ├── seccheck_amd64_state_autogen.go │ │ │ └── seccheck_arm64_state_autogen.go │ │ ├── state │ │ │ ├── state_unsafe_state_autogen.go │ │ │ └── state_state_autogen.go │ │ ├── syscalls │ │ │ ├── syscalls_state_autogen.go │ │ │ └── linux │ │ │ │ ├── linux_amd64_state_autogen.go │ │ │ │ ├── linux_arm64_state_autogen.go │ │ │ │ ├── linux_amd64_abi_autogen_unsafe.go │ │ │ │ └── linux_arm64_abi_autogen_unsafe.go │ │ ├── uniqueid │ │ │ └── uniqueid_state_autogen.go │ │ ├── usage │ │ │ ├── usage_unsafe_state_autogen.go │ │ │ ├── usage.go │ │ │ └── memory_unsafe.go │ │ ├── watchdog │ │ │ └── watchdog_state_autogen.go │ │ ├── devices │ │ │ ├── accel │ │ │ │ └── accel_unsafe_state_autogen.go │ │ │ ├── nvproxy │ │ │ │ └── nvproxy_unsafe_state_autogen.go │ │ │ └── ttydev │ │ │ │ └── ttydev_state_autogen.go │ │ ├── pgalloc │ │ │ └── pgalloc_unsafe_state_autogen.go │ │ ├── socket │ │ │ ├── netfilter │ │ │ │ └── netfilter_state_autogen.go │ │ │ ├── hostinet │ │ │ │ ├── hostinet_unsafe_state_autogen.go │ │ │ │ ├── hostinet_impl_state_autogen.go │ │ │ │ └── hostinet.go │ │ │ ├── unix │ │ │ │ └── transport │ │ │ │ │ ├── transport_unsafe_state_autogen.go │ │ │ │ │ ├── connectionless_state.go │ │ │ │ │ └── save_restore.go │ │ │ ├── netlink │ │ │ │ ├── route │ │ │ │ │ └── route_state_autogen.go │ │ │ │ ├── uevent │ │ │ │ │ └── uevent_state_autogen.go │ │ │ │ └── port │ │ │ │ │ └── port_state_autogen.go │ │ │ ├── socket_state.go │ │ │ └── netstack │ │ │ │ ├── netstack_state.go │ │ │ │ └── save_restore.go │ │ ├── loader │ │ │ ├── vdsodata │ │ │ │ ├── vdso_amd64.so │ │ │ │ ├── vdso_arm64.so │ │ │ │ ├── vdsodata.go │ │ │ │ ├── vdsodata_amd64.go │ │ │ │ └── vdsodata_arm64.go │ │ │ └── loader_abi_autogen_unsafe.go │ │ └── mm │ │ │ └── aio_context_state.go │ ├── usermem │ │ ├── usermem_state_autogen.go │ │ └── usermem_unsafe_state_autogen.go │ ├── buffer │ │ ├── buffer_unsafe_state_autogen.go │ │ ├── buffer_state.go │ │ └── view_unsafe.go │ ├── control │ │ ├── client │ │ │ └── client_state_autogen.go │ │ └── server │ │ │ └── server_state_autogen.go │ ├── metric │ │ ├── metric_unsafe_state_autogen.go │ │ ├── metric_state_autogen.go │ │ ├── sentry_profiling.go │ │ └── sentry_profiling_fake.go │ ├── safecopy │ │ ├── safecopy_state_autogen.go │ │ ├── safecopy_unsafe_state_autogen.go │ │ ├── safecopy_arm64_state_autogen.go │ │ ├── safecopy_amd64_unsafe_state_autogen.go │ │ └── safecopy_arm64.go │ ├── state │ │ ├── pretty │ │ │ └── pretty_state_autogen.go │ │ ├── statefile │ │ │ └── statefile_state_autogen.go │ │ ├── state_race.go │ │ └── state_norace.go │ ├── syncevent │ │ ├── syncevent_state_autogen.go │ │ └── syncevent_unsafe_state_autogen.go │ ├── tcpip │ │ ├── link │ │ │ ├── muxed │ │ │ │ └── muxed_state_autogen.go │ │ │ ├── pipe │ │ │ │ └── pipe_state_autogen.go │ │ │ ├── nested │ │ │ │ └── nested_state_autogen.go │ │ │ ├── sniffer │ │ │ │ └── sniffer_state_autogen.go │ │ │ ├── ethernet │ │ │ │ └── ethernet_state_autogen.go │ │ │ ├── loopback │ │ │ │ └── loopback_state_autogen.go │ │ │ ├── sharedmem │ │ │ │ ├── pipe │ │ │ │ │ ├── pipe_state_autogen.go │ │ │ │ │ └── pipe_unsafe_state_autogen.go │ │ │ │ ├── queue │ │ │ │ │ └── queue_state_autogen.go │ │ │ │ ├── sharedmem_unsafe_state_autogen.go │ │ │ │ └── sharedmem_state_autogen.go │ │ │ ├── waitable │ │ │ │ └── waitable_state_autogen.go │ │ │ ├── packetsocket │ │ │ │ └── packetsocket_state_autogen.go │ │ │ ├── xdp │ │ │ │ └── xdp_state_autogen.go │ │ │ ├── stopfd │ │ │ │ └── stopfd_state_autogen.go │ │ │ ├── tun │ │ │ │ └── tun_unsafe_state_autogen.go │ │ │ ├── rawfile │ │ │ │ ├── rawfile_state_autogen.go │ │ │ │ └── rawfile_unsafe_state_autogen.go │ │ │ ├── fdbased │ │ │ │ ├── fdbased_unsafe_state_autogen.go │ │ │ │ ├── fdbased_state_autogen.go │ │ │ │ ├── endpoint_unsafe.go │ │ │ │ └── mmap_stub.go │ │ │ └── channel │ │ │ │ └── channel_state_autogen.go │ │ ├── network │ │ │ ├── arp │ │ │ │ └── arp_state_autogen.go │ │ │ ├── hash │ │ │ │ └── hash_state_autogen.go │ │ │ └── internal │ │ │ │ └── multicast │ │ │ │ └── multicast_state_autogen.go │ │ ├── seqnum │ │ │ └── seqnum_state_autogen.go │ │ ├── adapters │ │ │ └── gonet │ │ │ │ └── gonet_state_autogen.go │ │ ├── checksum │ │ │ ├── checksum_state_autogen.go │ │ │ └── checksum_unsafe_state_autogen.go │ │ ├── faketime │ │ │ └── faketime_state_autogen.go │ │ ├── hash │ │ │ └── jenkins │ │ │ │ └── jenkins_state_autogen.go │ │ ├── header │ │ │ ├── parse │ │ │ │ └── parse_state_autogen.go │ │ │ └── datagram.go │ │ ├── stack │ │ │ ├── stack_unsafe_state_autogen.go │ │ │ └── stack_global_state.go │ │ ├── transport │ │ │ ├── tcp │ │ │ │ ├── tcp_unsafe_state_autogen.go │ │ │ │ └── segment_unsafe.go │ │ │ ├── transport_state_autogen.go │ │ │ ├── tcpconntrack │ │ │ │ └── tcpconntrack_state_autogen.go │ │ │ ├── transport.go │ │ │ └── internal │ │ │ │ └── noop │ │ │ │ └── noop_state_autogen.go │ │ ├── internal │ │ │ └── tcp │ │ │ │ └── tcp_state_autogen.go │ │ ├── tcpip_state.go │ │ ├── stdclock_state.go │ │ └── ports │ │ │ └── ports_state_autogen.go │ ├── compressio │ │ └── compressio_state_autogen.go │ ├── flipcall │ │ ├── flipcall_unsafe_state_autogen.go │ │ ├── flipcall_state_autogen.go │ │ └── flipcall_linux_state_autogen.go │ ├── hostarch │ │ ├── hostarch_unsafe_state_autogen.go │ │ ├── hostarch_arm64_state_autogen.go │ │ ├── hostarch_x86_state_autogen.go │ │ └── hostarch.go │ ├── memutil │ │ ├── memutil_unsafe_state_autogen.go │ │ ├── memutil_state_autogen.go │ │ └── memutil_linux_unsafe_state_autogen.go │ ├── prometheus │ │ └── prometheus_state_autogen.go │ ├── eventchannel │ │ └── eventchannel_state_autogen.go │ ├── syserr │ │ ├── syserr_state_autogen.go │ │ └── syserr_linux_state_autogen.go │ ├── coverage │ │ └── coverage_state_autogen.go │ ├── fdnotifier │ │ ├── fdnotifier_state_autogen.go │ │ └── fdnotifier_unsafe_state_autogen.go │ ├── sighandling │ │ ├── sighandling_state_autogen.go │ │ └── sighandling_linux_unsafe_state_autogen.go │ ├── atomicbitops │ │ └── atomicbitops_arm64_state_autogen.go │ ├── bits │ │ ├── bits_state_autogen.go │ │ ├── bits32.go │ │ ├── bits64.go │ │ └── uint64_arch_amd64_asm.s │ ├── fdchannel │ │ └── fdchannel_unsafe_state_autogen.go │ ├── sync │ │ ├── sync.go │ │ ├── checklocks_off_unsafe.go │ │ ├── runtime_other.go │ │ ├── goyield_go113_unsafe.go │ │ ├── runtime_go121_unsafe.go │ │ ├── runtime_not_go121_unsafe.go │ │ ├── goyield_unsafe.go │ │ ├── runtime_amd64.go │ │ ├── runtime.go │ │ ├── fence.go │ │ ├── aliases.go │ │ ├── runtime_spinning_other.s │ │ ├── fence_arm64.s │ │ └── runtime_spinning_amd64.s │ ├── cpuid │ │ ├── cpuid_state_autogen.go │ │ └── native_amd64.s │ ├── goid │ │ ├── goid_amd64.s │ │ ├── goid_arm64.s │ │ └── goid.go │ └── bitmap │ │ └── bitmap_state_autogen.go ├── README.md └── AUTHORS ├── tap └── connection.go ├── virtualnetwork └── deprecated.go ├── uio ├── ubinary │ ├── doc.go │ ├── big_endian.go │ └── little_endian.go ├── rand │ ├── random_unix.go │ └── random_std.go ├── .gitignore ├── uio │ ├── uio.go │ ├── alignwriter.go │ └── multiwriter.go ├── cross-compile.sh └── ulog │ └── ulogtest │ └── log.go ├── vnet ├── qemu.go └── stats.go └── Makefile /.gitignore: -------------------------------------------------------------------------------- 1 | /go-netstack -------------------------------------------------------------------------------- /types/paths.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | const ConnectPath = "/connect" 4 | -------------------------------------------------------------------------------- /dhcp/iana/iana.go: -------------------------------------------------------------------------------- 1 | // Package iana contains constants defined by IANA. 2 | package iana 3 | -------------------------------------------------------------------------------- /gvisor/pkg/fd/fd_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fd 4 | -------------------------------------------------------------------------------- /gvisor/pkg/p9/p9_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package p9 4 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/abi_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package abi 4 | -------------------------------------------------------------------------------- /gvisor/pkg/pool/pool_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pool 4 | -------------------------------------------------------------------------------- /gvisor/pkg/refs/refs_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package refs 4 | -------------------------------------------------------------------------------- /gvisor/pkg/unet/unet_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package unet 4 | -------------------------------------------------------------------------------- /gvisor/pkg/urpc/urpc_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package urpc 4 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/defaults.go: -------------------------------------------------------------------------------- 1 | package dhcpv4 2 | 3 | const ( 4 | ServerPort = 67 5 | ClientPort = 68 6 | ) 7 | -------------------------------------------------------------------------------- /gvisor/pkg/secio/secio_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package secio 4 | -------------------------------------------------------------------------------- /gvisor/pkg/xdp/xdp_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package xdp 4 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/gasket/gasket_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package gasket 4 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/nvgpu/nvgpu_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package nvgpu 4 | -------------------------------------------------------------------------------- /gvisor/pkg/binary/binary_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package binary 4 | -------------------------------------------------------------------------------- /gvisor/pkg/cleanup/cleanup_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package cleanup 4 | -------------------------------------------------------------------------------- /gvisor/pkg/context/context_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package context 4 | -------------------------------------------------------------------------------- /gvisor/pkg/coretag/coretag_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package coretag 4 | -------------------------------------------------------------------------------- /gvisor/pkg/errors/errors_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package errors 4 | -------------------------------------------------------------------------------- /gvisor/pkg/eventfd/eventfd_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package eventfd 4 | -------------------------------------------------------------------------------- /gvisor/pkg/fspath/fspath_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fspath 4 | -------------------------------------------------------------------------------- /gvisor/pkg/fsutil/fsutil_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fsutil 4 | -------------------------------------------------------------------------------- /gvisor/pkg/hostos/hostos_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hostos 4 | -------------------------------------------------------------------------------- /gvisor/pkg/hosttid/hosttid_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hosttid 4 | -------------------------------------------------------------------------------- /gvisor/pkg/marshal/marshal_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package marshal 4 | -------------------------------------------------------------------------------- /gvisor/pkg/rand/rand_linux_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package rand 4 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/ring0_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package ring0 4 | -------------------------------------------------------------------------------- /gvisor/pkg/safemem/safemem_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package safemem 4 | -------------------------------------------------------------------------------- /gvisor/pkg/seccomp/seccomp_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package seccomp 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fpu 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/time_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package time 4 | -------------------------------------------------------------------------------- /gvisor/pkg/unet/unet_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package unet 4 | -------------------------------------------------------------------------------- /gvisor/pkg/usermem/usermem_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package usermem 4 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/errno/errno_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package errno 4 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/nvgpu/nvgpu_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package nvgpu 4 | -------------------------------------------------------------------------------- /gvisor/pkg/buffer/buffer_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package buffer 4 | -------------------------------------------------------------------------------- /gvisor/pkg/control/client/client_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package client 4 | -------------------------------------------------------------------------------- /gvisor/pkg/control/server/server_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package server 4 | -------------------------------------------------------------------------------- /gvisor/pkg/fsutil/fsutil_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fsutil 4 | -------------------------------------------------------------------------------- /gvisor/pkg/metric/metric_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package metric 4 | -------------------------------------------------------------------------------- /gvisor/pkg/safecopy/safecopy_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package safecopy 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package arch 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsimpl/user/user_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package user 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/hostfd/hostfd_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hostfd 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/hostmm/hostmm_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hostmm 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/strace/strace_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package strace 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/time_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package time 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/unimpl/unimpl_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package unimpl 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/vfs/vfs_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package vfs 4 | -------------------------------------------------------------------------------- /gvisor/pkg/state/pretty/pretty_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pretty 4 | -------------------------------------------------------------------------------- /gvisor/pkg/syncevent/syncevent_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package syncevent 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/muxed/muxed_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package muxed 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/pipe/pipe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pipe 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/network/arp/arp_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package arp 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/network/hash/hash_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hash 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/seqnum/seqnum_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package seqnum 4 | -------------------------------------------------------------------------------- /dhcp/.stickler.yml: -------------------------------------------------------------------------------- 1 | --- 2 | linters: 3 | golint: 4 | min_confidence: 0.85 5 | fixers: 6 | enable: true 7 | -------------------------------------------------------------------------------- /gvisor/pkg/compressio/compressio_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package compressio 4 | -------------------------------------------------------------------------------- /gvisor/pkg/coretag/coretag_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package coretag 4 | -------------------------------------------------------------------------------- /gvisor/pkg/errors/linuxerr/linuxerr_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package linuxerr 4 | -------------------------------------------------------------------------------- /gvisor/pkg/eventfd/eventfd_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package eventfd 4 | -------------------------------------------------------------------------------- /gvisor/pkg/flipcall/flipcall_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package flipcall 4 | -------------------------------------------------------------------------------- /gvisor/pkg/hostarch/hostarch_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hostarch 4 | -------------------------------------------------------------------------------- /gvisor/pkg/memutil/memutil_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package memutil 4 | -------------------------------------------------------------------------------- /gvisor/pkg/prometheus/prometheus_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package prometheus 4 | -------------------------------------------------------------------------------- /gvisor/pkg/safecopy/safecopy_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package safecopy 4 | -------------------------------------------------------------------------------- /gvisor/pkg/safemem/safemem_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package safemem 4 | -------------------------------------------------------------------------------- /gvisor/pkg/seccomp/seccomp_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package seccomp 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fpu 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/control/control_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package control 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fdimport/fdimport_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fdimport 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsmetric/fsmetric_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fsmetric 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsutil/fsutil_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package fsutil 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/hostcpu/hostcpu_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hostcpu 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/hostfd/hostfd_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hostfd 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/sched/sched_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package sched 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/platform_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package platform 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/seccheck/seccheck_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package seccheck 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/state/state_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package state 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/syscalls/syscalls_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package syscalls 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/uniqueid/uniqueid_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package uniqueid 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/usage/usage_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package usage 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/watchdog/watchdog_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package watchdog 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/adapters/gonet/gonet_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package gonet 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/checksum/checksum_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package checksum 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/faketime/faketime_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package faketime 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/hash/jenkins/jenkins_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package jenkins 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/header/parse/parse_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package parse 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/nested/nested_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package nested 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/sniffer/sniffer_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package sniffer 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/stack/stack_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package stack 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/transport/tcp/tcp_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package tcp 4 | -------------------------------------------------------------------------------- /gvisor/pkg/usermem/usermem_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package usermem 4 | -------------------------------------------------------------------------------- /gvisor/pkg/eventchannel/eventchannel_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package eventchannel 4 | -------------------------------------------------------------------------------- /gvisor/pkg/marshal/primitive/primitive_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package primitive 4 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/pagetables/pagetables_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pagetables 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/devices/accel/accel_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package accel 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsimpl/gofer/gofer_impl_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package gofer 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsimpl/host/host_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package host 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/pipe/pipe_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pipe 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/pgalloc/pgalloc_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pgalloc 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/ptrace/ptrace_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package ptrace 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/seccheck/sinks/null/null_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package null 4 | -------------------------------------------------------------------------------- /gvisor/pkg/state/statefile/statefile_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package statefile 4 | -------------------------------------------------------------------------------- /gvisor/pkg/syncevent/syncevent_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package syncevent 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/checksum/checksum_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package checksum 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/ethernet/ethernet_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package ethernet 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/loopback/loopback_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package loopback 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/sharedmem/pipe/pipe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pipe 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/sharedmem/queue/queue_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package queue 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/waitable/waitable_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package waitable 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/transport/transport_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package transport 4 | -------------------------------------------------------------------------------- /dhcp/.gitignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | examples/client6/client6 3 | examples/client4/client4 4 | examples/packetcrafting6/packetcrafting6 5 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/memevent/memevent_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package memevent 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sysmsg_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package sysmsg 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/seccheck/seccheck_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package seccheck 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/seccheck/sinks/remote/remote_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package remote 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/seccheck/sinks/remote/wire/wire_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package wire 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/netfilter/netfilter_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package netfilter 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/sharedmem/pipe/pipe_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pipe 4 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/pagetables/pagetables_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package pagetables 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/devices/nvproxy/nvproxy_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package nvproxy 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/interrupt/interrupt_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package interrupt 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/hostinet/hostinet_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package hostinet 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/packetsocket/packetsocket_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package packetsocket 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/sharedmem/sharedmem_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package sharedmem 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsimpl/iouringfs/iouringfs_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package iouringfs 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sysmsg_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package sysmsg 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/usertrap/usertrap_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package usertrap 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/network/internal/multicast/multicast_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package multicast 4 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/transport/tcpconntrack/tcpconntrack_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package tcpconntrack 4 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/unix/transport/transport_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package transport 4 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/abi_linux_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package abi 7 | -------------------------------------------------------------------------------- /gvisor/pkg/rand/rand_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build !linux 4 | // +build !linux 5 | 6 | package rand 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/loader/vdsodata/vdso_amd64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/go-netstack/main/gvisor/pkg/sentry/loader/vdsodata/vdso_amd64.so -------------------------------------------------------------------------------- /gvisor/pkg/sentry/loader/vdsodata/vdso_arm64.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/go-netstack/main/gvisor/pkg/sentry/loader/vdsodata/vdso_arm64.so -------------------------------------------------------------------------------- /gvisor/pkg/memutil/memutil_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package memutil 7 | -------------------------------------------------------------------------------- /gvisor/pkg/syserr/syserr_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build darwin 4 | // +build darwin 5 | 6 | package syserr 7 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/xdp/xdp_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package xdp 7 | -------------------------------------------------------------------------------- /gvisor/pkg/coverage/coverage_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package coverage 7 | -------------------------------------------------------------------------------- /gvisor/pkg/flipcall/flipcall_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package flipcall 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/state/state_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package state 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/time_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package time 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/time_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package time 7 | -------------------------------------------------------------------------------- /gvisor/pkg/syserr/syserr_linux_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package syserr 7 | -------------------------------------------------------------------------------- /tap/connection.go: -------------------------------------------------------------------------------- 1 | package tap 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | type protocolConn struct { 8 | net.Conn 9 | protocolImpl protocol 10 | } 11 | -------------------------------------------------------------------------------- /gvisor/pkg/fdnotifier/fdnotifier_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package fdnotifier 7 | -------------------------------------------------------------------------------- /gvisor/pkg/flipcall/flipcall_linux_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package flipcall 7 | -------------------------------------------------------------------------------- /gvisor/pkg/fsutil/fsutil_amd64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package fsutil 7 | -------------------------------------------------------------------------------- /gvisor/pkg/fsutil/fsutil_arm64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package fsutil 7 | -------------------------------------------------------------------------------- /gvisor/pkg/hostarch/hostarch_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package hostarch 7 | -------------------------------------------------------------------------------- /gvisor/pkg/safecopy/safecopy_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package safecopy 7 | -------------------------------------------------------------------------------- /gvisor/pkg/seccomp/seccomp_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package seccomp 7 | -------------------------------------------------------------------------------- /gvisor/pkg/seccomp/seccomp_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package seccomp 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package fpu 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/hostfd/hostfd_linux_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package hostfd 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package kernel 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package kernel 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/strace/strace_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package strace 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/strace/strace_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package strace 7 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/stopfd/stopfd_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package stopfd 7 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/tun/tun_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package tun 7 | -------------------------------------------------------------------------------- /gvisor/pkg/memutil/memutil_linux_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package memutil 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sighandling/sighandling_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build darwin 4 | // +build darwin 5 | 6 | package sighandling 7 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/rawfile/rawfile_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package rawfile 7 | -------------------------------------------------------------------------------- /gvisor/pkg/fdnotifier/fdnotifier_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package fdnotifier 7 | -------------------------------------------------------------------------------- /gvisor/pkg/hostarch/hostarch_x86_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 || 386 4 | // +build amd64 386 5 | 6 | package hostarch 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package arch 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 || i386 4 | // +build amd64 i386 5 | 6 | package fpu 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/platform_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package platform 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/platform_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package platform 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/ptrace/ptrace_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package ptrace 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/ptrace/ptrace_linux_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package ptrace 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_race_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build race 4 | // +build race 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/seccheck/seccheck_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package seccheck 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/seccheck/seccheck_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package seccheck 7 | -------------------------------------------------------------------------------- /gvisor/pkg/atomicbitops/atomicbitops_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package atomicbitops 7 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/pagetables/pagetables_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package pagetables 7 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/pagetables/pagetables_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package pagetables 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package fpu 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/loader/loader_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package loader 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/ptrace/ptrace_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.18 4 | // +build go1.18 5 | 6 | package ptrace 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_linux_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_norace_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build !race 4 | // +build !race 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.18 4 | // +build go1.18 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/hostinet/hostinet_impl_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package hostinet 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sighandling/sighandling_linux_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux 4 | // +build linux 5 | 6 | package sighandling 7 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/nvgpu/nvgpu_unsafe_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package nvgpu 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/safecopy/safecopy_amd64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 || i386 4 | // +build amd64 i386 5 | 6 | package safecopy 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_unsafe_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package arch 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_amd64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 || i386 4 | // +build amd64 i386 5 | 6 | package fpu 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_unsafe_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package fpu 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/ptrace/ptrace_arm64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package ptrace 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sysmsg_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package sysmsg 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sysmsg_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package sysmsg 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_arm64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/vfs/vfs_testonly_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build check_invariants 4 | // +build check_invariants 5 | 6 | package vfs 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/auth/auth_unsafe_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package auth 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_unsafe_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package kernel 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/ptrace/ptrace_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 && amd64 4 | // +build amd64,amd64 5 | 6 | package ptrace 7 | -------------------------------------------------------------------------------- /virtualnetwork/deprecated.go: -------------------------------------------------------------------------------- 1 | package virtualnetwork 2 | 3 | import "github.com/progrium/go-netstack/vnet" 4 | 5 | type VirtualNetwork = vnet.VirtualNetwork 6 | 7 | var New = vnet.New 8 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/pagetables/pagetables_aarch64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && arm64 4 | // +build arm64,arm64 5 | 6 | package pagetables 7 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/ring0_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && (386 || amd64) 4 | // +build arm64 5 | // +build 386 amd64 6 | 7 | package ring0 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/kvm_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 && amd64 && amd64 4 | // +build amd64,amd64,amd64 5 | 6 | package kvm 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sighandler.built-in.amd64.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/go-netstack/main/gvisor/pkg/sentry/platform/systrap/sysmsg/sighandler.built-in.amd64.bin -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sighandler.built-in.arm64.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/progrium/go-netstack/main/gvisor/pkg/sentry/platform/systrap/sysmsg/sighandler.built-in.arm64.bin -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/usertrap/usertrap_amd64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package usertrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/ring0_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 && amd64 && amd64 && amd64 4 | // +build amd64,amd64,amd64,amd64 5 | 6 | package ring0 7 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/ring0_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && arm64 && arm64 && arm64 4 | // +build arm64,arm64,arm64,arm64 5 | 6 | package ring0 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_linux_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 || linux 4 | // +build amd64 linux 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/kvm_amd64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 && amd64 && amd64 4 | // +build amd64,amd64,amd64 5 | 6 | package kvm 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/kvm_arm64_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && arm64 && arm64 4 | // +build arm64,arm64,arm64 5 | 6 | package kvm 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/usertrap/usertrap_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | package usertrap 4 | 5 | import ( 6 | ) 7 | 8 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/syscalls/linux/linux_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 && amd64 && amd64 4 | // +build amd64,amd64,amd64 5 | 6 | package linux 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/syscalls/linux/linux_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && arm64 && arm64 4 | // +build arm64,arm64,arm64 5 | 6 | package linux 7 | -------------------------------------------------------------------------------- /gvisor/README.md: -------------------------------------------------------------------------------- 1 | # gVisor 2 | 3 | This branch is a synthetic branch, containing only Go sources, that is 4 | compatible with standard Go tools. See the master branch for authoritative 5 | sources and tests. 6 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/kvm_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && arm64 && arm64 && arm64 4 | // +build arm64,arm64,arm64,arm64 5 | 6 | package kvm 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/kvm_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build kvm_profiling && !kvm_profiling 4 | // +build kvm_profiling,!kvm_profiling 5 | 6 | package kvm 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 && amd64 && amd64 4 | // +build amd64,amd64,amd64 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && arm64 && arm64 4 | // +build arm64,arm64,arm64 5 | 6 | package systrap 7 | -------------------------------------------------------------------------------- /gvisor/pkg/metric/metric_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build sentry_profiling && !sentry_profiling 4 | // +build sentry_profiling,!sentry_profiling 5 | 6 | package metric 7 | -------------------------------------------------------------------------------- /gvisor/pkg/bits/bits_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build (amd64 || arm64) && !amd64 && !arm64 4 | // +build amd64 arm64 5 | // +build !amd64 6 | // +build !arm64 7 | 8 | package bits 9 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/ptrace/ptrace_linux_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux && (amd64 || arm64) 4 | // +build linux 5 | // +build amd64 arm64 6 | 7 | package ptrace 8 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/option_message_type.go: -------------------------------------------------------------------------------- 1 | package dhcpv4 2 | 3 | // OptMessageType returns a new DHCPv4 Message Type option. 4 | func OptMessageType(m MessageType) Option { 5 | return Option{Code: OptionDHCPMessageType, Value: m} 6 | } 7 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/pagetables/pagetables_x86_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build (386 || amd64) && (i386 || amd64) 4 | // +build 386 amd64 5 | // +build i386 amd64 6 | 7 | package pagetables 8 | -------------------------------------------------------------------------------- /dhcp/interfaces/bindtodevice_linux.go: -------------------------------------------------------------------------------- 1 | // +build linux 2 | 3 | package interfaces 4 | 5 | import "golang.org/x/sys/unix" 6 | 7 | func BindToInterface(fd int, ifname string) error { 8 | return unix.BindToDevice(fd, ifname) 9 | } 10 | -------------------------------------------------------------------------------- /dhcp/interfaces/bindtodevice_windows.go: -------------------------------------------------------------------------------- 1 | package interfaces 2 | 3 | import "errors" 4 | 5 | // BindToInterface fails on Windows. 6 | func BindToInterface(fd int, ifname string) error { 7 | return errors.New("not implemented on Windows") 8 | } 9 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/sharedmem/sharedmem_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux && linux && linux && linux && linux && linux 4 | // +build linux,linux,linux,linux,linux,linux 5 | 6 | package sharedmem 7 | -------------------------------------------------------------------------------- /dhcp/interfaces/bindtodevice_js.go: -------------------------------------------------------------------------------- 1 | //go:build js 2 | // +build js 3 | 4 | package interfaces 5 | 6 | import "golang.org/x/sys/unix" 7 | 8 | func BindToInterface(fd int, ifname string) error { 9 | return unix.BindToDevice(fd, ifname) 10 | } 11 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/fdbased/fdbased_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux && ((linux && amd64) || (linux && arm64)) 4 | // +build linux 5 | // +build linux,amd64 linux,arm64 6 | 7 | package fdbased 8 | -------------------------------------------------------------------------------- /uio/ubinary/doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package ubinary provides a native endian binary.ByteOrder. 6 | package ubinary 7 | -------------------------------------------------------------------------------- /gvisor/pkg/fdchannel/fdchannel_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris 4 | // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris 5 | 6 | package fdchannel 7 | -------------------------------------------------------------------------------- /gvisor/pkg/hostarch/hostarch.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // Package hostarch contains host arch address operations for user memory. 7 | package hostarch 8 | -------------------------------------------------------------------------------- /vnet/qemu.go: -------------------------------------------------------------------------------- 1 | package vnet 2 | 3 | import ( 4 | "context" 5 | "net" 6 | 7 | "github.com/progrium/go-netstack/types" 8 | ) 9 | 10 | func (n *VirtualNetwork) AcceptQemu(ctx context.Context, conn net.Conn) error { 11 | return n.networkSwitch.Accept(ctx, conn, types.QemuProtocol) 12 | } 13 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/sync.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // Package sync provides synchronization primitives. 7 | // 8 | // +checkalignedignore 9 | package sync 10 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/bindtointerface.go: -------------------------------------------------------------------------------- 1 | package dhcpv4 2 | 3 | import ( 4 | "github.com/progrium/go-netstack/dhcp/interfaces" 5 | ) 6 | 7 | // BindToInterface (deprecated) redirects to interfaces.BindToInterface 8 | func BindToInterface(fd int, ifname string) error { 9 | return interfaces.BindToInterface(fd, ifname) 10 | } 11 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/bsdp/vendor_class_identifier.go: -------------------------------------------------------------------------------- 1 | // +build !darwin 2 | 3 | package bsdp 4 | 5 | // MakeVendorClassIdentifier returns a static vendor class identifier for BSDP 6 | // use on non-darwin hosts. 7 | func MakeVendorClassIdentifier() (string, error) { 8 | return DefaultMacOSVendorClassIdentifier, nil 9 | } 10 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/server4/conn_windows.go: -------------------------------------------------------------------------------- 1 | package server4 2 | 3 | import ( 4 | "errors" 5 | "net" 6 | ) 7 | 8 | // NewIPv4UDPConn fails on Windows. Use WithConn() to pass the connection. 9 | func NewIPv4UDPConn(iface string, addr *net.UDPAddr) (*net.UDPConn, error) { 10 | return nil, errors.New("not implemented on Windows") 11 | } 12 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/fdbased/fdbased_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux && ((linux && amd64) || (linux && arm64)) && (!linux || (!amd64 && !arm64)) && linux 4 | // +build linux 5 | // +build linux,amd64 linux,arm64 6 | // +build !linux !amd64,!arm64 7 | // +build linux 8 | 9 | package fdbased 10 | -------------------------------------------------------------------------------- /uio/rand/random_unix.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build aix darwin dragonfly freebsd nacl netbsd openbsd solaris 6 | 7 | package rand 8 | 9 | var defaultContextReader = &urandomReader{} 10 | -------------------------------------------------------------------------------- /uio/.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | # vendor/ 16 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/bsdp/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | The BSDP package implements Apple's Boot Service Discovery Protocol (a 3 | pxe-boot-like netboot protocol for booting macOS hardware from 4 | network-connected servers). 5 | 6 | The Canonical implementation is defined here: 7 | http://opensource.apple.com/source/bootp/bootp-198.1/Documentation/BSDP.doc 8 | */ 9 | 10 | package bsdp 11 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/rawfile/rawfile_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build linux && !amd64 && !arm64 && ((linux && amd64) || (linux && arm64)) && go1.18 && linux 4 | // +build linux 5 | // +build !amd64 6 | // +build !arm64 7 | // +build linux,amd64 linux,arm64 8 | // +build go1.18 9 | // +build linux 10 | 11 | package rawfile 12 | -------------------------------------------------------------------------------- /gvisor/pkg/xdp/xdp_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build (amd64 || arm64) && (amd64 || arm64) && (amd64 || arm64) && (amd64 || arm64) && (amd64 || arm64) && (amd64 || arm64) 4 | // +build amd64 arm64 5 | // +build amd64 arm64 6 | // +build amd64 arm64 7 | // +build amd64 arm64 8 | // +build amd64 arm64 9 | // +build amd64 arm64 10 | 11 | package xdp 12 | -------------------------------------------------------------------------------- /gvisor/AUTHORS: -------------------------------------------------------------------------------- 1 | # This is the list of gVisor authors for copyright purposes. 2 | # 3 | # This does not necessarily list everyone who has contributed code, since in 4 | # some cases, their employer may be the copyright holder. To see the full list 5 | # of contributors, see the revision history in source control. 6 | # 7 | # Please send a patch if you would like to be included in this list. 8 | Google LLC 9 | -------------------------------------------------------------------------------- /uio/uio/uio.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package uio unifies commonly used io utilities for u-root. 6 | // 7 | // uio's most used feature is the Buffer/Lexer combination to parse binary data 8 | // of arbitrary endianness into data structures. 9 | package uio 10 | -------------------------------------------------------------------------------- /uio/ubinary/big_endian.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // +build mips mips64 ppc64 s390x 6 | 7 | package ubinary 8 | 9 | import ( 10 | "encoding/binary" 11 | ) 12 | 13 | // NativeEndian is $GOARCH's implementation of byte order. 14 | var NativeEndian = binary.BigEndian 15 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/checklocks_off_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | //go:build !checklocks 7 | // +build !checklocks 8 | 9 | package sync 10 | 11 | import ( 12 | "unsafe" 13 | ) 14 | 15 | func noteLock(l unsafe.Pointer) { 16 | } 17 | 18 | func noteUnlock(l unsafe.Pointer) { 19 | } 20 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/runtime_other.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | //go:build !amd64 7 | // +build !amd64 8 | 9 | package sync 10 | 11 | const supportsWakeSuppression = false 12 | 13 | func preGoReadyWakeSuppression() {} // Never called. 14 | func postGoReadyWakeSuppression() {} // Never called. 15 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/goyield_go113_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | //go:build go1.13 && !go1.14 7 | // +build go1.13,!go1.14 8 | 9 | package sync 10 | 11 | import ( 12 | "runtime" 13 | ) 14 | 15 | func goyield() { 16 | // goyield is not available until Go 1.14. 17 | runtime.Gosched() 18 | } 19 | -------------------------------------------------------------------------------- /dhcp/interfaces/bindtodevice_darwin.go: -------------------------------------------------------------------------------- 1 | // +build darwin 2 | 3 | package interfaces 4 | 5 | import ( 6 | "net" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | // BindToInterface emulates linux's SO_BINDTODEVICE option for a socket by using 12 | // IP_BOUND_IF. 13 | func BindToInterface(fd int, ifname string) error { 14 | iface, err := net.InterfaceByName(ifname) 15 | if err != nil { 16 | return err 17 | } 18 | return unix.SetsockoptInt(fd, unix.IPPROTO_IP, unix.IP_BOUND_IF, iface.Index) 19 | } 20 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/bsdp/vendor_class_identifier_darwin.go: -------------------------------------------------------------------------------- 1 | package bsdp 2 | 3 | import ( 4 | "fmt" 5 | 6 | "golang.org/x/sys/unix" 7 | ) 8 | 9 | // MakeVendorClassIdentifier calls the sysctl syscall on macOS to get the 10 | // platform model. 11 | func MakeVendorClassIdentifier() (string, error) { 12 | // Fetch hardware model for class ID. 13 | hwModel, err := unix.Sysctl("hw.model") 14 | if err != nil { 15 | return "", err 16 | } 17 | return fmt.Sprintf("%s/i386/%s", AppleVendorID, hwModel), nil 18 | } 19 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/runtime_go121_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | //go:build go1.21 7 | 8 | package sync 9 | 10 | import ( 11 | "unsafe" 12 | ) 13 | 14 | // Use checkoffset to assert that maptype.hasher (the only field we use) has 15 | // the correct offset. 16 | const maptypeHasherOffset = unsafe.Offsetof(maptype{}.Hasher) // +checkoffset internal/abi MapType.Hasher 17 | -------------------------------------------------------------------------------- /dhcp/interfaces/bindtodevice_bsd.go: -------------------------------------------------------------------------------- 1 | // +build aix freebsd openbsd netbsd 2 | 3 | package interfaces 4 | 5 | import ( 6 | "net" 7 | 8 | "golang.org/x/sys/unix" 9 | ) 10 | 11 | // BindToInterface emulates linux's SO_BINDTODEVICE option for a socket by using 12 | // IP_RECVIF. 13 | func BindToInterface(fd int, ifname string) error { 14 | iface, err := net.InterfaceByName(ifname) 15 | if err != nil { 16 | return err 17 | } 18 | return unix.SetsockoptInt(fd, unix.IPPROTO_IP, unix.IP_RECVIF, iface.Index) 19 | } 20 | -------------------------------------------------------------------------------- /dhcp/CONTRIBUTORS.md: -------------------------------------------------------------------------------- 1 | ## Contributors 2 | 3 | * Andrea Barberio (main author) 4 | * Pablo Mazzini (tons of fixes and new options) 5 | * Sean Karlage (BSDP package, and of tons of improvements to the DHCPv4 package) 6 | * Owen Mooney (several option fixes and modifiers) 7 | * Mikolaj Walczak (asynchronous DHCPv6 client) 8 | * Chris Koch (tons of improvements in DHCPv4 and DHCPv6 internals and interface) 9 | * Akshay Navale, Brandon Bennett and Chris Gorham (ZTPv6 and ZTPv4 packages) 10 | * Anatole Denis (tons of fixes and new options) 11 | -------------------------------------------------------------------------------- /uio/ubinary/little_endian.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build 386 || amd64 || arm || arm64 || mipsle || mips64le || ppc64le || riscv || riscv64 || wasm 6 | // +build 386 amd64 arm arm64 mipsle mips64le ppc64le riscv riscv64 wasm 7 | 8 | package ubinary 9 | 10 | import ( 11 | "encoding/binary" 12 | ) 13 | 14 | // NativeEndian is $GOARCH's implementation of byte order. 15 | var NativeEndian = binary.LittleEndian 16 | -------------------------------------------------------------------------------- /types/handshake.go: -------------------------------------------------------------------------------- 1 | package types 2 | 3 | type TransportProtocol string 4 | 5 | const ( 6 | UDP TransportProtocol = "udp" 7 | TCP TransportProtocol = "tcp" 8 | UNIX TransportProtocol = "unix" 9 | NPIPE TransportProtocol = "npipe" 10 | ) 11 | 12 | type ExposeRequest struct { 13 | Local string `json:"local"` 14 | Remote string `json:"remote"` 15 | Protocol TransportProtocol `json:"protocol"` 16 | } 17 | 18 | type UnexposeRequest struct { 19 | Local string `json:"local"` 20 | Protocol TransportProtocol `json:"protocol"` 21 | } 22 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/runtime_not_go121_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // runtime.maptype is moved to internal/abi.MapType in Go 1.21. 7 | // 8 | //go:build !go1.21 9 | 10 | package sync 11 | 12 | import ( 13 | "unsafe" 14 | ) 15 | 16 | // Use checkoffset to assert that maptype.hasher (the only field we use) has 17 | // the correct offset. 18 | const maptypeHasherOffset = unsafe.Offsetof(maptype{}.Hasher) // +checkoffset runtime maptype.hasher 19 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_aarch64_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build arm64 10 | // +build arm64 11 | 12 | package arch 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_arm64_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build arm64 10 | // +build arm64 11 | 12 | package fpu 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_amd64_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build amd64 10 | // +build amd64 11 | 12 | package kernel 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_arm64_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build arm64 10 | // +build arm64 11 | 12 | package kernel 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_impl_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build go1.1 10 | // +build go1.1 11 | 12 | package kernel 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_opts_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build go1.1 10 | // +build go1.1 11 | 12 | package kernel 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/fpu/fpu_amd64_unsafe_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build amd64 || i386 10 | // +build amd64 i386 11 | 12 | package fpu 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/goyield_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | //go:build go1.14 7 | // +build go1.14 8 | 9 | // //go:linkname directives type-checked by checklinkname. Any other 10 | // non-linkname assumptions outside the Go 1 compatibility guarantee should 11 | // have an accompanied vet check or version guard build tag. 12 | 13 | package sync 14 | 15 | import ( 16 | _ "unsafe" // for go:linkname 17 | ) 18 | 19 | //go:linkname goyield runtime.goyield 20 | func goyield() 21 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/usertrap/usertrap_arm64_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build arm64 10 | // +build arm64 11 | 12 | package usertrap 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/usertrap/usertrap_amd64_unsafe_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build amd64 10 | // +build amd64 11 | 12 | package usertrap 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/syscalls/linux/linux_amd64_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build amd64 && amd64 && amd64 10 | // +build amd64,amd64,amd64 11 | 12 | package linux 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/syscalls/linux/linux_arm64_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build arm64 && arm64 && arm64 10 | // +build arm64,arm64,arm64 11 | 12 | package linux 13 | 14 | import ( 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_x86_impl_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build (amd64 || 386) && go1.1 10 | // +build amd64 386 11 | // +build go1.1 12 | 13 | package arch 14 | 15 | import ( 16 | ) 17 | 18 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_x86_abi_autogen_unsafe.go: -------------------------------------------------------------------------------- 1 | // Automatically generated marshal implementation. See tools/go_marshal. 2 | 3 | // If there are issues with build constraint aggregation, see 4 | // tools/go_marshal/gomarshal/generator.go:writeHeader(). The constraints here 5 | // come from the input set of files used to generate this file. This input set 6 | // is filtered based on pre-defined file suffixes related to build constraints, 7 | // see tools/defs.bzl:calculate_sets(). 8 | 9 | //go:build (amd64 || 386) && (amd64 || 386) 10 | // +build amd64 386 11 | // +build amd64 386 12 | 13 | package arch 14 | 15 | import ( 16 | ) 17 | 18 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/runtime_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | //go:build amd64 7 | 8 | package sync 9 | 10 | import ( 11 | "sync/atomic" 12 | ) 13 | 14 | const supportsWakeSuppression = true 15 | 16 | // addrOfSpinning returns the address of runtime.sched.nmspinning. 17 | func addrOfSpinning() *int32 18 | 19 | // nmspinning caches addrOfSpinning. 20 | var nmspinning = addrOfSpinning() 21 | 22 | //go:nosplit 23 | func preGoReadyWakeSuppression() { 24 | atomic.AddInt32(nmspinning, 1) 25 | } 26 | 27 | //go:nosplit 28 | func postGoReadyWakeSuppression() { 29 | atomic.AddInt32(nmspinning, -1) 30 | } 31 | -------------------------------------------------------------------------------- /dhcp/iana/entid.go: -------------------------------------------------------------------------------- 1 | package iana 2 | 3 | // EnterpriseID represents the Enterprise IDs as set by IANA 4 | type EnterpriseID int 5 | 6 | // See https://www.iana.org/assignments/enterprise-numbers/enterprise-numbers for values 7 | const ( 8 | EnterpriseIDCiscoSystems EnterpriseID = 9 9 | EnterpriseIDCienaCorporation EnterpriseID = 1271 10 | ) 11 | 12 | var enterpriseIDToStringMap = map[EnterpriseID]string{ 13 | EnterpriseIDCiscoSystems: "Cisco Systems", 14 | EnterpriseIDCienaCorporation: "Ciena Corporation", 15 | } 16 | 17 | // String returns the vendor name for a given Enterprise ID 18 | func (e EnterpriseID) String() string { 19 | if vendor := enterpriseIDToStringMap[e]; vendor != "" { 20 | return vendor 21 | } 22 | return "Unknown" 23 | } 24 | -------------------------------------------------------------------------------- /gvisor/pkg/safemem/safemem.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | // Package safemem provides the Block and BlockSeq types. 16 | package safemem 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/sched/sched.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | // Package sched implements scheduler related features. 16 | package sched 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/physical_map_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | package kvm 16 | 17 | const ( 18 | reservedMemory = 0 19 | ) 20 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/usage/usage.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | // Package usage provides representations of resource usage. 16 | package usage 17 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/transport/transport.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | // Package transport supports transport protocols. 16 | package transport 17 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/loader/vdsodata/vdsodata.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | // Package vdsodata contains a compiled VDSO object. 16 | package vdsodata 17 | -------------------------------------------------------------------------------- /uio/cross-compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | GO="go" 6 | if [ -v GOROOT ]; 7 | then 8 | GO="$GOROOT/bin/go" 9 | fi 10 | 11 | function buildem() { 12 | for GOOS in $1 13 | do 14 | for GOARCH in $2 15 | do 16 | echo "Building $GOOS/$GOARCH..." 17 | GOOS=$GOOS GOARCH=$GOARCH $GO build ./... 18 | done 19 | done 20 | } 21 | 22 | GOARCHES="386 amd64 arm arm64 ppc64 ppc64le s390x mips mipsle mips64 mips64le" 23 | buildem "linux" "$GOARCHES" 24 | 25 | GOARCHES_BSD="386 amd64 arm arm64" 26 | GOOSES_BSD="freebsd netbsd openbsd" 27 | buildem "$GOOSES_BSD" "$GOARCHES_BSD" 28 | 29 | GOOSES_AMD64="solaris windows" 30 | buildem "$GOOSES_AMD64" "amd64" 31 | 32 | GOARCHES_DARWIN="arm64 amd64" 33 | buildem "darwin" "$GOARCHES_DARWIN" 34 | -------------------------------------------------------------------------------- /gvisor/pkg/state/state_race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build race 16 | // +build race 17 | 18 | package state 19 | 20 | var raceEnabled = true 21 | -------------------------------------------------------------------------------- /gvisor/pkg/state/state_norace.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build !race 16 | // +build !race 17 | 18 | package state 19 | 20 | var raceEnabled = false 21 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/exec.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // TASK_COMM_LEN is the task command name length. 18 | const TASK_COMM_LEN = 16 19 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/devices/ttydev/ttydev_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package ttydev 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (t *ttyDevice) StateTypeName() string { 10 | return "pkg/sentry/devices/ttydev.ttyDevice" 11 | } 12 | 13 | func (t *ttyDevice) StateFields() []string { 14 | return []string{} 15 | } 16 | 17 | func (t *ttyDevice) beforeSave() {} 18 | 19 | // +checklocksignore 20 | func (t *ttyDevice) StateSave(stateSinkObject state.Sink) { 21 | t.beforeSave() 22 | } 23 | 24 | func (t *ttyDevice) afterLoad() {} 25 | 26 | // +checklocksignore 27 | func (t *ttyDevice) StateLoad(stateSourceObject state.Source) { 28 | } 29 | 30 | func init() { 31 | state.Register((*ttyDevice)(nil)) 32 | } 33 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/netlink/route/route_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package route 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (p *Protocol) StateTypeName() string { 10 | return "pkg/sentry/socket/netlink/route.Protocol" 11 | } 12 | 13 | func (p *Protocol) StateFields() []string { 14 | return []string{} 15 | } 16 | 17 | func (p *Protocol) beforeSave() {} 18 | 19 | // +checklocksignore 20 | func (p *Protocol) StateSave(stateSinkObject state.Sink) { 21 | p.beforeSave() 22 | } 23 | 24 | func (p *Protocol) afterLoad() {} 25 | 26 | // +checklocksignore 27 | func (p *Protocol) StateLoad(stateSourceObject state.Source) { 28 | } 29 | 30 | func init() { 31 | state.Register((*Protocol)(nil)) 32 | } 33 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | GVISOR_COMMIT=2691a8f9b1cf25d597905854569bae0a910c9964 3 | 4 | gvisor: 5 | git clone --depth 1 https://github.com/google/gvisor 6 | cd gvisor && git fetch --depth 1 origin $(GVISOR_COMMIT) 7 | cd gvisor && git checkout $(GVISOR_COMMIT) 8 | rm -rf ./gvisor/.git 9 | 10 | UIO_COMMIT=82958018845cfb6b02c09e57c390e67c1d81ee95 11 | 12 | uio: 13 | git clone --depth 1 https://github.com/u-root/uio 14 | cd uio && git fetch --depth 1 origin $(UIO_COMMIT) 15 | cd uio && git checkout $(UIO_COMMIT) 16 | rm -rf ./uio/.git 17 | 18 | DHCP_COMMIT=1ca156eafb9f20f7884eddc2cf610bade5dfb560 19 | 20 | dhcp: 21 | git clone --depth 1 https://github.com/insomniacslk/dhcp 22 | cd dhcp && git fetch --depth 1 origin $(DHCP_COMMIT) 23 | cd dhcp && git checkout $(DHCP_COMMIT) 24 | rm -rf ./dhcp/.git -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/netlink/uevent/uevent_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package uevent 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (p *Protocol) StateTypeName() string { 10 | return "pkg/sentry/socket/netlink/uevent.Protocol" 11 | } 12 | 13 | func (p *Protocol) StateFields() []string { 14 | return []string{} 15 | } 16 | 17 | func (p *Protocol) beforeSave() {} 18 | 19 | // +checklocksignore 20 | func (p *Protocol) StateSave(stateSinkObject state.Sink) { 21 | p.beforeSave() 22 | } 23 | 24 | func (p *Protocol) afterLoad() {} 25 | 26 | // +checklocksignore 27 | func (p *Protocol) StateLoad(stateSourceObject state.Source) { 28 | } 29 | 30 | func init() { 31 | state.Register((*Protocol)(nil)) 32 | } 33 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/abi_linux.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build linux 16 | // +build linux 17 | 18 | package abi 19 | 20 | // Host specifies the host ABI. 21 | const Host = Linux 22 | -------------------------------------------------------------------------------- /gvisor/pkg/safecopy/safecopy_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package safecopy 19 | 20 | func initializeArchAddresses() { 21 | } 22 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/runtime.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | package sync 16 | 17 | import ( 18 | "runtime" 19 | ) 20 | 21 | // Dummy reference for facts. 22 | const _ = runtime.Compiler 23 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/uio.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // UIO_MAXIOV is the maximum number of struct iovecs in a struct iovec array. 18 | const UIO_MAXIOV = 1024 19 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/lib_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The gVisor Authors. 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 | // http://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 | 15 | #include "funcdata.h" 16 | #include "textflag.h" 17 | 18 | TEXT ·spinloop(SB),NOSPLIT,$0 19 | YIELD 20 | RET 21 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsutil/fsutil.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | // Package fsutil provides utilities for implementing vfs.FileDescriptionImpl 16 | // and vfs.FilesystemImpl. 17 | package fsutil 18 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/lib_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The gVisor Authors. 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 | // http://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 | 15 | #include "funcdata.h" 16 | #include "textflag.h" 17 | 18 | TEXT ·spinloop(SB),NOSPLIT|NOFRAME,$0 19 | PAUSE 20 | RET 21 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/hostinet/hostinet.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | // Package hostinet implements AF_INET and AF_INET6 sockets using the host's 16 | // network stack. 17 | package hostinet 18 | -------------------------------------------------------------------------------- /gvisor/pkg/fsutil/fsutil.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The gVisor Authors. 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 | // http://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 | 15 | // Package fsutil contains filesystem utilities that can be shared between the 16 | // sentry and other sandbox components. 17 | package fsutil 18 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/vdso.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package time 16 | 17 | import ( 18 | "golang.org/x/sys/unix" 19 | ) 20 | 21 | func vdsoClockGettime(clockid ClockID, ts *unix.Timespec) int 22 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/transport/tcp/segment_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | package tcp 16 | 17 | import ( 18 | "unsafe" 19 | ) 20 | 21 | const ( 22 | segSize = int(unsafe.Sizeof(segment{})) 23 | ) 24 | -------------------------------------------------------------------------------- /uio/rand/random_std.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | //go:build plan9 || windows || js 6 | // +build plan9 windows js 7 | 8 | package rand 9 | 10 | import ( 11 | "context" 12 | "crypto/rand" 13 | ) 14 | 15 | var defaultContextReader = &cryptoRandReader{} 16 | 17 | type cryptoRandReader struct{} 18 | 19 | // ReadContext implements a cancelable read. 20 | func (r *cryptoRandReader) ReadContext(ctx context.Context, b []byte) (n int, err error) { 21 | ch := make(chan struct{}) 22 | go func() { 23 | n, err = rand.Reader.Read(b) 24 | close(ch) 25 | }() 26 | select { 27 | case <-ctx.Done(): 28 | return 0, ctx.Err() 29 | case <-ch: 30 | return n, err 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/option_generic.go: -------------------------------------------------------------------------------- 1 | package dhcpv4 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | // OptionGeneric is an option that only contains the option code and associated 8 | // data. Every option that does not have a specific implementation will fall 9 | // back to this option. 10 | type OptionGeneric struct { 11 | Data []byte 12 | } 13 | 14 | // ToBytes returns a serialized generic option as a slice of bytes. 15 | func (o OptionGeneric) ToBytes() []byte { 16 | return o.Data 17 | } 18 | 19 | // String returns a human-readable representation of a generic option. 20 | func (o OptionGeneric) String() string { 21 | return fmt.Sprintf("%v", o.Data) 22 | } 23 | 24 | // OptGeneric returns a generic option. 25 | func OptGeneric(code OptionCode, value []byte) Option { 26 | return Option{Code: code, Value: OptionGeneric{value}} 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/kvm_const_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | package kvm 16 | 17 | // KVM ioctls for amd64. 18 | const ( 19 | _KVM_VCPU_TSC_CTRL = 0x0 20 | _KVM_VCPU_TSC_OFFSET = 0x0 21 | ) 22 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/fence.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | package sync 16 | 17 | // MemoryFenceReads ensures that all preceding memory loads happen before 18 | // following memory loads. 19 | func MemoryFenceReads() 20 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/header/datagram.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The gVisor Authors. 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 | // http://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 | 15 | package header 16 | 17 | // DatagramMaximumSize is the maximum supported size of a single datagram. 18 | const DatagramMaximumSize = 0xffff // 65KB. 19 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/stack/stack_global_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package stack 16 | 17 | // StackFromEnv is the global stack created in restore run. 18 | // FIXME(b/36201077) 19 | var StackFromEnv *Stack 20 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/usertrap/usertrap_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 4 | // +build arm64 5 | 6 | package usertrap 7 | 8 | import ( 9 | "github.com/progrium/go-netstack/gvisor/pkg/state" 10 | ) 11 | 12 | func (s *State) StateTypeName() string { 13 | return "pkg/sentry/platform/systrap/usertrap.State" 14 | } 15 | 16 | func (s *State) StateFields() []string { 17 | return []string{} 18 | } 19 | 20 | func (s *State) beforeSave() {} 21 | 22 | // +checklocksignore 23 | func (s *State) StateSave(stateSinkObject state.Sink) { 24 | s.beforeSave() 25 | } 26 | 27 | func (s *State) afterLoad() {} 28 | 29 | // +checklocksignore 30 | func (s *State) StateLoad(stateSourceObject state.Source) { 31 | } 32 | 33 | func init() { 34 | state.Register((*State)(nil)) 35 | } 36 | -------------------------------------------------------------------------------- /uio/ulog/ulogtest/log.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | // Package ulogtest implement the Logger interface via a test's testing.TB.Logf. 6 | package ulogtest 7 | 8 | import ( 9 | "testing" 10 | ) 11 | 12 | // Logger is a Logger implementation that logs to testing.TB.Logf. 13 | type Logger struct { 14 | TB testing.TB 15 | } 16 | 17 | // Printf formats according to the format specifier and prints to a unit test's log. 18 | func (tl Logger) Printf(format string, v ...interface{}) { 19 | tl.TB.Logf(format, v...) 20 | } 21 | 22 | // Print formats according the default formats for v and prints to a unit test's log. 23 | func (tl Logger) Print(v ...interface{}) { 24 | tl.TB.Log(v...) 25 | } 26 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_opts_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package kernel 7 | 8 | import ( 9 | "github.com/progrium/go-netstack/gvisor/pkg/state" 10 | ) 11 | 12 | func (s *SpecialOpts) StateTypeName() string { 13 | return "pkg/sentry/kernel.SpecialOpts" 14 | } 15 | 16 | func (s *SpecialOpts) StateFields() []string { 17 | return []string{} 18 | } 19 | 20 | func (s *SpecialOpts) beforeSave() {} 21 | 22 | // +checklocksignore 23 | func (s *SpecialOpts) StateSave(stateSinkObject state.Sink) { 24 | s.beforeSave() 25 | } 26 | 27 | func (s *SpecialOpts) afterLoad() {} 28 | 29 | // +checklocksignore 30 | func (s *SpecialOpts) StateLoad(stateSourceObject state.Source) { 31 | } 32 | 33 | func init() { 34 | state.Register((*SpecialOpts)(nil)) 35 | } 36 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/eventfd.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // Constants for eventfd2(2). 18 | const ( 19 | EFD_SEMAPHORE = 0x1 20 | EFD_CLOEXEC = O_CLOEXEC 21 | EFD_NONBLOCK = O_NONBLOCK 22 | ) 23 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/mm/aio_context_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package mm 16 | 17 | // afterLoad is invoked by stateify. 18 | func (ctx *AIOContext) afterLoad() { 19 | ctx.requestReady = make(chan struct{}, 1) 20 | } 21 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/pagetables/pcids_x86.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build i386 || amd64 16 | // +build i386 amd64 17 | 18 | package pagetables 19 | 20 | // limitPCID is the maximum value of valid PCIDs. 21 | const limitPCID = 4095 22 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/control/control.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | // Package control contains types that expose control server methods, and can 16 | // be used to configure and interact with a running sandbox process. 17 | package control 18 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsutil/host_file_mapper_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package fsutil 16 | 17 | // afterLoad is invoked by stateify. 18 | func (f *HostFileMapper) afterLoad() { 19 | f.mappings = make(map[uint64]mapping) 20 | } 21 | -------------------------------------------------------------------------------- /dhcp/dhcpv4/option_misc.go: -------------------------------------------------------------------------------- 1 | package dhcpv4 2 | 3 | import ( 4 | "github.com/progrium/go-netstack/dhcp/iana" 5 | "github.com/progrium/go-netstack/dhcp/rfc1035label" 6 | ) 7 | 8 | // OptDomainSearch returns a new domain search option. 9 | // 10 | // The domain search option is described by RFC 3397, Section 2. 11 | func OptDomainSearch(labels *rfc1035label.Labels) Option { 12 | return Option{Code: OptionDNSDomainSearchList, Value: labels} 13 | } 14 | 15 | // OptClientArch returns a new Client System Architecture Type option. 16 | func OptClientArch(archs ...iana.Arch) Option { 17 | return Option{Code: OptionClientSystemArchitectureType, Value: iana.Archs(archs)} 18 | } 19 | 20 | // OptClientIdentifier returns a new Client Identifier option. 21 | func OptClientIdentifier(ident []byte) Option { 22 | return OptGeneric(OptionClientIdentifier, ident) 23 | } 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/aliases.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package sync 7 | 8 | import ( 9 | "sync" 10 | ) 11 | 12 | // Aliases of standard library types. 13 | type ( 14 | // Cond is an alias of sync.Cond. 15 | Cond = sync.Cond 16 | 17 | // Locker is an alias of sync.Locker. 18 | Locker = sync.Locker 19 | 20 | // Once is an alias of sync.Once. 21 | Once = sync.Once 22 | 23 | // Pool is an alias of sync.Pool. 24 | Pool = sync.Pool 25 | 26 | // WaitGroup is an alias of sync.WaitGroup. 27 | WaitGroup = sync.WaitGroup 28 | 29 | // Map is an alias of sync.Map. 30 | Map = sync.Map 31 | ) 32 | 33 | // NewCond is a wrapper around sync.NewCond. 34 | func NewCond(l Locker) *Cond { 35 | return sync.NewCond(l) 36 | } 37 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/runtime_spinning_other.s: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build !amd64 16 | 17 | // This file is intentionally left blank. Other arches don't use 18 | // addrOfSpinning, but we still need an input to the nogo temlate rule. 19 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/splice.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // Constants for splice(2), sendfile(2) and tee(2). 18 | const ( 19 | SPLICE_F_MOVE = 1 << iota 20 | SPLICE_F_NONBLOCK 21 | SPLICE_F_MORE 22 | SPLICE_F_GIFT 23 | ) 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/vfs/debug_testonly.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | //go:build check_invariants 16 | // +build check_invariants 17 | 18 | package vfs 19 | 20 | const ( 21 | // Set checkInvariants to true for tests. 22 | checkInvariants = true 23 | ) 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/fence_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | #include "textflag.h" 19 | 20 | // func MemoryFenceReads() 21 | TEXT ·MemoryFenceReads(SB),NOSPLIT|NOFRAME,$0-0 22 | DMB $0x9 // ISHLD 23 | RET 24 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/fdbased/endpoint_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | //go:build linux 16 | // +build linux 17 | 18 | package fdbased 19 | 20 | import ( 21 | "unsafe" 22 | ) 23 | 24 | const virtioNetHdrSize = int(unsafe.Sizeof(virtioNetHdr{})) 25 | -------------------------------------------------------------------------------- /gvisor/pkg/ring0/ring0.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | // Package ring0 provides basic operating system-level stubs. 16 | package ring0 17 | 18 | import ( 19 | // Required for facts checks. 20 | _ "github.com/progrium/go-netstack/gvisor/pkg/abi/linux" 21 | ) 22 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_impl_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build go1.1 4 | // +build go1.1 5 | 6 | package kernel 7 | 8 | import ( 9 | "github.com/progrium/go-netstack/gvisor/pkg/state" 10 | ) 11 | 12 | func (p *pidNamespaceData) StateTypeName() string { 13 | return "pkg/sentry/kernel.pidNamespaceData" 14 | } 15 | 16 | func (p *pidNamespaceData) StateFields() []string { 17 | return []string{} 18 | } 19 | 20 | func (p *pidNamespaceData) beforeSave() {} 21 | 22 | // +checklocksignore 23 | func (p *pidNamespaceData) StateSave(stateSinkObject state.Sink) { 24 | p.beforeSave() 25 | } 26 | 27 | func (p *pidNamespaceData) afterLoad() {} 28 | 29 | // +checklocksignore 30 | func (p *pidNamespaceData) StateLoad(stateSourceObject state.Source) { 31 | } 32 | 33 | func init() { 34 | state.Register((*pidNamespaceData)(nil)) 35 | } 36 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/netlink/port/port_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package port 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (m *Manager) StateTypeName() string { 10 | return "pkg/sentry/socket/netlink/port.Manager" 11 | } 12 | 13 | func (m *Manager) StateFields() []string { 14 | return []string{ 15 | "ports", 16 | } 17 | } 18 | 19 | func (m *Manager) beforeSave() {} 20 | 21 | // +checklocksignore 22 | func (m *Manager) StateSave(stateSinkObject state.Sink) { 23 | m.beforeSave() 24 | stateSinkObject.Save(0, &m.ports) 25 | } 26 | 27 | func (m *Manager) afterLoad() {} 28 | 29 | // +checklocksignore 30 | func (m *Manager) StateLoad(stateSourceObject state.Source) { 31 | stateSourceObject.Load(0, &m.ports) 32 | } 33 | 34 | func init() { 35 | state.Register((*Manager)(nil)) 36 | } 37 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/timer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // itimer types for getitimer(2) and setitimer(2), from 18 | // include/uapi/linux/time.h. 19 | const ( 20 | ITIMER_REAL = 0 21 | ITIMER_VIRTUAL = 1 22 | ITIMER_PROF = 2 23 | ) 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/kernel_opts.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build go1.1 16 | // +build go1.1 17 | 18 | package kernel 19 | 20 | // SpecialOpts contains non-standard options for the kernel. 21 | // 22 | // +stateify savable 23 | type SpecialOpts struct{} 24 | -------------------------------------------------------------------------------- /gvisor/pkg/bits/bits32.go: -------------------------------------------------------------------------------- 1 | package bits 2 | 3 | // IsOn returns true if *all* bits set in 'bits' are set in 'mask'. 4 | func IsOn32(mask, bits uint32) bool { 5 | return mask&bits == bits 6 | } 7 | 8 | // IsAnyOn returns true if *any* bit set in 'bits' is set in 'mask'. 9 | func IsAnyOn32(mask, bits uint32) bool { 10 | return mask&bits != 0 11 | } 12 | 13 | // Mask returns a T with all of the given bits set. 14 | func Mask32(is ...int) uint32 { 15 | ret := uint32(0) 16 | for _, i := range is { 17 | ret |= MaskOf32(i) 18 | } 19 | return ret 20 | } 21 | 22 | // MaskOf is like Mask, but sets only a single bit (more efficiently). 23 | func MaskOf32(i int) uint32 { 24 | return uint32(1) << uint32(i) 25 | } 26 | 27 | // IsPowerOfTwo returns true if v is power of 2. 28 | func IsPowerOfTwo32(v uint32) bool { 29 | if v == 0 { 30 | return false 31 | } 32 | return v&(v-1) == 0 33 | } 34 | -------------------------------------------------------------------------------- /gvisor/pkg/bits/bits64.go: -------------------------------------------------------------------------------- 1 | package bits 2 | 3 | // IsOn returns true if *all* bits set in 'bits' are set in 'mask'. 4 | func IsOn64(mask, bits uint64) bool { 5 | return mask&bits == bits 6 | } 7 | 8 | // IsAnyOn returns true if *any* bit set in 'bits' is set in 'mask'. 9 | func IsAnyOn64(mask, bits uint64) bool { 10 | return mask&bits != 0 11 | } 12 | 13 | // Mask returns a T with all of the given bits set. 14 | func Mask64(is ...int) uint64 { 15 | ret := uint64(0) 16 | for _, i := range is { 17 | ret |= MaskOf64(i) 18 | } 19 | return ret 20 | } 21 | 22 | // MaskOf is like Mask, but sets only a single bit (more efficiently). 23 | func MaskOf64(i int) uint64 { 24 | return uint64(1) << uint64(i) 25 | } 26 | 27 | // IsPowerOfTwo returns true if v is power of 2. 28 | func IsPowerOfTwo64(v uint64) bool { 29 | if v == 0 { 30 | return false 31 | } 32 | return v&(v-1) == 0 33 | } 34 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_state_x86.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 || 386 16 | // +build amd64 386 17 | 18 | package arch 19 | 20 | // afterLoadFPState is invoked by afterLoad. 21 | func (s *State) afterLoadFPState() { 22 | s.fpState.AfterLoad() 23 | } 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/shared_context_race.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build race 16 | // +build race 17 | 18 | package systrap 19 | 20 | // yield is just a stub because sync.Goyield() is very expensive with the race 21 | // detector. 22 | func yield() {} 23 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/systrap_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | package systrap 16 | 17 | import ( 18 | "github.com/progrium/go-netstack/gvisor/pkg/sentry/arch" 19 | ) 20 | 21 | func stackPointer(r *arch.Registers) uintptr { 22 | return uintptr(r.Sp) 23 | } 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/shared_context_norace.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build !race 16 | // +build !race 17 | 18 | package systrap 19 | 20 | import ( 21 | "github.com/progrium/go-netstack/gvisor/pkg/sync" 22 | ) 23 | 24 | func yield() { 25 | sync.Goyield() 26 | } 27 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg_thread_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package systrap 16 | 17 | import "github.com/progrium/go-netstack/gvisor/pkg/seccomp" 18 | 19 | func appendSysThreadArchSeccompRules(rules []seccomp.RuleSet) []seccomp.RuleSet { 20 | return rules 21 | } 22 | -------------------------------------------------------------------------------- /vnet/stats.go: -------------------------------------------------------------------------------- 1 | package vnet 2 | 3 | import ( 4 | "reflect" 5 | 6 | "github.com/progrium/go-netstack/gvisor/pkg/tcpip" 7 | ) 8 | 9 | func iterateFields(ret map[string]interface{}, valueOf reflect.Value) { 10 | for i := 0; i < valueOf.NumField(); i++ { 11 | field := valueOf.Field(i) 12 | fieldName := valueOf.Type().Field(i).Name 13 | if field.Kind() == reflect.Struct { 14 | m := make(map[string]interface{}) 15 | ret[fieldName] = m 16 | iterateFields(m, field) 17 | continue 18 | } 19 | if counter, ok := field.Interface().(*tcpip.StatCounter); ok { 20 | ret[fieldName] = counter.Value() 21 | } 22 | } 23 | } 24 | 25 | func statsAsJSON(sent, received uint64, stats tcpip.Stats) map[string]interface{} { 26 | root := make(map[string]interface{}) 27 | iterateFields(root, reflect.ValueOf(stats)) 28 | root["BytesSent"] = sent 29 | root["BytesReceived"] = received 30 | return root 31 | } 32 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsimpl/fuse/dev_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The gVisor Authors. 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 | // http://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 | 15 | package fuse 16 | 17 | func (fd *DeviceFD) saveFullQueueCh() int { 18 | return cap(fd.fullQueueCh) 19 | } 20 | 21 | func (fd *DeviceFD) loadFullQueueCh(capacity int) { 22 | fd.fullQueueCh = make(chan struct{}, capacity) 23 | } 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sighandler_amd64.go: -------------------------------------------------------------------------------- 1 | /* Autogenerated by pkg/sentry/platform/systrap/sysmsg/gen_offsets_go.sh, do not edit */ 2 | package sysmsg 3 | 4 | var Sighandler_blob_offset____export_arch_state = 0x0000000000001448 5 | var Sighandler_blob_offset____export_context_queue_addr = 0x0000000000001468 6 | var Sighandler_blob_offset____export_context_region = 0x0000000000001460 7 | var Sighandler_blob_offset____export_deep_sleep_timeout = 0x0000000000001470 8 | var Sighandler_blob_offset____export_restore_rt = 0x0000000000000000 9 | var Sighandler_blob_offset____export_sighandler = 0x00000000000000f0 10 | var Sighandler_blob_offset____export_spinning_queue_addr = 0x0000000000001458 11 | var Sighandler_blob_offset____export_start = 0x0000000000000a60 12 | var Sighandler_blob_offset____export_stub_start = 0x0000000000001440 13 | var Sighandler_blob_offset____export_syshandler = 0x0000000000000c48 14 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/sysmsg/sighandler_arm64.go: -------------------------------------------------------------------------------- 1 | /* Autogenerated by pkg/sentry/platform/systrap/sysmsg/gen_offsets_go.sh, do not edit */ 2 | package sysmsg 3 | 4 | var Sighandler_blob_offset____export_arch_state = 0x00000000000009c0 5 | var Sighandler_blob_offset____export_context_queue_addr = 0x00000000000009d8 6 | var Sighandler_blob_offset____export_context_region = 0x00000000000009e0 7 | var Sighandler_blob_offset____export_deep_sleep_timeout = 0x00000000000009e8 8 | var Sighandler_blob_offset____export_restore_rt = 0x0000000000000000 9 | var Sighandler_blob_offset____export_sighandler = 0x0000000000000174 10 | var Sighandler_blob_offset____export_spinning_queue_addr = 0x00000000000009d0 11 | var Sighandler_blob_offset____export_start = 0x00000000000000c4 12 | var Sighandler_blob_offset____export_stub_start = 0x00000000000009c8 13 | var Sighandler_blob_offset____export_syshandler = 0x0000000000000390 14 | -------------------------------------------------------------------------------- /uio/uio/alignwriter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uio 6 | 7 | import ( 8 | "bytes" 9 | "io" 10 | ) 11 | 12 | // AlignWriter keeps track of how many bytes were written so the writer can be 13 | // aligned at a future time. 14 | type AlignWriter struct { 15 | W io.Writer 16 | N int 17 | } 18 | 19 | // Write writes to the underlying io.Writew. 20 | func (w *AlignWriter) Write(b []byte) (int, error) { 21 | n, err := w.W.Write(b) 22 | w.N += n 23 | return n, err 24 | } 25 | 26 | // Align aligns the writer to the given number of bytes using the given pad 27 | // value. 28 | func (w *AlignWriter) Align(n int, pad byte) error { 29 | if w.N%n == 0 { 30 | return nil 31 | } 32 | _, err := w.Write(bytes.Repeat([]byte{pad}, n-w.N%n)) 33 | return err 34 | } 35 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/arch_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | package linux 19 | 20 | // Start and end addresses of the vsyscall page. 21 | const ( 22 | VSyscallStartAddr uint64 = 0xffffffffff600000 23 | VSyscallEndAddr uint64 = 0xffffffffff601000 24 | ) 25 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/loader/vdsodata/vdsodata_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | package vdsodata 19 | 20 | import ( 21 | _ "embed" 22 | ) 23 | 24 | // Binary contains a compiled code of vdso.so. 25 | // 26 | //go:embed vdso_amd64.so 27 | var Binary []byte 28 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/loader/vdsodata/vdsodata_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package vdsodata 19 | 20 | import ( 21 | _ "embed" 22 | ) 23 | 24 | // Binary contains a compiled code of vdso.so. 25 | // 26 | //go:embed vdso_arm64.so 27 | var Binary []byte 28 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/unix/transport/connectionless_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package transport 16 | 17 | // afterLoad is invoked by stateify. 18 | func (e *connectionlessEndpoint) afterLoad() { 19 | e.ops.InitHandler(e, &stackHandler{}, getSendBufferLimits, getReceiveBufferLimits) 20 | } 21 | -------------------------------------------------------------------------------- /gvisor/pkg/cpuid/cpuid_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package cpuid 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (h *hwCap) StateTypeName() string { 10 | return "pkg/cpuid.hwCap" 11 | } 12 | 13 | func (h *hwCap) StateFields() []string { 14 | return []string{ 15 | "hwCap1", 16 | "hwCap2", 17 | } 18 | } 19 | 20 | func (h *hwCap) beforeSave() {} 21 | 22 | // +checklocksignore 23 | func (h *hwCap) StateSave(stateSinkObject state.Sink) { 24 | h.beforeSave() 25 | stateSinkObject.Save(0, &h.hwCap1) 26 | stateSinkObject.Save(1, &h.hwCap2) 27 | } 28 | 29 | func (h *hwCap) afterLoad() {} 30 | 31 | // +checklocksignore 32 | func (h *hwCap) StateLoad(stateSourceObject state.Source) { 33 | stateSourceObject.Load(0, &h.hwCap1) 34 | stateSourceObject.Load(1, &h.hwCap2) 35 | } 36 | 37 | func init() { 38 | state.Register((*hwCap)(nil)) 39 | } 40 | -------------------------------------------------------------------------------- /gvisor/pkg/goid/goid_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | #include "textflag.h" 16 | 17 | #define GOID_OFFSET 152 // +checkoffset runtime g.goid 18 | 19 | // func goid() int64 20 | TEXT ·goid(SB),NOSPLIT|NOFRAME,$0-8 21 | MOVQ (TLS), R14 22 | MOVQ GOID_OFFSET(R14), R14 23 | MOVQ R14, ret+0(FP) 24 | RET 25 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/fadvise.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // Fadvise constants. 18 | const ( 19 | POSIX_FADV_NORMAL = 0 20 | POSIX_FADV_RANDOM = 1 21 | POSIX_FADV_SEQUENTIAL = 2 22 | POSIX_FADV_WILLNEED = 3 23 | POSIX_FADV_DONTNEED = 4 24 | POSIX_FADV_NOREUSE = 5 25 | ) 26 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/internal/tcp/tcp_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package tcp 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (offset *TSOffset) StateTypeName() string { 10 | return "pkg/tcpip/internal/tcp.TSOffset" 11 | } 12 | 13 | func (offset *TSOffset) StateFields() []string { 14 | return []string{ 15 | "milliseconds", 16 | } 17 | } 18 | 19 | func (offset *TSOffset) beforeSave() {} 20 | 21 | // +checklocksignore 22 | func (offset *TSOffset) StateSave(stateSinkObject state.Sink) { 23 | offset.beforeSave() 24 | stateSinkObject.Save(0, &offset.milliseconds) 25 | } 26 | 27 | func (offset *TSOffset) afterLoad() {} 28 | 29 | // +checklocksignore 30 | func (offset *TSOffset) StateLoad(stateSourceObject state.Source) { 31 | stateSourceObject.Load(0, &offset.milliseconds) 32 | } 33 | 34 | func init() { 35 | state.Register((*TSOffset)(nil)) 36 | } 37 | -------------------------------------------------------------------------------- /gvisor/pkg/seccomp/seccomp_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | package seccomp 19 | 20 | import ( 21 | "github.com/progrium/go-netstack/gvisor/pkg/abi/linux" 22 | ) 23 | 24 | const ( 25 | LINUX_AUDIT_ARCH = linux.AUDIT_ARCH_X86_64 26 | SYS_SECCOMP = 317 27 | ) 28 | -------------------------------------------------------------------------------- /gvisor/pkg/seccomp/seccomp_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package seccomp 19 | 20 | import ( 21 | "github.com/progrium/go-netstack/gvisor/pkg/abi/linux" 22 | ) 23 | 24 | const ( 25 | LINUX_AUDIT_ARCH = linux.AUDIT_ARCH_AARCH64 26 | SYS_SECCOMP = 277 27 | ) 28 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsimpl/devtmpfs/save_restore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | package devtmpfs 16 | 17 | // afterLoad is invoked by stateify. 18 | func (fst *FilesystemType) afterLoad() { 19 | if fst.fs != nil { 20 | // Ensure that we don't create another filesystem. 21 | fst.initOnce.Do(func() {}) 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /gvisor/pkg/buffer/buffer_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The gVisor Authors. 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 | // http://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 | 15 | package buffer 16 | 17 | // saveData is invoked by stateify. 18 | func (b *Buffer) saveData() []byte { 19 | return b.Flatten() 20 | } 21 | 22 | // loadData is invoked by stateify. 23 | func (b *Buffer) loadData(data []byte) { 24 | *b = MakeWithData(data) 25 | } 26 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/channel/channel_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package channel 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (n *NotificationHandle) StateTypeName() string { 10 | return "pkg/tcpip/link/channel.NotificationHandle" 11 | } 12 | 13 | func (n *NotificationHandle) StateFields() []string { 14 | return []string{ 15 | "n", 16 | } 17 | } 18 | 19 | func (n *NotificationHandle) beforeSave() {} 20 | 21 | // +checklocksignore 22 | func (n *NotificationHandle) StateSave(stateSinkObject state.Sink) { 23 | n.beforeSave() 24 | stateSinkObject.Save(0, &n.n) 25 | } 26 | 27 | func (n *NotificationHandle) afterLoad() {} 28 | 29 | // +checklocksignore 30 | func (n *NotificationHandle) StateLoad(stateSourceObject state.Source) { 31 | stateSourceObject.Load(0, &n.n) 32 | } 33 | 34 | func init() { 35 | state.Register((*NotificationHandle)(nil)) 36 | } 37 | -------------------------------------------------------------------------------- /gvisor/pkg/bitmap/bitmap_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package bitmap 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (b *Bitmap) StateTypeName() string { 10 | return "pkg/bitmap.Bitmap" 11 | } 12 | 13 | func (b *Bitmap) StateFields() []string { 14 | return []string{ 15 | "numOnes", 16 | "bitBlock", 17 | } 18 | } 19 | 20 | func (b *Bitmap) beforeSave() {} 21 | 22 | // +checklocksignore 23 | func (b *Bitmap) StateSave(stateSinkObject state.Sink) { 24 | b.beforeSave() 25 | stateSinkObject.Save(0, &b.numOnes) 26 | stateSinkObject.Save(1, &b.bitBlock) 27 | } 28 | 29 | func (b *Bitmap) afterLoad() {} 30 | 31 | // +checklocksignore 32 | func (b *Bitmap) StateLoad(stateSourceObject state.Source) { 33 | stateSourceObject.Load(0, &b.numOnes) 34 | stateSourceObject.Load(1, &b.bitBlock) 35 | } 36 | 37 | func init() { 38 | state.Register((*Bitmap)(nil)) 39 | } 40 | -------------------------------------------------------------------------------- /gvisor/pkg/cpuid/native_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | #include "textflag.h" 16 | 17 | TEXT ·native(SB),NOSPLIT|NOFRAME,$0-24 18 | MOVL arg_Eax+0(FP), AX 19 | MOVL arg_Ecx+4(FP), CX 20 | CPUID 21 | MOVL AX, ret_Eax+8(FP) 22 | MOVL BX, ret_Ebx+12(FP) 23 | MOVL CX, ret_Ecx+16(FP) 24 | MOVL DX, ret_Edx+20(FP) 25 | RET 26 | -------------------------------------------------------------------------------- /gvisor/pkg/goid/goid_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | #include "textflag.h" 16 | 17 | #define GOID_OFFSET 152 // +checkoffset runtime g.goid 18 | 19 | // func goid() int64 20 | TEXT ·goid(SB),NOSPLIT,$0-8 21 | MOVD g, R0 // g 22 | MOVD GOID_OFFSET(R0), R0 23 | MOVD R0, ret+0(FP) 24 | RET 25 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 && amd64 && amd64 4 | // +build amd64,amd64,amd64 5 | 6 | package arch 7 | 8 | import ( 9 | "github.com/progrium/go-netstack/gvisor/pkg/state" 10 | ) 11 | 12 | func (c *Context64) StateTypeName() string { 13 | return "pkg/sentry/arch.Context64" 14 | } 15 | 16 | func (c *Context64) StateFields() []string { 17 | return []string{ 18 | "State", 19 | } 20 | } 21 | 22 | func (c *Context64) beforeSave() {} 23 | 24 | // +checklocksignore 25 | func (c *Context64) StateSave(stateSinkObject state.Sink) { 26 | c.beforeSave() 27 | stateSinkObject.Save(0, &c.State) 28 | } 29 | 30 | func (c *Context64) afterLoad() {} 31 | 32 | // +checklocksignore 33 | func (c *Context64) StateLoad(stateSourceObject state.Source) { 34 | stateSourceObject.Load(0, &c.State) 35 | } 36 | 37 | func init() { 38 | state.Register((*Context64)(nil)) 39 | } 40 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/nvgpu/status.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | package nvgpu 16 | 17 | // Status codes, from src/common/sdk/nvidia/inc/nvstatuscodes.h. 18 | const ( 19 | NV_ERR_INVALID_ADDRESS = 0x0000001e 20 | NV_ERR_INVALID_ARGUMENT = 0x0000001f 21 | NV_ERR_INVALID_LIMIT = 0x0000002e 22 | NV_ERR_NOT_SUPPORTED = 0x00000056 23 | ) 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/socket_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package socket 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | func (i *IPControlMessages) saveTimestamp() int64 { 22 | return i.Timestamp.UnixNano() 23 | } 24 | 25 | func (i *IPControlMessages) loadTimestamp(nsec int64) { 26 | i.Timestamp = time.Unix(0, nsec) 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/audit.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // Audit numbers identify different system call APIs, from 18 | const ( 19 | // AUDIT_ARCH_X86_64 identifies AMD64. 20 | AUDIT_ARCH_X86_64 = 0xc000003e 21 | // AUDIT_ARCH_AARCH64 identifies ARM64. 22 | AUDIT_ARCH_AARCH64 = 0xc00000b7 23 | ) 24 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/tcpip_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package tcpip 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | func (c *ReceivableControlMessages) saveTimestamp() int64 { 22 | return c.Timestamp.UnixNano() 23 | } 24 | 25 | func (c *ReceivableControlMessages) loadTimestamp(nsec int64) { 26 | c.Timestamp = time.Unix(0, nsec) 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/buffer/view_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | package buffer 16 | 17 | import ( 18 | "reflect" 19 | "unsafe" 20 | ) 21 | 22 | // BasePtr returns a pointer to the view's chunk. 23 | func (v *View) BasePtr() *byte { 24 | hdr := (*reflect.SliceHeader)(unsafe.Pointer(&v.chunk.data)) 25 | return (*byte)(unsafe.Pointer(hdr.Data)) 26 | } 27 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/physical_map_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | package kvm 16 | 17 | const ( 18 | // reservedMemory is a chunk of physical memory reserved starting at 19 | // physical address zero. There are some special pages in this region, 20 | // so we just call the whole thing off. 21 | reservedMemory = 0x100000000 22 | ) 23 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/unix/transport/save_restore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package transport 16 | 17 | import "fmt" 18 | 19 | // afterLoad is invoked by stateify. 20 | func (c *HostConnectedEndpoint) afterLoad() { 21 | if err := c.initFromOptions(); err != nil { 22 | panic(fmt.Sprintf("initFromOptions failed: %v", err)) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/mm_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | package linux 19 | 20 | // TASK_SIZE can be one of two values, corresponding to 4-level and 5-level 21 | // paging. 22 | // 23 | // The array has to be sorted in decreasing order. 24 | var feasibleTaskSizes = []uintptr{0xfffffffffff000, 0x7ffffffff000} 25 | -------------------------------------------------------------------------------- /gvisor/pkg/sync/runtime_spinning_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | 17 | #include "textflag.h" 18 | 19 | #define NMSPINNING_OFFSET 92 // +checkoffset runtime schedt.nmspinning 20 | 21 | TEXT ·addrOfSpinning(SB),NOSPLIT|NOFRAME,$0-8 22 | LEAQ runtime·sched(SB), AX 23 | ADDQ $NMSPINNING_OFFSET, AX 24 | MOVQ AX, ret+0(FP) 25 | RET 26 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/stdclock_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package tcpip 16 | 17 | import "time" 18 | 19 | // beforeSave is invoked by stateify. 20 | func (s *stdClock) beforeSave() { 21 | s.monotonicOffset = s.NowMonotonic() 22 | } 23 | 24 | // afterLoad is invoked by stateify. 25 | func (s *stdClock) afterLoad() { 26 | s.baseTime = time.Now() 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/link/fdbased/mmap_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | //go:build !linux || (!amd64 && !arm64) 16 | // +build !linux !amd64,!arm64 17 | 18 | package fdbased 19 | 20 | // Stubbed out version for non-linux/non-amd64/non-arm64 platforms. 21 | 22 | func newPacketMMapDispatcher(fd int, e *endpoint) (linkDispatcher, error) { 23 | return nil, nil 24 | } 25 | -------------------------------------------------------------------------------- /uio/uio/multiwriter.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 the u-root Authors. All rights reserved 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package uio 6 | 7 | import ( 8 | "io" 9 | ) 10 | 11 | type multiCloser struct { 12 | io.Writer 13 | writers []io.Writer 14 | } 15 | 16 | // Close implements io.Closer and closes any io.Writers that are also 17 | // io.Closers. 18 | func (mc *multiCloser) Close() error { 19 | var allErr error 20 | for _, w := range mc.writers { 21 | if c, ok := w.(io.Closer); ok { 22 | if err := c.Close(); err != nil { 23 | allErr = err 24 | } 25 | } 26 | } 27 | return allErr 28 | } 29 | 30 | // MultiWriteCloser is an io.MultiWriter that has an io.Closer and attempts to 31 | // close those w's that have optional io.Closers. 32 | func MultiWriteCloser(w ...io.Writer) io.WriteCloser { 33 | return &multiCloser{ 34 | Writer: io.MultiWriter(w...), 35 | writers: w, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_x86_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build (amd64 || 386) && (amd64 || 386) 4 | // +build amd64 386 5 | // +build amd64 386 6 | 7 | package arch 8 | 9 | import ( 10 | "github.com/progrium/go-netstack/gvisor/pkg/state" 11 | ) 12 | 13 | func (r *Registers) StateTypeName() string { 14 | return "pkg/sentry/arch.Registers" 15 | } 16 | 17 | func (r *Registers) StateFields() []string { 18 | return []string{ 19 | "PtraceRegs", 20 | } 21 | } 22 | 23 | func (r *Registers) beforeSave() {} 24 | 25 | // +checklocksignore 26 | func (r *Registers) StateSave(stateSinkObject state.Sink) { 27 | r.beforeSave() 28 | stateSinkObject.Save(0, &r.PtraceRegs) 29 | } 30 | 31 | func (r *Registers) afterLoad() {} 32 | 33 | // +checklocksignore 34 | func (r *Registers) StateLoad(stateSourceObject state.Source) { 35 | stateSourceObject.Load(0, &r.PtraceRegs) 36 | } 37 | 38 | func init() { 39 | state.Register((*Registers)(nil)) 40 | } 41 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/address_space_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package kvm 16 | 17 | import ( 18 | "github.com/progrium/go-netstack/gvisor/pkg/ring0" 19 | ) 20 | 21 | // invalidate is the implementation for Invalidate. 22 | func (as *addressSpace) invalidate() { 23 | bluepill(as.pageTables.Allocator.(*allocator).cpu) 24 | ring0.FlushTlbAll() 25 | } 26 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/ipc/ns.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package ipc 16 | 17 | type contextID int 18 | 19 | // CtxIPCNamespace is the context.Value key used to retreive an IPC namespace. 20 | // We define it here because it's needed in several packages, and is not 21 | // possible to use otherwise without causing a circular depenedency. 22 | const CtxIPCNamespace contextID = iota 23 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/vfs/debug.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | //go:build !check_invariants 16 | // +build !check_invariants 17 | 18 | package vfs 19 | 20 | const ( 21 | // If checkInvariants is true, perform runtime checks for invariants 22 | // expected by the vfs package. This is disabled for non-test binaries since 23 | // VFS is often a hot path. 24 | checkInvariants = false 25 | ) 26 | -------------------------------------------------------------------------------- /gvisor/pkg/goid/goid.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | // Package goid provides the Get function. 16 | package goid 17 | 18 | import ( 19 | _ "runtime" // For facts in assembly files. 20 | ) 21 | 22 | // goid returns the current goid, it is defined in assembly. 23 | func goid() int64 24 | 25 | // Get returns the ID of the current goroutine. 26 | func Get() int64 { 27 | return goid() 28 | } 29 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/vfs/memxattr/memxattr_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package memxattr 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (x *SimpleExtendedAttributes) StateTypeName() string { 10 | return "pkg/sentry/vfs/memxattr.SimpleExtendedAttributes" 11 | } 12 | 13 | func (x *SimpleExtendedAttributes) StateFields() []string { 14 | return []string{ 15 | "xattrs", 16 | } 17 | } 18 | 19 | func (x *SimpleExtendedAttributes) beforeSave() {} 20 | 21 | // +checklocksignore 22 | func (x *SimpleExtendedAttributes) StateSave(stateSinkObject state.Sink) { 23 | x.beforeSave() 24 | stateSinkObject.Save(0, &x.xattrs) 25 | } 26 | 27 | func (x *SimpleExtendedAttributes) afterLoad() {} 28 | 29 | // +checklocksignore 30 | func (x *SimpleExtendedAttributes) StateLoad(stateSourceObject state.Source) { 31 | stateSourceObject.Load(0, &x.xattrs) 32 | } 33 | 34 | func init() { 35 | state.Register((*SimpleExtendedAttributes)(nil)) 36 | } 37 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/fsimpl/erofs/save_restore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | package erofs 16 | 17 | // TODO: support checkpoint/restore. 18 | 19 | // saveParent is called by stateify. 20 | func (d *dentry) saveParent() *dentry { 21 | return d.parent.Load() 22 | } 23 | 24 | // loadParent is called by stateify. 25 | func (d *dentry) loadParent(parent *dentry) { 26 | d.parent.Store(parent) 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/bits/uint64_arch_amd64_asm.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | TEXT ·TrailingZeros64(SB),$0-16 19 | BSFQ x+0(FP), AX 20 | JNZ end 21 | MOVQ $64, AX 22 | end: 23 | MOVQ AX, ret+8(FP) 24 | RET 25 | 26 | TEXT ·MostSignificantOne64(SB),$0-16 27 | BSRQ x+0(FP), AX 28 | JNZ end 29 | MOVQ $64, AX 30 | end: 31 | MOVQ AX, ret+8(FP) 32 | RET 33 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/pipe/save_restore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | package pipe 16 | 17 | import ( 18 | "github.com/progrium/go-netstack/gvisor/pkg/safemem" 19 | ) 20 | 21 | // afterLoad is called by stateify. 22 | func (p *Pipe) afterLoad() { 23 | p.bufBlocks[0] = safemem.BlockFromSafeSlice(p.buf) 24 | p.bufBlocks[1] = p.bufBlocks[0] 25 | p.bufBlockSeq = safemem.BlockSeqFromSlice(p.bufBlocks[:]) 26 | } 27 | -------------------------------------------------------------------------------- /gvisor/pkg/metric/sentry_profiling.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build sentry_profiling 16 | // +build sentry_profiling 17 | 18 | package metric 19 | 20 | // SentryProfiling is a builder that produces conditionally compiled metrics. 21 | // Metrics made from this are compiled and active at runtime when the 22 | // "sentry_profiling" go-tag is specified at compilation. 23 | var SentryProfiling = RealMetricBuilder{} 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_x86_impl_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build (amd64 || 386) && go1.1 4 | // +build amd64 386 5 | // +build go1.1 6 | 7 | package arch 8 | 9 | import ( 10 | "github.com/progrium/go-netstack/gvisor/pkg/state" 11 | ) 12 | 13 | func (s *State) StateTypeName() string { 14 | return "pkg/sentry/arch.State" 15 | } 16 | 17 | func (s *State) StateFields() []string { 18 | return []string{ 19 | "Regs", 20 | "fpState", 21 | } 22 | } 23 | 24 | func (s *State) beforeSave() {} 25 | 26 | // +checklocksignore 27 | func (s *State) StateSave(stateSinkObject state.Sink) { 28 | s.beforeSave() 29 | stateSinkObject.Save(0, &s.Regs) 30 | stateSinkObject.Save(1, &s.fpState) 31 | } 32 | 33 | // +checklocksignore 34 | func (s *State) StateLoad(stateSourceObject state.Source) { 35 | stateSourceObject.Load(0, &s.Regs) 36 | stateSourceObject.LoadWait(1, &s.fpState) 37 | stateSourceObject.AfterLoad(s.afterLoad) 38 | } 39 | 40 | func init() { 41 | state.Register((*State)(nil)) 42 | } 43 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/hostcpu/getcpu_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | #include "textflag.h" 16 | 17 | // func GetCPU() uint32 18 | TEXT ·GetCPU(SB),NOSPLIT|NOFRAME,$0-4 19 | BYTE $0x0f; BYTE $0x01; BYTE $0xf9; // RDTSCP 20 | // On Linux, the bottom 12 bits of IA32_TSC_AUX are CPU and the upper 20 21 | // are node. See arch/x86/entry/vdso/vma.c:vgetcpu_cpu_init(). 22 | ANDL $0xfff, CX 23 | MOVL CX, ret+0(FP) 24 | RET 25 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/futex/futex_unsafe_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package futex 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (p *AtomicPtrBucket) StateTypeName() string { 10 | return "pkg/sentry/kernel/futex.AtomicPtrBucket" 11 | } 12 | 13 | func (p *AtomicPtrBucket) StateFields() []string { 14 | return []string{ 15 | "ptr", 16 | } 17 | } 18 | 19 | func (p *AtomicPtrBucket) beforeSave() {} 20 | 21 | // +checklocksignore 22 | func (p *AtomicPtrBucket) StateSave(stateSinkObject state.Sink) { 23 | p.beforeSave() 24 | var ptrValue *bucket 25 | ptrValue = p.savePtr() 26 | stateSinkObject.SaveValue(0, ptrValue) 27 | } 28 | 29 | func (p *AtomicPtrBucket) afterLoad() {} 30 | 31 | // +checklocksignore 32 | func (p *AtomicPtrBucket) StateLoad(stateSourceObject state.Source) { 33 | stateSourceObject.LoadValue(0, new(*bucket), func(y any) { p.loadPtr(y.(*bucket)) }) 34 | } 35 | 36 | func init() { 37 | state.Register((*AtomicPtrBucket)(nil)) 38 | } 39 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/filters_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | package systrap 19 | 20 | import ( 21 | "github.com/progrium/go-netstack/gvisor/pkg/seccomp" 22 | ) 23 | 24 | // SyscallFilters returns syscalls made exclusively by the systrap platform. 25 | func (*Systrap) archSyscallFilters() seccomp.SyscallRules { 26 | return seccomp.SyscallRules{} 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/tsc_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | #include "textflag.h" 16 | 17 | TEXT ·Rdtsc(SB),NOSPLIT,$0-8 18 | // Get the virtual counter. 19 | ISB $15 20 | WORD $0xd53be040 //MRS CNTVCT_EL0, R0 21 | MOVD R0, ret+0(FP) 22 | RET 23 | 24 | TEXT ·getCNTFRQ(SB),NOSPLIT,$0-8 25 | // Get the virtual counter frequency. 26 | WORD $0xd53be000 //MRS CNTFRQ_EL0, R0 27 | MOVD R0, ret+0(FP) 28 | RET 29 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/mm_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package linux 19 | 20 | // Only 4K page size is supported on arm64. In this case, TASK_SIZE can 21 | // be one of three values, corresponding to 3-level, 4-level and 22 | // 5-level paging. 23 | // 24 | // The array has to be sorted in decreasing order. 25 | var feasibleTaskSizes = []uintptr{1 << 52, 1 << 48, 1 << 39} 26 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/sem_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package linux 19 | 20 | // SemidDS is equivalent to struct semid64_ds. 21 | // 22 | // Source: include/uapi/asm-generic/sembuf.h 23 | // 24 | // +marshal 25 | type SemidDS struct { 26 | SemPerm IPCPerm 27 | SemOTime TimeT 28 | SemCTime TimeT 29 | SemNSems uint64 30 | unused3 uint64 31 | unused4 uint64 32 | } 33 | -------------------------------------------------------------------------------- /gvisor/pkg/metric/sentry_profiling_fake.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | //go:build !sentry_profiling 16 | // +build !sentry_profiling 17 | 18 | package metric 19 | 20 | // SentryProfiling is a builder that produces conditionally compiled metrics. 21 | // Metrics made from this are compiled and active at runtime when the 22 | // "sentry_profiling" go-tag is specified at compilation. 23 | var SentryProfiling = FakeMetricBuilder{} 24 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/auxv.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package arch 16 | 17 | import ( 18 | "github.com/progrium/go-netstack/gvisor/pkg/hostarch" 19 | ) 20 | 21 | // An AuxEntry represents an entry in an ELF auxiliary vector. 22 | // 23 | // +stateify savable 24 | type AuxEntry struct { 25 | Key uint64 26 | Value hostarch.Addr 27 | } 28 | 29 | // An Auxv represents an ELF auxiliary vector. 30 | type Auxv []AuxEntry 31 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/netstack/netstack_state.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package netstack 16 | 17 | import ( 18 | "time" 19 | ) 20 | 21 | func (s *sock) saveTimestamp() int64 { 22 | s.readMu.Lock() 23 | defer s.readMu.Unlock() 24 | return s.timestamp.UnixNano() 25 | } 26 | 27 | func (s *sock) loadTimestamp(nsec int64) { 28 | s.readMu.Lock() 29 | defer s.readMu.Unlock() 30 | s.timestamp = time.Unix(0, nsec) 31 | } 32 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/socket/netstack/save_restore.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package netstack 16 | 17 | import ( 18 | "github.com/progrium/go-netstack/gvisor/pkg/tcpip/stack" 19 | ) 20 | 21 | // afterLoad is invoked by stateify. 22 | func (s *Stack) afterLoad() { 23 | s.Stack = stack.StackFromEnv // FIXME(b/36201077) 24 | if s.Stack == nil { 25 | panic("can't restore without netstack/tcpip/stack.Stack") 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/keyctl.go: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The gVisor Authors. 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 | // http://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 | 15 | package linux 16 | 17 | // Constants used by keyctl(2) and other keyrings-related syscalls. 18 | // Source: include/uapi/linux/keyctl.h 19 | 20 | const ( 21 | KEY_SPEC_SESSION_KEYRING = -3 22 | ) 23 | 24 | const ( 25 | KEYCTL_GET_KEYRING_ID = 0 26 | KEYCTL_JOIN_SESSION_KEYRING = 1 27 | KEYCTL_SETPERM = 5 28 | KEYCTL_DESCRIBE = 6 29 | ) 30 | -------------------------------------------------------------------------------- /gvisor/pkg/rand/rand.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build !linux 16 | // +build !linux 17 | 18 | // Package rand implements a cryptographically secure pseudorandom number 19 | // generator. 20 | package rand 21 | 22 | import "crypto/rand" 23 | 24 | // Reader is the default reader. 25 | var Reader = rand.Reader 26 | 27 | // Read implements io.Reader.Read. 28 | func Read(b []byte) (int, error) { 29 | return rand.Read(b) 30 | } 31 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/context_queue_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package systrap 16 | 17 | import ( 18 | "unsafe" 19 | 20 | "github.com/progrium/go-netstack/gvisor/pkg/abi/linux" 21 | "golang.org/x/sys/unix" 22 | ) 23 | 24 | func (q *contextQueue) wakeupSysmsgThread() { 25 | unix.RawSyscall6(unix.SYS_FUTEX, 26 | uintptr(unsafe.Pointer(&q.numThreadsToWakeup)), 27 | linux.FUTEX_WAKE, 1, 0, 0, 0) 28 | } 29 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/epoll_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package linux 19 | 20 | // EpollEvent is equivalent to struct epoll_event from epoll(2). 21 | // 22 | // +marshal slice:EpollEventSlice 23 | type EpollEvent struct { 24 | Events uint32 25 | // Linux makes struct epoll_event a __u64, necessitating 4 bytes of padding 26 | // here. 27 | _ int32 28 | Data [2]int32 29 | } 30 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/systrap/usertrap/usertrap_amd64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build amd64 4 | // +build amd64 5 | 6 | package usertrap 7 | 8 | import ( 9 | "github.com/progrium/go-netstack/gvisor/pkg/state" 10 | ) 11 | 12 | func (s *State) StateTypeName() string { 13 | return "pkg/sentry/platform/systrap/usertrap.State" 14 | } 15 | 16 | func (s *State) StateFields() []string { 17 | return []string{ 18 | "nextTrap", 19 | "tableAddr", 20 | } 21 | } 22 | 23 | func (s *State) beforeSave() {} 24 | 25 | // +checklocksignore 26 | func (s *State) StateSave(stateSinkObject state.Sink) { 27 | s.beforeSave() 28 | stateSinkObject.Save(0, &s.nextTrap) 29 | stateSinkObject.Save(1, &s.tableAddr) 30 | } 31 | 32 | func (s *State) afterLoad() {} 33 | 34 | // +checklocksignore 35 | func (s *State) StateLoad(stateSourceObject state.Source) { 36 | stateSourceObject.Load(0, &s.nextTrap) 37 | stateSourceObject.Load(1, &s.tableAddr) 38 | } 39 | 40 | func init() { 41 | state.Register((*State)(nil)) 42 | } 43 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/arch/arch_arm64_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | //go:build arm64 && arm64 && arm64 4 | // +build arm64,arm64,arm64 5 | 6 | package arch 7 | 8 | import ( 9 | "github.com/progrium/go-netstack/gvisor/pkg/state" 10 | ) 11 | 12 | func (c *Context64) StateTypeName() string { 13 | return "pkg/sentry/arch.Context64" 14 | } 15 | 16 | func (c *Context64) StateFields() []string { 17 | return []string{ 18 | "State", 19 | "sigFPState", 20 | } 21 | } 22 | 23 | func (c *Context64) beforeSave() {} 24 | 25 | // +checklocksignore 26 | func (c *Context64) StateSave(stateSinkObject state.Sink) { 27 | c.beforeSave() 28 | stateSinkObject.Save(0, &c.State) 29 | stateSinkObject.Save(1, &c.sigFPState) 30 | } 31 | 32 | func (c *Context64) afterLoad() {} 33 | 34 | // +checklocksignore 35 | func (c *Context64) StateLoad(stateSourceObject state.Source) { 36 | stateSourceObject.Load(0, &c.State) 37 | stateSourceObject.Load(1, &c.sigFPState) 38 | } 39 | 40 | func init() { 41 | state.Register((*Context64)(nil)) 42 | } 43 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/transport/internal/noop/noop_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package noop 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (ep *endpoint) StateTypeName() string { 10 | return "pkg/tcpip/transport/internal/noop.endpoint" 11 | } 12 | 13 | func (ep *endpoint) StateFields() []string { 14 | return []string{ 15 | "DefaultSocketOptionsHandler", 16 | "ops", 17 | } 18 | } 19 | 20 | func (ep *endpoint) beforeSave() {} 21 | 22 | // +checklocksignore 23 | func (ep *endpoint) StateSave(stateSinkObject state.Sink) { 24 | ep.beforeSave() 25 | stateSinkObject.Save(0, &ep.DefaultSocketOptionsHandler) 26 | stateSinkObject.Save(1, &ep.ops) 27 | } 28 | 29 | func (ep *endpoint) afterLoad() {} 30 | 31 | // +checklocksignore 32 | func (ep *endpoint) StateLoad(stateSourceObject state.Source) { 33 | stateSourceObject.Load(0, &ep.DefaultSocketOptionsHandler) 34 | stateSourceObject.Load(1, &ep.ops) 35 | } 36 | 37 | func init() { 38 | state.Register((*endpoint)(nil)) 39 | } 40 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/usage/memory_unsafe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | package usage 16 | 17 | import ( 18 | "unsafe" 19 | ) 20 | 21 | // RTMemoryStatsSize is the size of the RTMemoryStats struct. 22 | var RTMemoryStatsSize = unsafe.Sizeof(RTMemoryStats{}) 23 | 24 | // RTMemoryStatsPointer casts addr to a RTMemoryStats pointer. 25 | func RTMemoryStatsPointer(addr uintptr) *RTMemoryStats { 26 | return (*RTMemoryStats)(unsafe.Pointer(addr)) 27 | } 28 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/vdso_arm64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | #include "textflag.h" 16 | 17 | #define SYS_clock_gettime 113 18 | 19 | TEXT ·vdsoClockGettime(SB), NOSPLIT, $0-24 20 | MOVW clockid+0(FP), R0 21 | MOVD ts+8(FP), R1 22 | MOVD runtime·vdsoClockgettimeSym(SB), R2 23 | CBZ R2, fallback 24 | BL (R2) 25 | MOVD R0, ret+16(FP) 26 | RET 27 | fallback: 28 | MOVD $SYS_clock_gettime, R8 29 | SVC 30 | MOVD R0, ret+16(FP) 31 | RET 32 | -------------------------------------------------------------------------------- /gvisor/pkg/tcpip/ports/ports_state_autogen.go: -------------------------------------------------------------------------------- 1 | // automatically generated by stateify. 2 | 3 | package ports 4 | 5 | import ( 6 | "github.com/progrium/go-netstack/gvisor/pkg/state" 7 | ) 8 | 9 | func (f *Flags) StateTypeName() string { 10 | return "pkg/tcpip/ports.Flags" 11 | } 12 | 13 | func (f *Flags) StateFields() []string { 14 | return []string{ 15 | "MostRecent", 16 | "LoadBalanced", 17 | "TupleOnly", 18 | } 19 | } 20 | 21 | func (f *Flags) beforeSave() {} 22 | 23 | // +checklocksignore 24 | func (f *Flags) StateSave(stateSinkObject state.Sink) { 25 | f.beforeSave() 26 | stateSinkObject.Save(0, &f.MostRecent) 27 | stateSinkObject.Save(1, &f.LoadBalanced) 28 | stateSinkObject.Save(2, &f.TupleOnly) 29 | } 30 | 31 | func (f *Flags) afterLoad() {} 32 | 33 | // +checklocksignore 34 | func (f *Flags) StateLoad(stateSourceObject state.Source) { 35 | stateSourceObject.Load(0, &f.MostRecent) 36 | stateSourceObject.Load(1, &f.LoadBalanced) 37 | stateSourceObject.Load(2, &f.TupleOnly) 38 | } 39 | 40 | func init() { 41 | state.Register((*Flags)(nil)) 42 | } 43 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/cpuid_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package platform 19 | 20 | import ( 21 | "github.com/progrium/go-netstack/gvisor/pkg/context" 22 | "github.com/progrium/go-netstack/gvisor/pkg/sentry/arch" 23 | ) 24 | 25 | // TryCPUIDEmulate always returns false: there is no cpuid. 26 | func TryCPUIDEmulate(ctx context.Context, mm MemoryManager, ac *arch.Context64) bool { 27 | return false 28 | } 29 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/platform/kvm/address_space_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The gVisor Authors. 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 | // http://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 | 15 | package kvm 16 | 17 | // invalidate is the implementation for Invalidate. 18 | func (as *addressSpace) invalidate() { 19 | timer := asInvalidateDuration.Start() 20 | as.dirtySet.forEach(as.machine, func(c *vCPU) { 21 | if c.active.get() == as { // If this happens to be active, 22 | c.BounceToKernel() // ... force a kernel transition. 23 | } 24 | }) 25 | timer.Finish() 26 | } 27 | -------------------------------------------------------------------------------- /gvisor/pkg/abi/linux/sem_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | package linux 19 | 20 | // SemidDS is equivalent to struct semid64_ds. 21 | // 22 | // Source: arch/x86/include/uapi/asm/sembuf.h 23 | // 24 | // +marshal 25 | type SemidDS struct { 26 | SemPerm IPCPerm 27 | SemOTime TimeT 28 | unused1 uint64 29 | SemCTime TimeT 30 | unused2 uint64 31 | SemNSems uint64 32 | unused3 uint64 33 | unused4 uint64 34 | } 35 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/kernel/ptrace_arm64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The gVisor Authors. 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 | // http://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 | 15 | //go:build arm64 16 | // +build arm64 17 | 18 | package kernel 19 | 20 | import ( 21 | "github.com/progrium/go-netstack/gvisor/pkg/errors/linuxerr" 22 | "github.com/progrium/go-netstack/gvisor/pkg/hostarch" 23 | ) 24 | 25 | // ptraceArch implements arch-specific ptrace commands. 26 | func (t *Task) ptraceArch(target *Task, req int64, addr, data hostarch.Addr) error { 27 | return linuxerr.EIO 28 | } 29 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/sampler_amd64.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | //go:build amd64 16 | // +build amd64 17 | 18 | package time 19 | 20 | const ( 21 | // defaultOverheadTSC is the default estimated syscall overhead in TSC cycles. 22 | // It is further refined as syscalls are made. 23 | defaultOverheadCycles = 1 * 1000 24 | 25 | // maxOverheadCycles is the maximum allowed syscall overhead in TSC cycles. 26 | maxOverheadCycles = 100 * defaultOverheadCycles 27 | ) 28 | -------------------------------------------------------------------------------- /gvisor/pkg/sentry/time/tsc_amd64.s: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The gVisor Authors. 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 | // http://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 | 15 | #include "textflag.h" 16 | 17 | TEXT ·Rdtsc(SB),NOSPLIT|NOFRAME,$0-8 18 | // N.B. We need LFENCE on Intel, AMD is more complicated. 19 | // Modern AMD CPUs with modern kernels make LFENCE behave like it does 20 | // on Intel with MSR_F10H_DECFG_LFENCE_SERIALIZE_BIT. MFENCE is 21 | // otherwise needed on AMD. 22 | LFENCE 23 | RDTSC 24 | SHLQ $32, DX 25 | ADDQ DX, AX 26 | MOVQ AX, ret+0(FP) 27 | RET 28 | --------------------------------------------------------------------------------