asterinas/services/libs/comp-sys/cargo-component
Jianfeng Jiang 7b7e3c4b7a Rename the path of dependent crates 2023-12-26 11:49:24 +08:00
..
analysis Reorganize the codebase 2023-04-10 14:49:39 +08:00
src Reorganize the codebase 2023-04-10 14:49:39 +08:00
tests Switch to EFI boot and use official release for QEMU and GDB 2023-10-12 14:38:36 -05:00
.gitignore Reorganize the codebase 2023-04-10 14:49:39 +08:00
Cargo.lock Reorganize the codebase 2023-04-10 14:49:39 +08:00
Cargo.toml Reorganize the codebase 2023-04-10 14:49:39 +08:00
README.md Rename the path of dependent crates 2023-12-26 11:49:24 +08:00
build.rs Reorganize the codebase 2023-04-10 14:49:39 +08:00
rust-toolchain.toml Reorganize the codebase 2023-04-10 14:49:39 +08:00

README.md

Overview

The crate contains cargo-component, a cargo subcommand to enable component-level access control in Asterinas. For more info about Asterinas component system, see the RFC. The implementation mainly follows rust clippy. Internally, this tool will call cargo check to compile the whole project and bases the analysis on MIR.

install

After running make setup for Asterinas, this crate can be created with cargo.

cargo install --path .

This will install two binaries cargo-component and component-driver at $HOME/.cargo/bin(by default, it depends on the cargo config).

Usage

Use cargo component or cargo component check or cargo component audit. The three commands are the same now. For Asterinas, we shoud use another alias command cargo component-check, which was defined in src/.cargo/config.toml.

Two notes:

  • The directory where you run the command should contains a Components.toml config file, where defines all components and whitelist.
  • The project checked by cargo-component should use the same rust-toolchain as cargo-component, which was defined in rust-toolchain.toml.

Known limitations

This tool uses rustc private APIs, which is highly unstable. So if the rust toolchain is updated, the tool may need updates too.