Giter Club home page Giter Club logo

jinzhao-disk's Introduction

asterinas-logo
A secure, fast, and general-purpose OS kernel written in Rust and compatible with Linux
Test OSDK Test Asterinas Benchmark Asterinas

English | 中文版

Introducing Asterinas

Asterinas is a secure, fast, and general-purpose OS kernel that provides Linux-compatible ABI. It can serve as a seamless replacement for Linux while enhancing memory safety and developer friendliness.

  • Asterinas prioritizes memory safety by employing Rust as its sole programming language and limiting the use of unsafe Rust to a clearly defined and minimal Trusted Computing Base (TCB). This innovative approach, known as the framekernel architecture, establishes Asterinas as a more secure and dependable kernel option.

  • Asterinas surpasses Linux in terms of developer friendliness. It empowers kernel developers to (1) utilize the more productive Rust programming language, (2) leverage a purpose-built toolkit called OSDK to streamline their workflows, and (3) choose between releasing their kernel modules as open source or keeping them proprietary, thanks to the flexibility offered by MPL.

While the journey towards a production-grade OS kernel can be challenging, we are steadfastly progressing towards our goal. Currently, Asterinas only supports x86-64 VMs. However, our aim for 2024 is to make Asterinas production-ready on x86-64 VMs.

Getting Started

Get yourself an x86-64 Linux machine with Docker installed. Follow the three simple steps below to get Asterinas up and running.

  1. Download the latest source code.
git clone https://github.com/asterinas/asterinas
  1. Run a Docker container as the development environment.
docker run -it --privileged --network=host --device=/dev/kvm -v $(pwd)/asterinas:/root/asterinas asterinas/asterinas:0.8.3
  1. Inside the container, go to the project folder to build and run Asterinas.
make build
make run

If everything goes well, Asterinas is now up and running inside a VM.

The Book

See The Asterinas Book to learn more about the project.

License

Asterinas's source code and documentation primarily use the Mozilla Public License (MPL), Version 2.0. Select components are under more permissive licenses, detailed here. For the rationales behind the choice of MPL, see here.

jinzhao-disk's People

Contributors

cqs21 avatar stanplatinum avatar tatetian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

jinzhao-disk's Issues

Problems may occur if jindisk target is mapped to a non-zero offset of host device

We may use dmsetup to create a target:

$ echo <begin> <len> <target_name> <args> | sudo dmsetup create <device_name>

If sector is non-zero value, sector offset taken relative to the start of the target will not be equal to the relative to the start of the real device. We should check if JinDisk handles this situation properly.

Add an IOCTL interface to get the hash measurement of a JinDisk device

It is important that the guest owner can verify everything about his/her VM is running as expected during the RA.

The measurement hashes of the guest VM's kernel, initrd, and cmdline are included in TDX/SEV-SNP's attestation report. But, currently the rootfs of the guest image is not measured when we use JinDisk to protect the rootfs. (AMDESE/sev-guest#10)

So, it would be nice if a JinDisk-encrypted device could be measured against an expected measurement value. The value can be an HMAC of the whole disk.

Unable to locate package zlibc when installing the kernel module

The readme in kernel-module indicates that the following dependencies should be installed for building the dm-jindisk kernel module.

sudo apt install dpkg-dev libncurses5-dev openssl libssl-dev build-essential pkg-config libc6-dev libc6-dev flex libelf-dev zlibc minizip libidn11-dev libidn11-dev bison dwarves

But, the zlibc cannot be located on Ubuntu 22.04.

Actually, we don't need zlibc to build the kernel module. I have tested it without the zlibc support many times.
Can we remove it?

实现Recovery功能

启动时,根据journal records实现recovery:

  • 找到最新的checkpoint_pack记录,恢复SVT/DST/RIT/BITC等;
  • 找到未commit的其他journal record,判断是否需要redo;

重新设计磁盘初始化参数

当前参数存在不足:

  • 传入root key(mac/iv),对superblock,journal,RIT/BITC进行加密保护;
  • 控制磁盘格式化等

Make a more elegant step-by-step guide of the encrypted-VM-image demo

Todo

  • Preparing a JinDisk-installed VM image and making it public
  • A script that launches a secure VM
  • A script that can insert host files into a VM image (for inserting RA components)
  • A script that runs on the host to convert the reference image into a JinDisk-encrypted image
  • Re-writing the step-by-step guide

Improve and polish the docs of setup-tool

Here are some concrete suggestions to Improve and polish the docs of setup-tool.

  • Fix spelling and grammar mistakes. I recommend writing auto tools (e.g., grammar.ly).
  • Use JinDisk as the project name consistently (no Jindisk or jindisk or jin-disk or sworndisk).
  • Revise the docs according to the new code structure proposed in #14
  • Improve the doc content, with the mindset of positioning this project as a well-maintained open-source projects, rather than a half-baked research prototype.

设计实现journal region

journal region需要记录五种类型的record:

  • data log,当向磁盘data region写入数据时记录;
  • data commit,当主动触发flush操作时记录;
  • bit compaction,当触发一次compaction操作时记录;
  • bit node,当向磁盘index region写入数据时记录;
  • checkpoint pack,当向磁盘checkpoint region写入数据时记录

Separate the setup tool from the encrypted VM image demo

Problem

Currently, the directory setup-tool contains three sub-directories:

  • guess-owner-tool/
  • initramfs-hook-ubuntu/
  • src/c/

This code organization is a bit of confusing because it actually mixes up two sub-projects:

  1. The setup tool (src/c/), which is JinDisk's user-space CLI tool, and
  2. The encrypted VM image demo (guess-owner-tool/ and initramfs-hook-ubuntu/), which uses the guess owner tool, the initramfs hooks, and some other scripts to demonstrate how a JinDisk-encrypted VM guess image can be created and used.

I call the latter one a demo, instead of a tool, because the codebase contains some hardcoded parameters (e.g., file paths, QEMU parameters) and specific components (e.g., remote attestation programs) that are likely to be extended or modified in a case-by-case manner.

Proposal

Refactor the code structure as follows:

  • kernel-module/: Unchanged.
  • user-tools/: The old setup-tools. The new of the directory name emphasizes two things: (1) opposite to the kernel-module, this directory is for user space. (2) it contains all user-space tools for JinDisk.
    • setup-tool/: The original setup-tool.
    • install-kernel-module.sh: One of the in-guest tool, which seems to be useful for all JinDisk users, regardless of whether they are interested in the encrypted VM image demo.
    • install-setup-tool.sh: same as above.
  • demos/: A new directory, contains all demos for JinDisk.
    • encrypted-VM-image: The old setup-tool/guess-owner-tool/, setup-tool/initramfs-hook-ubuntu/, plus other files.

Using ioctl to calculate available sectors instead of sysfs

Note that the capacity of a JinDisk logical block device must be less than that of the underlying untrusted block device. This is because some storage space of the untrusted block device is consumed by JinDisk to store metadata, instead of user data.

Hence, JinDisk provides a sysfs interface to calculate the maximum capacity of a JinDisk instance that may be created on the untrusted block device.

$ sudo echo <untrusted_dev_sectors> > /sys/module/jindisk/calc_avail_sectors
$ sudo cat /sys/module/jindisk/calc_avail_sectors

However, this function is only needed by the jindisksetup tool, not all normal users. In addition, race condition may also yield incorrect result.

Explain the simplest commands to test a JinDisk device

In JinDisk's kernel module README, we should add a section, after creating a JinDisk device, how to to test a JinDisk device in the simplest and quickest way. One way is to use dd. The other way is to mount a file system on the block device, do some read and write, and unmount the file system.

合并磁盘

当前使用了两次磁盘,分别用来保存数据和元数据;并且使用了不同方式读写底层设备,期望使用一块磁盘并统一设备访问接口

  • data_dev: data region
  • meta_dev: superblock region, index region, journal region, checkpoint region (SVT/DST/RIT/BITC)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.