摘要:执行一个信号处理程序是件相当复杂的任务,因为在用户态和内核态之间切换时需要谨慎地处理栈中的内容。 信号处理程序是用户态进程所定义的函数,并包含在用户态的代码段中。handle_signal( )函数运行在内核态而信号处理程序运行在用户态,这就意味着在当前进程恢复 “正常”执行之前,它必须首先执行用户
阅读全文
摘要:https://david942j.blogspot.com/2018/10/note-learning-kvm-implement-your-own.html int main() { /* movabs rax, 0x0a33323144434241 push 8 pop rcx mov edx
阅读全文
摘要:trampoline 页表是用于PTI(Page Table Isolation) 背景 2018,可视作CPU发展历史的重要节点,就是因为爆出了影响范围最广的源自CPU硬件设计的安全漏洞:Meltdown和Spectre,有关这两个漏洞说明,参见我的其他文章。而本文的焦点pti,即专门用于miti
阅读全文
摘要:zircon代码下载 https://fuchsia.googlesource.com/fuchsia/+/refs/heads/master/zircon/ git clone https://github.com/timniederhausen/gn.git gn的编译需要使用clang编译器,
阅读全文
摘要:https://github.com/google/gvisor/tree/master/pkg/sentry/fs VFS2 addresses this by delegating path resolution to the filesystem, making it possible to
阅读全文
摘要:Kernel setup runsc/boot/loader.go There are two kernel structs, kernel.Kernel and ring0.Kernel. kernel.Kernel contains most of kernel data structures
阅读全文
摘要:gVisor accesses the filesystem through a file proxy, called the Gofer. The gofer runs as a separate process, that is isolated from the sandbox. Gofer
阅读全文
摘要:root@cloud:~/onlyGvisor# ps -elf | grep docker 4 S root 926586 1 0 80 0 - 1393268 futex_ Jan14 ? 00:09:48 /usr/bin/dockerd -H fd:// --containerd=/run/
阅读全文
摘要:runsc --vfs2 do echo 123 123
阅读全文
摘要:The Sentry runs in both GR0 and HR3. The bluepill code is responsible for transparently bouncing the Sentry between these two modes, with the followin
阅读全文
摘要:// R0 - The signal number. // R1 - Pointer to siginfo_t structure. // R2 - Pointer to ucontext structure. // TEXT ·sighandler(SB),NOSPLIT,$0 // si_sig
阅读全文
摘要:go源码中关于系统调用的定义如下: func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintp
阅读全文
摘要:KVM is an acronym of “Kernel based Virtual Machine”, and is a virtualization infrastructure for the Linux kernel that turns it into a hypervisor.It is
阅读全文
摘要:https://www.it610.com/article/1175051551228637184.htm TCP发送流程 third_party\golibs\github.com\google\netstack\tcpip\transport\tcp\snd.go sendData maybeS
阅读全文
摘要:Files in the sandbox may be backed by different implementations. For host-native files (where a file descriptor is available), the Gofer may return a
阅读全文
摘要:https://github.com/google/gvisor/issues/1397 #include <sys/socket.h> #include <sys/un.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #i
阅读全文
摘要:https://github.com/google/gvisor/issues/1397 pkg/sentry/syscalls/linux/sys_socket.go root@cloud:~/onlyGvisor/gvisor# docker exec -it test ping 8.8.8.8
阅读全文
摘要:是一个虚拟化的题目,在2018 hitcon abyss改编的题目。这里给出了三个文件hellovirtual,hellokernel,hellousr,还给出了ld.so.2,libc.so.6。 hellovirtual是一个利用KVM api来做虚拟化的程序,它会加载一个小型的内核hellok
阅读全文
摘要:目前Go语言支持GDB、LLDB和Delve几种调试器。其中GDB是最早支持的调试工具,LLDB是macOS系统推荐的标准调试工具。但是GDB和LLDB对Go语言的专有特性都缺乏很大支持,而只有Delve是专门为Go语言设计开发的调试工具。而且Delve本身也是采用Go语言开发,对Windows平台
阅读全文
摘要:参考资料: Playing with ptrace, Part I Playing with ptrace, Part II 这两篇文章里的代码都是在x86平台上运行的,本文中将其移植到了x86_64平台。 ptrace提供让一个进程来控制另一个进程的能力,包括检测,修改被控制进程的代码,数据,寄存
阅读全文
摘要:KVM 基础知识 kvm是一个内核模块,它实现了一个/dev/kvm的字符设备来与用户进行交互,通过调用一系列ioctl函数可以实现qemu和kvm之间的切换。 KVM结构体 KVM结构体在 KVM的系统架构中代表一个具体的虚拟机,当通过 VM_CREATE_KVM 指令创建一个新的 KVM结构体对
阅读全文
摘要:主要参考的文章是david942j@217的这篇博客和这篇介绍。 在做abyss这个题目的时候涉及到了很多hypervisor, kvm的内容。虚拟化这一层一般也是我们在逃逸的最后一层了。 Basic Intro KVM的全称是Kernel Base Virtual Machine,基于内核的虚拟机
阅读全文
摘要:KVM is a virtualization technology that comes with the Linux kernel. In other words, it allows you to run multiple virtual machines (VMs) on a single
阅读全文
摘要:一、背景知识 介绍:KVM 全称是 基于内核的虚拟机(Kernel-based Virtual Machine),它是Linux 的一个内核模块,该内核模块使得 Linux 变成了一个 Hypervisor。 KVM架构:KVM 是基于虚拟化扩展(Intel VT 或者 AMD-V)的 X86 硬件
阅读全文
摘要:root@cloud:~# docker exec -it test ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes 64 bytes from 8.8.8.8: seq=0 ttl=42 time=56.182 ms 64 bytes from
阅读全文
摘要:https://www.cnblogs.com/realjimmy/p/13418508.html golang 安装 tar -xvf go1.15.2.linux-arm64.tar.gz -C /usr/local/go [root@centos7 ~]# ls /usr/local/go g
阅读全文
摘要:Stack traces Debugger Profiling Docker Proxy To enable debug and system call logging, add the runtimeArgs below to your Docker configuration (/etc/doc
阅读全文
摘要:Go 中 Syscall 的实现,在汇编文件 syscall/asm_linux_amd64.s 中 // func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64); // Trap # in AX, args in DI SI D
阅读全文
摘要:实验平台i386,linux kernel版本:2..6.22(之后版本原理都是一样) 首先上一副图: 首先知道cpu看到的都是虚拟地址,CR3寄存器,页表中都是存的物理地址,通过MMU把虚拟地址映射到页表中的物理地址,这幅图说的很清楚了,接下来要获取到sys_call_table在内核中的内存地址
阅读全文
摘要:instruction set to provide isolation of resources at hardware level. Since Qemu is a userspace process, the kernel treats it like other processes from
阅读全文
摘要:在Linux中,大家应该对syscall非常的了解和熟悉,其是用户态进入内核态的一种途径或者说是一种方式,完成了两个模式之间的切换; 而在虚拟环境中,有没有一种类似于syscall这种方式,能够从no root模式切换到root模式呢?答案是肯定的,KVM提供了Hypercall机制, x86体系架
阅读全文
摘要:https://chengyi818.gitbooks.io/fat-cheng-s-xv6-journey/content/LEC_21/LEC_21.html https://www.usenix.org/conference/osdi12/technical-sessions/presenta
阅读全文
摘要:简介 Dune是一种能为应用程序提供直接但安全访问硬件能力(比如页表、快表等等)的系统。其在现代处理器中使用虚拟化硬件来提供过程,而非机器抽象。它由一个小型内核模块组成,该模块初始化虚拟化硬件并协调与内核的交互,以及一个帮助应用程序管理特权硬件功能的用户级库。 Dune提供了一个可加载的内核模块,可
阅读全文
摘要:gVisor 是沿着 libdune 的系统调用拦截思路发展而来的用户态内核或进程虚拟化技术。 – HW performs transiAons between modes • VM Exit -> trap to hypervisor (enter host mode) • VM Enter ->
阅读全文
摘要:https://terassyi.net/posts/2020/04/14/gvisor.html Sentry 复用了 go 语言的 GMP 模型 [3]。每个应用的线程均对应到 go 语言内置的 goroutine(参见 kernle.Task.Start 函数),即 G。go runtime
阅读全文
摘要:今天在翻阅Golang代码时,发现了Golang调用汇编代码的方法(详见pkg/bytes)。大概要做三件事,我以用汇编实现一个判断字符串是否相等的方法Equal为例,测试一下: 准备工作,创建工程目录: asm_demo |--bin |--pkg |--src | |--strlib | |--
阅读全文
摘要:1. Overview: no interrupts, no devices, no io tasks are goroutines 2. syscall: sentry can run in non-root(ring0) and root(ring3). userapp's syscall ar
阅读全文
摘要:How are Sentry system calls trapped into host kernel?From How gvisor trap to syscall handler in kvm platform, “Note that the SYSCALL instruction (Wenb
阅读全文
摘要:The rapid pace of innovation in datacenters and the software platforms within them has transformed how companies build, deploy, and manage online appl
阅读全文
摘要:Container technologies and especially Docker has become the go-to standard for how to package and deploy microservices. It makes for a lightweight, fl
阅读全文
摘要:https://www.cnblogs.com/liujunjun/p/12444772.html In contrast to container, the concept Virtual Machine represents another category of isolated execut
阅读全文
摘要:5 月 2 日,谷歌发布了一款新型的沙箱容器运行时 gVisor,号称能够为容器提供更安全的隔离,同时比 VM 更轻量。容器基于共享内核,安全性是大家关注的一大要点,gVisor 的发布势必将引来更多对容器隔离性的关注。那么 gVisor 在技术上如何实现隔离,其性能如何?隔壁阿里巴巴已经有人为你探
阅读全文
摘要:gvisor/pkg/sentry/platform/platform.go // platforms contains all available platform types. var platforms = map[string]Constructor{} // Register regist
阅读全文
摘要:https://nanikgolang.netlify.app/post/runsc/ gvisor Oct 2, 2020 19 minutes read This article will explain about the container runtime called gvisor. Th
阅读全文
摘要:https://christine.website/blog/howto-usermode-linux-2019-07-07 https://christine.website/blog/howto-usermode-linux-2019-07-07 User Mode Linux is a por
阅读全文
摘要:User Mode Linux 可以在用户态启动一个 Linux。这使我们能在类似 OpenVZ 虚拟化技术的系统上,使用最新的 Linux 内核;甚至可以在非 root 用户下启动。 但有些 OpenVZ VPS 的 TOS 可能不允许你这么做;另外,这样可能会有一定的性能损失。 准备 rootf
阅读全文
摘要:https://terassyi.net/posts/2020/04/14/gvisor.html Wenbo Shen 申文博 https://wenboshen.org/posts/2018-12-25-gvisor-inside.html System calls For Linux kern
阅读全文
摘要:gVisor 容器 它的原理,可以用如下所示的示意图来表示清楚。 gVisor 的设计原理 gVisor 工作的核心,在于它为应用进程(用户容器),启动了一个名叫 Sentry 的进程。 而 Sentry 进程的主要职责,就是提供一个传统的操作系统内核的能力,即:运行用户程序,执行系统调用。所以说,
阅读全文
摘要:什么是vdso? vdso是virtual ELF dynamic shared object的缩写,即虚拟动态共享库,其实就是“虚拟的so库”。根据linux手册https://man7.org/linux/man-pages/man7/vdso.7.html的介绍,vdso是内核中内置的一个so
阅读全文
摘要:以软中断或指令方式执行的系统调用,需要切换到内核空间,无论采用早期的int 0x80/iret中断,还是sysenter/sysexit指令,再到syscall/sysexit指令,是一个比较慢的操作。例如像gettimeofday()这种,若每次为了从内核读取时间值而都切换上下文的话,成本就太高了
阅读全文
摘要:curl https://mirrors.huaweicloud.com/bazel/3.7.1/bazel-3.7.1-linux-arm64 --output bazel-3.7.1-linux-arm64
阅读全文
摘要:Bazel 国内镜像源加速下载: https://mirrors.huaweicloud.com/bazel/ root@cloud:/gvisor# bazel version Build label: 3.7.1 Build target: bazel-out/aarch64-opt/bin/s
阅读全文
摘要:Go 技巧分享:Go 国内加速镜像 0 个改进 651 说明 众所周知,国内网络访问国外资源经常会出现不稳定的情况。 Go 生态系统中有着许多中国 Gopher 们无法获取的模块,比如最著名的 golang.org/x/...。并且在中国大陆从 GitHub 获取模块的速度也有点慢。 因此设置 CD
阅读全文
摘要:gvisor简介 gvisor是google新推出一款沙箱运行时,他可以和docker和k8s无缝连接。 gVisor能够在保证轻量化优势的同时,提供与虚拟机类似的隔离效果。gVisor的核心为一套运行非特权普通进程的内核, 且支持大多数Linux系统调用。该内核使用Go编写,这主要是考虑到Go语言
阅读全文
摘要:https://cloud.tencent.com/developer/article/1620862 // use std::thread; // fn main() { // let child = thread::spawn(move || { // println!("Hello, I am
阅读全文
摘要:In my previous blog post I described gVisor as 'some stuff I hardly can really understand'. Technology is not only about code, understanding where it
阅读全文
摘要:Monolithic Kernel 相信只要是接触过计算机的,一定对『内核』这两个字不会陌生。只要在使用电脑的时候,都离不开跟内核打交道。无论是Windows还是Linux等等,这些寻常使用的操作系统,都是用内核和管理和使用硬件的。 在这其中,最有名的是Linux Kernel,最早是由Linus实
阅读全文
摘要:引言: 2016年1月21日,应用容器引擎 Docker 宣布收购了英国的 unikernel 实现初创企业 Unikernel System,但具体交易金额并未透露。那么unikernel到底是一种什么样的技术呢?它会对现有技术产生怎样的影响呢?Unikernel是什么:Unikernels ar
阅读全文
摘要:https://www.cnblogs.com/longronglang/p/8453047.html 1、编辑README文件 大标题(一级标题):在文本下面加等于号,那么上方的文字就变成了大标题,等于号的个数无限制,但一定要大于0 大标题 中标题(二级标题):在文本下面加下划线,那么上方的文本就
阅读全文
摘要:gdb cloud-hypervisor /data1/core/core-virtio_rng-291579_1609745784 GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git Copyright (C) 2018 Free Software
阅读全文
摘要:单元测试 测试(test)是这样一种 Rust 函数:它保证其他部分的代码按照所希望的行为正常 运行。测试函数的函数体通常会进行一些配置,运行我们想要测试的代码,然后 断言(assert)结果是不是我们所期望的。 大多数单元测试都会被放到一个叫 tests 的、带有 #[cfg(test)] 属性
阅读全文
摘要:条件编译可以通过两种不同的操作符实现,如下: - cfg属性:在属性位置中使用#[cfg(...)] - cfg!宏:在布尔表达式中使用cfg!(...) Configuration conditional checks are possible through two different oper
阅读全文