oxidecomputer / oxidecomputer/opte

add banner to Cargo.toml about dep sanitation

Open
#105 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
77
Forks
11
Avg merge
9d 20h
Merged PRs (30d)
8

Description

Add a banner to Cargo.toml for all packages that contribute to the kernel module warning to give careful thought to adding/changing dependencies. The main thing to keep in mind, which drives the rest of the considerations, is that this code is going to run in kernel context, and some of it will even run in interrupt context -- you must think about where in opte-core/xde this code is running and what context that might put it in.

  • Does it do anything whacky like implement spin loops? If so do you really trust that? And even if you do trust it you sure you want a third-party-crate spin loop potentially running in the NIC Rx interrupt handler? You could bring the entire sled to a screeching halt. Do you want ants? Because this is how you get ants 🐜.
  • Does this dep call unwrap()/expect()/assert!()/panic!/etc anywhere? If it does it means crashing the kernel and thus taking down all running guests on the sled with it 🥳 🎈.
  • If you are only using this crate in a handful or places, or just one feature feature from it, how much work would it be to just write the equivalent code from scratch? Keep in mind that each dep adds to the kernel module object size. Especially if this dep brings in a lot of transitive deps, which can quickly blow up the size.
  • What are the minimal number of features you need from this dep? Set the feature flags to be as minimal as possible.
  • Is this crate/feature making use of floating point? If so it cannot be included as that's not allowed in-kernel.
  • Probably other dragons in this cave I'm not thinking of.

There is one main exception to this: bringing in a dep for the purpose of providing a std env equivalent implementation of a kernel API that opte-core/xde is using. That is, a dep that is only used when opte-core's std feature flag is set.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the Cargo.toml files for packages contributing to the opte-core/xde kernel module and determine which manifests need the warning. Add the dependency-safety banner while preserving the stated exception for dependencies used only with opte-core's std feature; done means every applicable manifest documents these constraints.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation, operating-systems
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.