asterinas/services/libs/comp-sys/cargo-component
Jianfeng Jiang faaa4438d6 License rust and c source files 2024-01-18 08:22:58 +08:00
..
analysis License rust and c source files 2024-01-18 08:22:58 +08:00
src License rust and c source files 2024-01-18 08:22:58 +08:00
tests License rust and c source files 2024-01-18 08:22:58 +08: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 License rust and c source files 2024-01-18 08:22:58 +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.