diff --git a/.cargo/config b/.cargo/config
index 2dab26c07c5..389e0f9fa3c 100644
--- a/.cargo/config
+++ b/.cargo/config
@@ -1,5 +1,6 @@
[build]
target = "x86_64-unknown-linux-musl"
+target-dir = "build/cargo_target"
[target.'cfg(any(target_arch="arm", target_arch="aarch64"))']
# On aarch64 musl depends on some libgcc functions (i.e `__addtf3` and other `*tf3` functions) for logic that uses
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 503ee4eb848..b5c720d97f8 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -13,12 +13,12 @@ the terms of the Apache 2.0 license.
## PR Checklist
-`[Author TODO: Meet these criteria. Where there are two options, keep one.]`
+`[Author TODO: Meet these criteria. Where there are two options, keep one.]`
`[Reviewer TODO: Verify that these criteria are met. Request changes if not]`
- [ ] All commits in this PR are signed (`git commit -s`).
- [ ] Either this PR is linked to an issue, or, the reason for this PR is
- clearly provided.
+ clearly provided.
- [ ] The description of changes is clear and encompassing.
- [ ] Either no docs need to be updated as part of this PR, or, the required
doc changes are included in this PR. Docs in scope are all `*.md` files
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 734a96c22d0..f8af9d7e68b 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -3,6 +3,6 @@
This project has adopted the
[Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
For more information see the
-[Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
+[Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
[opensource-codeofconduct@amazon.com](mailto:opensource-codeofconduct@amazon.com)
with any additional questions or comments.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9afc3de814c..8a7634dae38 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -23,7 +23,7 @@ commit-based feedback for a contribution, follow the
Firecracker uses the “fork-and-pull” development model. Follow these steps if
you want to merge your changes to Firecracker:
-1. Within your fork of
+1. Within your fork of
[Firecracker](https://github.com/firecracker-microvm/firecracker), create a
branch for your contribution. Use a meaningful name.
1. Create your contribution, meeting all
@@ -43,7 +43,7 @@ you want to merge your changes to Firecracker:
If you just want to receive feedback for a contribution proposal, open an “RFC”
(“Request for Comments”) pull request:
-1. On your fork of
+1. On your fork of
[Firecracker](https://github.com/firecracker-microvm/firecracker), create a
branch for the contribution you want feedback on. Use a meaningful name.
1. Create your proposal based on the existing codebase.
@@ -74,4 +74,3 @@ testing. Your contribution needs to meet the following standards:
part of your contribution contravenes this license by signing off on all your
commits with `git -s`. Ensure that every file in your pull request has a
header referring to the repository license file.
-
diff --git a/Cargo.lock b/Cargo.lock
index f875c6ff70b..723ddaa4249 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,9 +2,9 @@
# It is not intended for manual editing.
[[package]]
name = "aho-corasick"
-version = "0.6.10"
+version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
+checksum = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
dependencies = [
"memchr",
]
@@ -50,9 +50,9 @@ version = "0.1.0"
[[package]]
name = "backtrace"
-version = "0.3.35"
+version = "0.3.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1371048253fa3bac6704bfd6bbfc922ee9bdcee8881330d40f308b81cc5adc55"
+checksum = "924c76597f0d9ca25d762c25a4d369d51267536465dc5064bdf0eb073ed477ea"
dependencies = [
"backtrace-sys",
"cfg-if",
@@ -62,9 +62,9 @@ dependencies = [
[[package]]
name = "backtrace-sys"
-version = "0.1.31"
+version = "0.1.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b"
+checksum = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491"
dependencies = [
"cc",
"libc",
@@ -78,9 +78,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
[[package]]
name = "byteorder"
-version = "1.2.1"
+version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23"
+checksum = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
[[package]]
name = "c2-chacha"
@@ -93,9 +93,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.0.46"
+version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0213d356d3c4ea2c18c40b037c3be23cd639825c18f25ee670ac7813beeef99c"
+checksum = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
[[package]]
name = "cfg-if"
@@ -161,9 +161,9 @@ dependencies = [
[[package]]
name = "epoll"
-version = "4.0.1"
+version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3f0680f2a6f2a17fa7a8668a27c54e45e1ad1cf8a632f56a7c19b9e4e3bbe8a"
+checksum = "990bcfe26bea89669ede68c3f970f61d02568dbc8660317c98d805ea4e710685"
dependencies = [
"bitflags",
"libc",
@@ -176,7 +176,6 @@ dependencies = [
"api_server",
"backtrace",
"clap",
- "jailer",
"libc",
"logger",
"mmds",
@@ -224,9 +223,9 @@ dependencies = [
[[package]]
name = "kvm-bindings"
-version = "0.1.1"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c223e8703d2eb76d990c5f58e29c85b0f6f50e24b823babde927948e7c71fc03"
+checksum = "d381156ad52005b4655a9421401f02b80f9f049e653496e3ea6639a83fc12453"
[[package]]
name = "kvm-ioctls"
@@ -247,9 +246,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.64"
+version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74dfca3d9957906e8d1e6a0b641dc9a59848e793f1da2165889fd4f62d10d79c"
+checksum = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8"
[[package]]
name = "log"
@@ -317,9 +316,9 @@ checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
[[package]]
name = "proc-macro2"
-version = "1.0.5"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0"
+checksum = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
dependencies = [
"unicode-xid",
]
@@ -392,15 +391,14 @@ checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
[[package]]
name = "regex"
-version = "1.0.6"
+version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467"
+checksum = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
- "utf8-ranges",
]
[[package]]
@@ -439,15 +437,15 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.101"
+version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd"
+checksum = "1217f97ab8e8904b57dd22eb61cde455fa7446a9c1cf43966066da047c1f3702"
[[package]]
name = "serde_derive"
-version = "1.0.101"
+version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
+checksum = "a8c6faef9a2e64b0064f48570289b4bf8823b7581f1d6157c1b52152306651d0"
dependencies = [
"proc-macro2",
"quote",
@@ -456,9 +454,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.41"
+version = "1.0.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2"
+checksum = "1a3351dcbc1f067e2c92ab7c3c1f288ad1a4cffc470b5aaddb4c2e0a3ae80043"
dependencies = [
"itoa",
"ryu",
@@ -467,9 +465,9 @@ dependencies = [
[[package]]
name = "syn"
-version = "1.0.5"
+version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
+checksum = "661641ea2aa15845cddeb97dad000d22070bb5c1fb456b96c1cba883ec691e92"
dependencies = [
"proc-macro2",
"quote",
@@ -529,12 +527,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
-[[package]]
-name = "utf8-ranges"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
-
[[package]]
name = "utils"
version = "0.1.0"
@@ -579,9 +571,9 @@ dependencies = [
[[package]]
name = "vmm-sys-util"
-version = "0.2.0"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b75440f66b299f66acf005431d5f13be6e6a8d02b4dcaa83be5144e88762d010"
+checksum = "6ebb6ba7ba5653b69bfd3fab8c8c363945c0d3f616a6a1592e12122c3be4724e"
dependencies = [
"libc",
]
diff --git a/Cargo.toml b/Cargo.toml
index b65a4dd9be7..799712f7f1d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,30 +1,9 @@
-[package]
-name = "firecracker"
-version = "0.19.0"
-authors = ["Amazon Firecracker team "]
-
-[dependencies]
-backtrace = {version = "=0.3.35", features = ["libunwind", "libbacktrace", "std"], default-features = false}
-clap = { version = ">=2.27.1", default-features = false}
-
-api_server = { path = "api_server" }
-jailer = { path = "jailer" }
-logger = { path = "logger" }
-mmds = { path = "mmds" }
-seccomp = { path = "seccomp" }
-utils = { path = "utils" }
-vmm = { path = "vmm" }
-libc = ">=0.2.39"
-
-
-[dev-dependencies]
-tempfile = ">=3.0.2"
+[workspace]
+members = ["src/firecracker", "src/jailer"]
[profile.dev]
panic = "abort"
[profile.release]
-lto = true
panic = "abort"
-
-[workspace]
+lto = true
diff --git a/FAQ.md b/FAQ.md
index 1e5c49174fc..52524913fe8 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -168,7 +168,7 @@ You can see more info about the `refclock` parameters
[here](https://chrony.tuxfamily.org/doc/3.4/chrony.conf.html#refclock).
Adjust them according to your needs.
-### Each Firecracker opens 20+ file descriptors. Is this an issue?
+### Each Firecracker opens 20+ file descriptors. Is this an issue?
The relatively high FD usage is expected and correct. Firecracker heavily
relies on event file descriptors to drive device emulation.
@@ -230,7 +230,7 @@ Possible mitigations are:
### How can I configure and start a microVM without sending API calls?
-Passing an optional command line parameter, `--config-file`, to the Firecracker
-process allows this type of configuration. This parameter must be the path to a
-file that contains the JSON specification that will be used to configure and start
-the microVM. One example of such file can be found at `tests/framework/vm_config.json`.
+Passing an optional command line parameter, `--config-file`, to the Firecracker
+process allows this type of configuration. This parameter must be the path to a
+file that contains the JSON specification that will be used to configure and start
+the microVM. One example of such file can be found at `tests/framework/vm_config.json`.
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
index 2f2224a3f1c..992d9fc20fc 100644
--- a/MAINTAINERS.md
+++ b/MAINTAINERS.md
@@ -9,4 +9,3 @@ Firecracker is maintained by a dedicated team within Amazon:
- Dan Horobeanu
- Diana Popa
- Andreea Florescu
-
diff --git a/NOTICE b/NOTICE
index 0f469671d06..7206239c90a 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,2 +1,2 @@
Firecracker
-Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
diff --git a/SECURITY-POLICY.md b/SECURITY-POLICY.md
index c31381e3490..0842d9fe491 100644
--- a/SECURITY-POLICY.md
+++ b/SECURITY-POLICY.md
@@ -20,4 +20,3 @@ vulnerability during the embargo period.
At the end of the embargo period, maintainers will publicly release information
about the vulnerability together with the Firecracker patches that mitigate it.
-
diff --git a/SPECIFICATION.md b/SPECIFICATION.md
index 3016b6a4cd3..51dcafb8ac8 100644
--- a/SPECIFICATION.md
+++ b/SPECIFICATION.md
@@ -58,4 +58,3 @@ enough RAM, etc.), customers can rely on the following:
³ No logs are currently produced in the span of time between the `jailer`
process start-up and the logging system initialization in the `firecracker`
process.
-
diff --git a/docs/dev-machine-setup.md b/docs/dev-machine-setup.md
index 3cb6b90e04b..74631ea80f3 100644
--- a/docs/dev-machine-setup.md
+++ b/docs/dev-machine-setup.md
@@ -63,22 +63,22 @@ Follow these steps to create a bare metal instance.
1. If you don't already have an AWS account, create one using the [AWS Portal](https://portal.aws.amazon.com/billing/signup).
1. Login to [AWS console](https://console.aws.amazon.com/console/home?region=us-east-1). Bare metal instances are
- only supported in `US East (N. Virginia)` region at this time. This
+ only supported in `US East (N. Virginia)` region at this time. This
region is preselected for you in the Console.
1. Click on `Launch a virtual machine` in `Build Solution` section.
-1. Firecracker requires a relatively new kernel, so you should use a recent
+1. Firecracker requires a relatively new kernel, so you should use a recent
Linux distribution - such as `Ubuntu Server 18.04 LTS (HVM), SSD Volume Type`.
1. In `Step 2`, scroll to the bottom and select `i3.metal` instance type. Click
on `Next: Configure Instance Details`.
1. In `Step 3`, click on `Next: Add Storage`.
1. In `Step 4`, click on `Next: Add Tags`.
1. In `Step 5`, click on `Next: Configure Security Group`.
-1. In `Step 6`, take the default security group. This opens up port 22 and is
+1. In `Step 6`, take the default security group. This opens up port 22 and is
needed so that you can ssh into the machine later. Click on `Review and Launch`.
-1. Verify the details and click on `Launch`. If you do not have an existing
-key pair, then you can select `Create a new key pair` to create a key pair.
+1. Verify the details and click on `Launch`. If you do not have an existing
+key pair, then you can select `Create a new key pair` to create a key pair.
This is needed so that you can use it later to ssh into the machine.
-1. Click on the instance id in the green box. Copy `Public DNS` from the
+1. Click on the instance id in the green box. Copy `Public DNS` from the
`Description` tab of the selected instance.
1. Login to the newly created instance:
@@ -99,7 +99,7 @@ you can find brief instructions in the Addendum [below](#addendum).
Here is a brief summary of steps to create such a setup (full instructions to
set up a Ubuntu-based VM on GCE with nested KVM enablement can be found in GCE
[documentation](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances)).
-
+
1. Select a GCP project and zone
```
@@ -113,19 +113,19 @@ set up a Ubuntu-based VM on GCE with nested KVM enablement can be found in GCE
It might be convenient to keep your Firecracker-related GCP resources in
a separate project, so that you can keep track of resources more easily
and remove everything easily once your are done.
-
- For convenience, give the project a unique name (e.g.,
+
+ For convenience, give the project a unique name (e.g.,
your_name-firecracker), so that GCP does not need to create a project
id different than project name (by appending randomized numbers to the
name you provide).
-
+
```
$ gcloud projects create ${FC_PROJECT} --enable-cloud-apis --set-as-default
```
-
+
```
$ gcloud config set project ${FC_PROJECT}
$ gcloud config set compute/region ${FC_REGION}
@@ -134,7 +134,7 @@ set up a Ubuntu-based VM on GCE with nested KVM enablement can be found in GCE
1. The next step is to create a VM image able to run nested KVM (as outlined
[here](https://cloud.google.com/compute/docs/instances/enable-nested-virtualization-vm-instances)).
-
+
**IMPORTANT:** Notice that Firecracker requires a relatively new kernel,
so you should use a recent Linux distribution image - such as Ubuntu 18
(used in the commands below), or equivalent.
@@ -157,7 +157,7 @@ set up a Ubuntu-based VM on GCE with nested KVM enablement can be found in GCE
--image ${FC_IMAGE}
```
- 1. Connect to the VM via SSH.
+ 1. Connect to the VM via SSH.
```
$ gcloud compute ssh ${FC_VM}
@@ -165,11 +165,11 @@ set up a Ubuntu-based VM on GCE with nested KVM enablement can be found in GCE
When doing it for the first time, a key-pair will be created for you
(you will be propmpted for a passphrase - can just keep it empty) and
- uploaded to GCE. Done! You should see the prompt of the new VM:
+ uploaded to GCE. Done! You should see the prompt of the new VM:
```
ubuntu@firecracker-vm:~$
- ```
+ ```
1. Verify that VMX is enabled, enable KVM
@@ -180,7 +180,7 @@ set up a Ubuntu-based VM on GCE with nested KVM enablement can be found in GCE
$ [ -r /dev/kvm ] && [ -w /dev/kvm ] && echo "OK" || echo "FAIL"
OK
```
-
+
Now you can continue with the Firecracker [Getting Started](getting-started.md)
instructions to install and configure Firecracker in the new VM.
@@ -194,7 +194,7 @@ In a nutshell, setting up a GCP account involves the following steps:
Google credentials. If you don't have account, you will be prompted to join
the trial.
- 1. Install GCP CLI & SDK (full instructions can be found
+ 1. Install GCP CLI & SDK (full instructions can be found
[here](https://cloud.google.com/sdk/docs/quickstart-debian-ubuntu))
```
@@ -203,7 +203,7 @@ In a nutshell, setting up a GCP account involves the following steps:
| sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
$ curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ sudo apt-get update && sudo apt-get install -y google-cloud-sdk
- ```
+ ```
1. Configure the `gcloud` CLI by running:
@@ -217,4 +217,3 @@ In a nutshell, setting up a GCP account involves the following steps:
### Microsoft Azure
`[TODO]`
-
diff --git a/docs/getting-started.md b/docs/getting-started.md
index 0268f7b147d..7922062ad29 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -247,24 +247,24 @@ curl --unix-socket /tmp/firecracker.socket -i \
#### Configuring the microVM without sending API requests
-If you'd like to boot up a guest machine without using the API socket, you can do that
-by passing the parameter `--config-file` to the Firecracker process. The command for
+If you'd like to boot up a guest machine without using the API socket, you can do that
+by passing the parameter `--config-file` to the Firecracker process. The command for
starting Firecracker with this option will look like this:
```bash
-./firecracker --api-sock /tmp/firecracker.socket --config-file
+./firecracker --api-sock /tmp/firecracker.socket --config-file
-```
-
-`path_to_the_configuration_file` should represent the path to a file that contains a
-JSON which stores the entire configuration for all of the microVM's resources. The
-JSON **must** contain the configuration for the guest kernel and rootfs, as these
-are mandatory, but all of the other resources are optional, so it's your choice
-if you want to configure them or not. Because using this configuration method will
-also start the microVM, you need to specify all desired pre-boot configurable resources
-in that JSON. The names of the resources are the ones from the `firecracker.yaml` file
-and the names of their fields are the same that are used in API requests.
-You can find an example of configuration file at `tests/framework/vm_config.json`.
+```
+
+`path_to_the_configuration_file` should represent the path to a file that contains a
+JSON which stores the entire configuration for all of the microVM's resources. The
+JSON **must** contain the configuration for the guest kernel and rootfs, as these
+are mandatory, but all of the other resources are optional, so it's your choice
+if you want to configure them or not. Because using this configuration method will
+also start the microVM, you need to specify all desired pre-boot configurable resources
+in that JSON. The names of the resources are the ones from the `firecracker.yaml` file
+and the names of their fields are the same that are used in API requests.
+You can find an example of configuration file at `tests/framework/vm_config.json`.
After the machine is booted, you can still use the socket to send API requests
for post-boot operations.
@@ -302,10 +302,10 @@ Within the Firecracker repository root directory:
This will build and place the two Firecracker binaries at:
- `build/cargo_target/${toolchain}/debug/firecracker` and
-- `build/cargo_target/${toolchain}/debug/jailer`.
+- `build/cargo_target/${toolchain}/debug/jailer`.
-The default build profile is `debug`. If you want to build
-the release binaries (optimized and stripped of debug info),
+The default build profile is `debug`. If you want to build
+the release binaries (optimized and stripped of debug info),
use the `--release` option:
```bash
diff --git a/docs/jailer.md b/docs/jailer.md
index bacc8a9f884..772a0d649f9 100644
--- a/docs/jailer.md
+++ b/docs/jailer.md
@@ -39,13 +39,13 @@ jailer --id \
Firecracker.
- 2 (default): advanced filtering. This adds further checks on some of the
parameters of the allowed syscalls.
-- The jailer adheres to the "end of command options" convention, meaning
- all parameters specified after `--` are forwarded to Firecracker. For
- example, this can be paired with the `--config-file` Firecracker argument to
- specify a configuration file when starting Firecracker via the jailer (the
- file path and the resources referenced within must be valid relative to a
- jailed Firecracker). Please note the jailer already passes the following
- parameters to the Firecracker process: `--api-sock`, `--seccomp-level` and
+- The jailer adheres to the "end of command options" convention, meaning
+ all parameters specified after `--` are forwarded to Firecracker. For
+ example, this can be paired with the `--config-file` Firecracker argument to
+ specify a configuration file when starting Firecracker via the jailer (the
+ file path and the resources referenced within must be valid relative to a
+ jailed Firecracker). Please note the jailer already passes the following
+ parameters to the Firecracker process: `--api-sock`, `--seccomp-level` and
`--id`.
## Jailer Operation
diff --git a/docs/mmds.md b/docs/mmds.md
index 843826c4ba4..00a1abd4c27 100644
--- a/docs/mmds.md
+++ b/docs/mmds.md
@@ -7,8 +7,8 @@ the data store, and the minimalist HTTP/TCP/IPv4 stack (named *Dumbo*). They
all exist within the Firecracker process, and outside the KVM boundary; the
first is a part of the API server, the data store is a global entity for a
single microVM, and the last is a part of the device model.
-When the API server is disabled by passing `--no-api` parameter to Firecracker,
-MMDS is no longer available.
+When the API server is disabled by passing `--no-api` parameter to Firecracker,
+MMDS is no longer available.
## The MMDS backend
diff --git a/docs/rootfs-and-kernel-setup.md b/docs/rootfs-and-kernel-setup.md
index 65df9c8ac6f..4b0d9ee4d22 100644
--- a/docs/rootfs-and-kernel-setup.md
+++ b/docs/rootfs-and-kernel-setup.md
@@ -17,26 +17,26 @@ can boot:
git clone https://github.com/torvalds/linux.git linux.git
cd linux.git
```
-
+
2. Check out the Linux version you want to build (e.g. we'll be using v4.20
here):
-
+
```bash
git checkout v4.20
```
-
+
3. You will need to configure your Linux build. You can start from
[our recommended config](../resources/microvm-kernel-config) - just copy
it to `.config` (under the Linux sources dir). You can make interactive
config adjustments using:
-
+
```bash
make menuconfig
```
-
+
*Note*: there are many ways of building a kernel config file, other than
`menuconfig`. You are free to use whichever one you choose.
-
+
4. Build the uncompressed kernel image:
```bash
@@ -58,11 +58,11 @@ at boot time.
To build an EXT4 image:
1. Prepare a properly-sized file. We'll use 50MiB here, but this depends
on how much data you'll want to fit inside:
-
+
```bash
dd if=/dev/zero of=/rootfs.ext4 bs=1M count=50
```
-
+
2. Create an empty file system on the file you created:
```bash
@@ -109,12 +109,12 @@ Alpine Linux:
ln -s agetty /etc/init.d/agetty.ttyS0
echo ttyS0 > /etc/securetty
rc-update add agetty.ttyS0 default
-
+
# Make sure special file systems are mounted on boot:
rc-update add devfs boot
rc-update add procfs boot
rc-update add sysfs boot
-
+
# Then, copy the newly configured system to the rootfs image:
for d in bin etc lib root sbin usr; do tar c "/$d" | tar x -C /my-rootfs; done
for dir in dev proc run sys var; do mkdir /my-rootfs/${dir}; done
@@ -131,4 +131,3 @@ Alpine Linux:
You should now have a kernel image (`vmlinux`) and a rootfs image
(`rootfs.ext4`), that you can boot with Firecracker.
-
diff --git a/docs/vsock.md b/docs/vsock.md
index df90770dd4c..51bed0745dc 100644
--- a/docs/vsock.md
+++ b/docs/vsock.md
@@ -22,7 +22,7 @@ The Firecracker vsock device aims to provide full virtio-vsock support to
software running inside the guest VM, while bypassing vhost kernel code on the
host. To that end, Firecracker implements the virtio-vsock device model, and
mediates communication between AF_UNIX sockets (on the host end) and AF_VSOCK
-sockets (on the guest end).
+sockets (on the guest end).
In order to provide channel multiplexing, AF_VSOCK ports are translated into
multiple AF_UNIX sockets (one Unix socket per vsock port). The virtio-vsock
diff --git a/api_server/Cargo.toml b/src/api_server/Cargo.toml
similarity index 97%
rename from api_server/Cargo.toml
rename to src/api_server/Cargo.toml
index 3ab5cb11504..c08626f25db 100644
--- a/api_server/Cargo.toml
+++ b/src/api_server/Cargo.toml
@@ -7,7 +7,7 @@ authors = ["Amazon Firecracker team "]
serde = ">=1.0.27"
serde_derive = ">=1.0.27"
serde_json = ">=1.0.9"
-epoll = "=4.0.1"
+epoll = ">=4.0.1"
libc = ">=0.2.39"
logger = { path = "../logger" }
diff --git a/api_server/src/lib.rs b/src/api_server/src/lib.rs
similarity index 100%
rename from api_server/src/lib.rs
rename to src/api_server/src/lib.rs
diff --git a/api_server/src/parsed_request.rs b/src/api_server/src/parsed_request.rs
similarity index 100%
rename from api_server/src/parsed_request.rs
rename to src/api_server/src/parsed_request.rs
diff --git a/api_server/src/request/actions.rs b/src/api_server/src/request/actions.rs
similarity index 100%
rename from api_server/src/request/actions.rs
rename to src/api_server/src/request/actions.rs
diff --git a/api_server/src/request/boot_source.rs b/src/api_server/src/request/boot_source.rs
similarity index 100%
rename from api_server/src/request/boot_source.rs
rename to src/api_server/src/request/boot_source.rs
diff --git a/api_server/src/request/drive.rs b/src/api_server/src/request/drive.rs
similarity index 100%
rename from api_server/src/request/drive.rs
rename to src/api_server/src/request/drive.rs
diff --git a/api_server/src/request/instance_info.rs b/src/api_server/src/request/instance_info.rs
similarity index 100%
rename from api_server/src/request/instance_info.rs
rename to src/api_server/src/request/instance_info.rs
diff --git a/api_server/src/request/logger.rs b/src/api_server/src/request/logger.rs
similarity index 100%
rename from api_server/src/request/logger.rs
rename to src/api_server/src/request/logger.rs
diff --git a/api_server/src/request/machine_configuration.rs b/src/api_server/src/request/machine_configuration.rs
similarity index 100%
rename from api_server/src/request/machine_configuration.rs
rename to src/api_server/src/request/machine_configuration.rs
diff --git a/api_server/src/request/mmds.rs b/src/api_server/src/request/mmds.rs
similarity index 100%
rename from api_server/src/request/mmds.rs
rename to src/api_server/src/request/mmds.rs
diff --git a/api_server/src/request/mod.rs b/src/api_server/src/request/mod.rs
similarity index 100%
rename from api_server/src/request/mod.rs
rename to src/api_server/src/request/mod.rs
diff --git a/api_server/src/request/net.rs b/src/api_server/src/request/net.rs
similarity index 100%
rename from api_server/src/request/net.rs
rename to src/api_server/src/request/net.rs
diff --git a/api_server/src/request/vsock.rs b/src/api_server/src/request/vsock.rs
similarity index 100%
rename from api_server/src/request/vsock.rs
rename to src/api_server/src/request/vsock.rs
diff --git a/api_server/swagger/firecracker.yaml b/src/api_server/swagger/firecracker.yaml
similarity index 99%
rename from api_server/swagger/firecracker.yaml
rename to src/api_server/swagger/firecracker.yaml
index 5f7fcbdc8f2..d470cad5079 100644
--- a/api_server/swagger/firecracker.yaml
+++ b/src/api_server/swagger/firecracker.yaml
@@ -357,8 +357,8 @@ paths:
put:
summary: Creates/updates a vsock device.
description:
- The first call creates the device with the configuration specified
- in body. Subsequent calls will update the device configuration.
+ The first call creates the device with the configuration specified
+ in body. Subsequent calls will update the device configuration.
May fail if update is not possible.
operationId: putGuestVsock
parameters:
diff --git a/arch/Cargo.toml b/src/arch/Cargo.toml
similarity index 85%
rename from arch/Cargo.toml
rename to src/arch/Cargo.toml
index b323f963349..fdac34cfba9 100644
--- a/arch/Cargo.toml
+++ b/src/arch/Cargo.toml
@@ -4,8 +4,8 @@ version = "0.1.0"
authors = ["The Chromium OS Authors"]
[dependencies]
-kvm-bindings = "0.1"
-kvm-ioctls = "0.3"
+kvm-bindings = ">=0.1"
+kvm-ioctls = ">=0.3"
libc = ">=0.2.39"
arch_gen = { path = "../arch_gen" }
diff --git a/arch/src/aarch64/fdt.rs b/src/arch/src/aarch64/fdt.rs
similarity index 100%
rename from arch/src/aarch64/fdt.rs
rename to src/arch/src/aarch64/fdt.rs
diff --git a/arch/src/aarch64/gic.rs b/src/arch/src/aarch64/gic.rs
similarity index 100%
rename from arch/src/aarch64/gic.rs
rename to src/arch/src/aarch64/gic.rs
diff --git a/arch/src/aarch64/gicv2.rs b/src/arch/src/aarch64/gicv2.rs
similarity index 100%
rename from arch/src/aarch64/gicv2.rs
rename to src/arch/src/aarch64/gicv2.rs
diff --git a/arch/src/aarch64/gicv3.rs b/src/arch/src/aarch64/gicv3.rs
similarity index 100%
rename from arch/src/aarch64/gicv3.rs
rename to src/arch/src/aarch64/gicv3.rs
diff --git a/arch/src/aarch64/layout.rs b/src/arch/src/aarch64/layout.rs
similarity index 100%
rename from arch/src/aarch64/layout.rs
rename to src/arch/src/aarch64/layout.rs
diff --git a/arch/src/aarch64/mod.rs b/src/arch/src/aarch64/mod.rs
similarity index 100%
rename from arch/src/aarch64/mod.rs
rename to src/arch/src/aarch64/mod.rs
diff --git a/arch/src/aarch64/output.dtb b/src/arch/src/aarch64/output.dtb
similarity index 100%
rename from arch/src/aarch64/output.dtb
rename to src/arch/src/aarch64/output.dtb
diff --git a/arch/src/aarch64/regs.rs b/src/arch/src/aarch64/regs.rs
similarity index 100%
rename from arch/src/aarch64/regs.rs
rename to src/arch/src/aarch64/regs.rs
diff --git a/arch/src/lib.rs b/src/arch/src/lib.rs
similarity index 100%
rename from arch/src/lib.rs
rename to src/arch/src/lib.rs
diff --git a/arch/src/x86_64/gdt.rs b/src/arch/src/x86_64/gdt.rs
similarity index 100%
rename from arch/src/x86_64/gdt.rs
rename to src/arch/src/x86_64/gdt.rs
diff --git a/arch/src/x86_64/interrupts.rs b/src/arch/src/x86_64/interrupts.rs
similarity index 100%
rename from arch/src/x86_64/interrupts.rs
rename to src/arch/src/x86_64/interrupts.rs
diff --git a/arch/src/x86_64/layout.rs b/src/arch/src/x86_64/layout.rs
similarity index 100%
rename from arch/src/x86_64/layout.rs
rename to src/arch/src/x86_64/layout.rs
diff --git a/arch/src/x86_64/mod.rs b/src/arch/src/x86_64/mod.rs
similarity index 100%
rename from arch/src/x86_64/mod.rs
rename to src/arch/src/x86_64/mod.rs
diff --git a/arch/src/x86_64/mptable.rs b/src/arch/src/x86_64/mptable.rs
similarity index 100%
rename from arch/src/x86_64/mptable.rs
rename to src/arch/src/x86_64/mptable.rs
diff --git a/arch/src/x86_64/regs.rs b/src/arch/src/x86_64/regs.rs
similarity index 100%
rename from arch/src/x86_64/regs.rs
rename to src/arch/src/x86_64/regs.rs
diff --git a/arch_gen/Cargo.toml b/src/arch_gen/Cargo.toml
similarity index 99%
rename from arch_gen/Cargo.toml
rename to src/arch_gen/Cargo.toml
index e231a15bc19..1181af1d8ef 100644
--- a/arch_gen/Cargo.toml
+++ b/src/arch_gen/Cargo.toml
@@ -4,4 +4,3 @@ version = "0.1.0"
authors = ["Amazon Firecracker team "]
[dependencies]
-
diff --git a/arch_gen/src/lib.rs b/src/arch_gen/src/lib.rs
similarity index 100%
rename from arch_gen/src/lib.rs
rename to src/arch_gen/src/lib.rs
diff --git a/arch_gen/src/x86/bootparam.rs b/src/arch_gen/src/x86/bootparam.rs
similarity index 100%
rename from arch_gen/src/x86/bootparam.rs
rename to src/arch_gen/src/x86/bootparam.rs
diff --git a/arch_gen/src/x86/mod.rs b/src/arch_gen/src/x86/mod.rs
similarity index 100%
rename from arch_gen/src/x86/mod.rs
rename to src/arch_gen/src/x86/mod.rs
diff --git a/arch_gen/src/x86/mpspec.rs b/src/arch_gen/src/x86/mpspec.rs
similarity index 100%
rename from arch_gen/src/x86/mpspec.rs
rename to src/arch_gen/src/x86/mpspec.rs
diff --git a/arch_gen/src/x86/msr_index.rs b/src/arch_gen/src/x86/msr_index.rs
similarity index 100%
rename from arch_gen/src/x86/msr_index.rs
rename to src/arch_gen/src/x86/msr_index.rs
diff --git a/src/bin/jailer.rs b/src/bin/jailer.rs
deleted file mode 100644
index 252179eb0c9..00000000000
--- a/src/bin/jailer.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
-// SPDX-License-Identifier: Apache-2.0
-extern crate clap;
-
-extern crate jailer;
-extern crate utils;
-
-fn main() {
- if let Err(error) = jailer::run(
- jailer::clap_app().get_matches(),
- utils::time::get_time(utils::time::ClockType::Monotonic) / 1000,
- utils::time::get_time(utils::time::ClockType::ProcessCpu) / 1000,
- ) {
- panic!("Jailer error: {}", error);
- }
-}
diff --git a/cpuid/Cargo.toml b/src/cpuid/Cargo.toml
similarity index 64%
rename from cpuid/Cargo.toml
rename to src/cpuid/Cargo.toml
index ef9ac211060..9bb2cf01172 100644
--- a/cpuid/Cargo.toml
+++ b/src/cpuid/Cargo.toml
@@ -4,6 +4,6 @@ version = "0.1.0"
authors = ["Amazon Firecracker team "]
[dependencies]
-kvm-bindings = "0.1"
-kvm-ioctls = "0.3"
-vmm-sys-util = "0.2.0"
+kvm-bindings = ">=0.1"
+kvm-ioctls = ">=0.3"
+vmm-sys-util = ">=0.2.0"
diff --git a/cpuid/src/bit_helper.rs b/src/cpuid/src/bit_helper.rs
similarity index 100%
rename from cpuid/src/bit_helper.rs
rename to src/cpuid/src/bit_helper.rs
diff --git a/cpuid/src/brand_string.rs b/src/cpuid/src/brand_string.rs
similarity index 100%
rename from cpuid/src/brand_string.rs
rename to src/cpuid/src/brand_string.rs
diff --git a/cpuid/src/common.rs b/src/cpuid/src/common.rs
similarity index 100%
rename from cpuid/src/common.rs
rename to src/cpuid/src/common.rs
diff --git a/cpuid/src/cpu_leaf.rs b/src/cpuid/src/cpu_leaf.rs
similarity index 100%
rename from cpuid/src/cpu_leaf.rs
rename to src/cpuid/src/cpu_leaf.rs
diff --git a/cpuid/src/lib.rs b/src/cpuid/src/lib.rs
similarity index 98%
rename from cpuid/src/lib.rs
rename to src/cpuid/src/lib.rs
index b975821fa24..c54aa7290c2 100644
--- a/cpuid/src/lib.rs
+++ b/src/cpuid/src/lib.rs
@@ -8,6 +8,8 @@
#![deny(missing_docs)]
//! Utility for configuring the CPUID (CPU identification) for the guest microVM.
+#![cfg(target_arch = "x86_64")]
+
extern crate kvm_bindings;
extern crate kvm_ioctls;
extern crate vmm_sys_util;
diff --git a/cpuid/src/template/c3.rs b/src/cpuid/src/template/c3.rs
similarity index 100%
rename from cpuid/src/template/c3.rs
rename to src/cpuid/src/template/c3.rs
diff --git a/cpuid/src/template/mod.rs b/src/cpuid/src/template/mod.rs
similarity index 100%
rename from cpuid/src/template/mod.rs
rename to src/cpuid/src/template/mod.rs
diff --git a/cpuid/src/template/t2.rs b/src/cpuid/src/template/t2.rs
similarity index 100%
rename from cpuid/src/template/t2.rs
rename to src/cpuid/src/template/t2.rs
diff --git a/cpuid/src/transformer/amd.rs b/src/cpuid/src/transformer/amd.rs
similarity index 100%
rename from cpuid/src/transformer/amd.rs
rename to src/cpuid/src/transformer/amd.rs
diff --git a/cpuid/src/transformer/common.rs b/src/cpuid/src/transformer/common.rs
similarity index 100%
rename from cpuid/src/transformer/common.rs
rename to src/cpuid/src/transformer/common.rs
diff --git a/cpuid/src/transformer/intel.rs b/src/cpuid/src/transformer/intel.rs
similarity index 100%
rename from cpuid/src/transformer/intel.rs
rename to src/cpuid/src/transformer/intel.rs
diff --git a/cpuid/src/transformer/mod.rs b/src/cpuid/src/transformer/mod.rs
similarity index 100%
rename from cpuid/src/transformer/mod.rs
rename to src/cpuid/src/transformer/mod.rs
diff --git a/devices/Cargo.toml b/src/devices/Cargo.toml
similarity index 96%
rename from devices/Cargo.toml
rename to src/devices/Cargo.toml
index 53b391f6270..15bdbd33b77 100644
--- a/devices/Cargo.toml
+++ b/src/devices/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2018"
[dependencies]
byteorder = ">=1.2.1"
-epoll = "=4.0.1"
+epoll = ">=4.0.1"
libc = ">=0.2.39"
dumbo = { path = "../dumbo" }
diff --git a/devices/src/bus.rs b/src/devices/src/bus.rs
similarity index 100%
rename from devices/src/bus.rs
rename to src/devices/src/bus.rs
diff --git a/devices/src/legacy/i8042.rs b/src/devices/src/legacy/i8042.rs
similarity index 100%
rename from devices/src/legacy/i8042.rs
rename to src/devices/src/legacy/i8042.rs
diff --git a/devices/src/legacy/mod.rs b/src/devices/src/legacy/mod.rs
similarity index 100%
rename from devices/src/legacy/mod.rs
rename to src/devices/src/legacy/mod.rs
diff --git a/devices/src/legacy/rtc_pl031.rs b/src/devices/src/legacy/rtc_pl031.rs
similarity index 100%
rename from devices/src/legacy/rtc_pl031.rs
rename to src/devices/src/legacy/rtc_pl031.rs
diff --git a/devices/src/legacy/serial.rs b/src/devices/src/legacy/serial.rs
similarity index 100%
rename from devices/src/legacy/serial.rs
rename to src/devices/src/legacy/serial.rs
diff --git a/devices/src/lib.rs b/src/devices/src/lib.rs
similarity index 100%
rename from devices/src/lib.rs
rename to src/devices/src/lib.rs
diff --git a/devices/src/virtio/block.rs b/src/devices/src/virtio/block.rs
similarity index 100%
rename from devices/src/virtio/block.rs
rename to src/devices/src/virtio/block.rs
diff --git a/devices/src/virtio/mmio.rs b/src/devices/src/virtio/mmio.rs
similarity index 100%
rename from devices/src/virtio/mmio.rs
rename to src/devices/src/virtio/mmio.rs
diff --git a/devices/src/virtio/mod.rs b/src/devices/src/virtio/mod.rs
similarity index 100%
rename from devices/src/virtio/mod.rs
rename to src/devices/src/virtio/mod.rs
diff --git a/devices/src/virtio/net.rs b/src/devices/src/virtio/net.rs
similarity index 100%
rename from devices/src/virtio/net.rs
rename to src/devices/src/virtio/net.rs
diff --git a/devices/src/virtio/queue.rs b/src/devices/src/virtio/queue.rs
similarity index 100%
rename from devices/src/virtio/queue.rs
rename to src/devices/src/virtio/queue.rs
diff --git a/devices/src/virtio/vsock/csm/connection.rs b/src/devices/src/virtio/vsock/csm/connection.rs
similarity index 100%
rename from devices/src/virtio/vsock/csm/connection.rs
rename to src/devices/src/virtio/vsock/csm/connection.rs
diff --git a/devices/src/virtio/vsock/csm/mod.rs b/src/devices/src/virtio/vsock/csm/mod.rs
similarity index 100%
rename from devices/src/virtio/vsock/csm/mod.rs
rename to src/devices/src/virtio/vsock/csm/mod.rs
diff --git a/devices/src/virtio/vsock/csm/txbuf.rs b/src/devices/src/virtio/vsock/csm/txbuf.rs
similarity index 89%
rename from devices/src/virtio/vsock/csm/txbuf.rs
rename to src/devices/src/virtio/vsock/csm/txbuf.rs
index c4e858dd68d..3bf7099fde7 100644
--- a/devices/src/virtio/vsock/csm/txbuf.rs
+++ b/src/devices/src/virtio/vsock/csm/txbuf.rs
@@ -3,7 +3,6 @@
//
use std::io::Write;
-use std::mem;
use std::num::Wrapping;
use super::defs;
@@ -14,7 +13,7 @@ use super::{Error, Result};
/// the host can't read fast enough.
pub struct TxBuf {
/// The actual u8 buffer - only allocated after the first push.
- data: Option>,
+ data: Option>,
/// Ring-buffer head offset - where new data is pushed to.
head: Wrapping,
/// Ring-buffer tail offset - where data is flushed from.
@@ -50,17 +49,9 @@ impl TxBuf {
return Err(Error::TxBufFull);
}
- // We're using a closure here to return the boxed slice, instead of a value (i.e.
- // `get_or_insert_with()` instead of `get_or_insert()`), because we only want the box
- // created when `self.data` is None. If we were to use `get_or_insert(box)`, the box
- // argument would always get evaluated (which implies a heap allocation), even though
- // it would later be discarded (when `self.data.is_some()`). Apparently, clippy fails
- // to see this, and insists on issuing some warning.
- let data = self.data.get_or_insert_with(||
- // Using uninitialized memory here is quite safe, since we never read from any
- // area of the buffer before writing to it. First we push, then we flush only
- // what had been prviously pushed.
- Box::new(unsafe {mem::uninitialized::<[u8; Self::SIZE]>()}));
+ let data = self
+ .data
+ .get_or_insert_with(|| vec![0u8; Self::SIZE].into_boxed_slice());
// Buffer head, as an offset into the data slice.
let head_ofs = self.head.0 as usize % Self::SIZE;
diff --git a/devices/src/virtio/vsock/device.rs b/src/devices/src/virtio/vsock/device.rs
similarity index 100%
rename from devices/src/virtio/vsock/device.rs
rename to src/devices/src/virtio/vsock/device.rs
diff --git a/devices/src/virtio/vsock/epoll_handler.rs b/src/devices/src/virtio/vsock/epoll_handler.rs
similarity index 100%
rename from devices/src/virtio/vsock/epoll_handler.rs
rename to src/devices/src/virtio/vsock/epoll_handler.rs
diff --git a/devices/src/virtio/vsock/mod.rs b/src/devices/src/virtio/vsock/mod.rs
similarity index 100%
rename from devices/src/virtio/vsock/mod.rs
rename to src/devices/src/virtio/vsock/mod.rs
diff --git a/devices/src/virtio/vsock/packet.rs b/src/devices/src/virtio/vsock/packet.rs
similarity index 100%
rename from devices/src/virtio/vsock/packet.rs
rename to src/devices/src/virtio/vsock/packet.rs
diff --git a/devices/src/virtio/vsock/unix/mod.rs b/src/devices/src/virtio/vsock/unix/mod.rs
similarity index 100%
rename from devices/src/virtio/vsock/unix/mod.rs
rename to src/devices/src/virtio/vsock/unix/mod.rs
diff --git a/devices/src/virtio/vsock/unix/muxer.rs b/src/devices/src/virtio/vsock/unix/muxer.rs
similarity index 100%
rename from devices/src/virtio/vsock/unix/muxer.rs
rename to src/devices/src/virtio/vsock/unix/muxer.rs
diff --git a/devices/src/virtio/vsock/unix/muxer_killq.rs b/src/devices/src/virtio/vsock/unix/muxer_killq.rs
similarity index 100%
rename from devices/src/virtio/vsock/unix/muxer_killq.rs
rename to src/devices/src/virtio/vsock/unix/muxer_killq.rs
diff --git a/devices/src/virtio/vsock/unix/muxer_rxq.rs b/src/devices/src/virtio/vsock/unix/muxer_rxq.rs
similarity index 100%
rename from devices/src/virtio/vsock/unix/muxer_rxq.rs
rename to src/devices/src/virtio/vsock/unix/muxer_rxq.rs
diff --git a/dumbo/Cargo.toml b/src/dumbo/Cargo.toml
similarity index 100%
rename from dumbo/Cargo.toml
rename to src/dumbo/Cargo.toml
diff --git a/dumbo/src/lib.rs b/src/dumbo/src/lib.rs
similarity index 100%
rename from dumbo/src/lib.rs
rename to src/dumbo/src/lib.rs
diff --git a/dumbo/src/mac.rs b/src/dumbo/src/mac.rs
similarity index 100%
rename from dumbo/src/mac.rs
rename to src/dumbo/src/mac.rs
diff --git a/dumbo/src/ns.rs b/src/dumbo/src/ns.rs
similarity index 100%
rename from dumbo/src/ns.rs
rename to src/dumbo/src/ns.rs
diff --git a/dumbo/src/pdu/arp.rs b/src/dumbo/src/pdu/arp.rs
similarity index 100%
rename from dumbo/src/pdu/arp.rs
rename to src/dumbo/src/pdu/arp.rs
diff --git a/dumbo/src/pdu/bytes.rs b/src/dumbo/src/pdu/bytes.rs
similarity index 100%
rename from dumbo/src/pdu/bytes.rs
rename to src/dumbo/src/pdu/bytes.rs
diff --git a/dumbo/src/pdu/ethernet.rs b/src/dumbo/src/pdu/ethernet.rs
similarity index 100%
rename from dumbo/src/pdu/ethernet.rs
rename to src/dumbo/src/pdu/ethernet.rs
diff --git a/dumbo/src/pdu/ipv4.rs b/src/dumbo/src/pdu/ipv4.rs
similarity index 100%
rename from dumbo/src/pdu/ipv4.rs
rename to src/dumbo/src/pdu/ipv4.rs
diff --git a/dumbo/src/pdu/mod.rs b/src/dumbo/src/pdu/mod.rs
similarity index 100%
rename from dumbo/src/pdu/mod.rs
rename to src/dumbo/src/pdu/mod.rs
diff --git a/dumbo/src/pdu/tcp.rs b/src/dumbo/src/pdu/tcp.rs
similarity index 100%
rename from dumbo/src/pdu/tcp.rs
rename to src/dumbo/src/pdu/tcp.rs
diff --git a/dumbo/src/pdu/udp.rs b/src/dumbo/src/pdu/udp.rs
similarity index 100%
rename from dumbo/src/pdu/udp.rs
rename to src/dumbo/src/pdu/udp.rs
diff --git a/dumbo/src/tcp/connection.rs b/src/dumbo/src/tcp/connection.rs
similarity index 100%
rename from dumbo/src/tcp/connection.rs
rename to src/dumbo/src/tcp/connection.rs
diff --git a/dumbo/src/tcp/endpoint.rs b/src/dumbo/src/tcp/endpoint.rs
similarity index 100%
rename from dumbo/src/tcp/endpoint.rs
rename to src/dumbo/src/tcp/endpoint.rs
diff --git a/dumbo/src/tcp/handler.rs b/src/dumbo/src/tcp/handler.rs
similarity index 100%
rename from dumbo/src/tcp/handler.rs
rename to src/dumbo/src/tcp/handler.rs
diff --git a/dumbo/src/tcp/mod.rs b/src/dumbo/src/tcp/mod.rs
similarity index 100%
rename from dumbo/src/tcp/mod.rs
rename to src/dumbo/src/tcp/mod.rs
diff --git a/src/firecracker/Cargo.toml b/src/firecracker/Cargo.toml
new file mode 100644
index 00000000000..042b8fe74a7
--- /dev/null
+++ b/src/firecracker/Cargo.toml
@@ -0,0 +1,19 @@
+[package]
+name = "firecracker"
+version = "0.19.0"
+authors = ["Amazon Firecracker team "]
+
+[dependencies]
+backtrace = {version = ">=0.3.35", features = ["libunwind", "libbacktrace", "std"], default-features = false}
+clap = { version = ">=2.27.1", default-features = false}
+libc = ">=0.2.39"
+
+api_server = { path = "../api_server" }
+utils = { path = "../utils" }
+logger = { path = "../logger" }
+mmds = { path = "../mmds" }
+seccomp = { path = "../seccomp" }
+vmm = { path = "../vmm" }
+
+[dev-dependencies]
+tempfile = ">=3.0.2"
diff --git a/src/main.rs b/src/firecracker/src/main.rs
similarity index 99%
rename from src/main.rs
rename to src/firecracker/src/main.rs
index 3937dc3d4a8..deccde6a37e 100644
--- a/src/main.rs
+++ b/src/firecracker/src/main.rs
@@ -5,7 +5,6 @@ extern crate backtrace;
#[macro_use(crate_version, crate_authors)]
extern crate clap;
extern crate api_server;
-extern crate jailer;
extern crate libc;
extern crate utils;
#[macro_use]
diff --git a/jailer/Cargo.toml b/src/jailer/Cargo.toml
similarity index 100%
rename from jailer/Cargo.toml
rename to src/jailer/Cargo.toml
diff --git a/jailer/src/cgroup.rs b/src/jailer/src/cgroup.rs
similarity index 100%
rename from jailer/src/cgroup.rs
rename to src/jailer/src/cgroup.rs
diff --git a/jailer/src/chroot.rs b/src/jailer/src/chroot.rs
similarity index 100%
rename from jailer/src/chroot.rs
rename to src/jailer/src/chroot.rs
diff --git a/jailer/src/env.rs b/src/jailer/src/env.rs
similarity index 100%
rename from jailer/src/env.rs
rename to src/jailer/src/env.rs
diff --git a/jailer/src/lib.rs b/src/jailer/src/main.rs
similarity index 96%
rename from jailer/src/lib.rs
rename to src/jailer/src/main.rs
index 12c6a0853a1..61d582502e4 100644
--- a/jailer/src/lib.rs
+++ b/src/jailer/src/main.rs
@@ -19,7 +19,7 @@ use std::io;
use std::path::{Path, PathBuf};
use std::result;
-use clap::{App, AppSettings, Arg, ArgMatches};
+use clap::{App, AppSettings, Arg};
use env::Env;
use utils::validators;
@@ -328,24 +328,6 @@ fn sanitize_process() {
}
}
-pub fn run(args: ArgMatches, start_time_us: u64, start_time_cpu_us: u64) -> Result<()> {
- // We open /dev/kvm and create the listening socket. These file descriptors will be
- // passed on to Firecracker post exec, and used via knowing their values in advance.
-
- // TODO: can a malicious guest that takes over firecracker use its access to the KVM fd to
- // starve the host of resources? (cgroups should take care of that, but do they currently?)
-
- sanitize_process();
-
- let env = Env::new(args, start_time_us, start_time_cpu_us)?;
-
- // Ensure the folder exists.
- fs::create_dir_all(env.chroot_dir())
- .map_err(|e| Error::CreateDir(env.chroot_dir().to_owned(), e))?;
-
- env.run(SOCKET_FILE_NAME)
-}
-
/// Turns an AsRef into a CString (c style string).
/// The expect should not fail, since Linux paths only contain valid Unicode chars (do they?),
/// and do not contain null bytes (do they?).
@@ -359,6 +341,22 @@ fn to_cstring>(path: T) -> Result {
CString::new(path_str).map_err(Error::CStringParsing)
}
+fn main() {
+ sanitize_process();
+
+ Env::new(
+ clap_app().get_matches(),
+ utils::time::get_time(utils::time::ClockType::Monotonic) / 1000,
+ utils::time::get_time(utils::time::ClockType::ProcessCpu) / 1000,
+ )
+ .and_then(|env| {
+ fs::create_dir_all(env.chroot_dir())
+ .map_err(|e| Error::CreateDir(env.chroot_dir().to_owned(), e))?;
+ env.run(SOCKET_FILE_NAME)
+ })
+ .unwrap_or_else(|err| panic!("Jailer error: {}", err));
+}
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/jailer/src/uuid.rs b/src/jailer/src/uuid.rs
similarity index 100%
rename from jailer/src/uuid.rs
rename to src/jailer/src/uuid.rs
diff --git a/kernel/Cargo.toml b/src/kernel/Cargo.toml
similarity index 100%
rename from kernel/Cargo.toml
rename to src/kernel/Cargo.toml
diff --git a/kernel/src/cmdline/mod.rs b/src/kernel/src/cmdline/mod.rs
similarity index 100%
rename from kernel/src/cmdline/mod.rs
rename to src/kernel/src/cmdline/mod.rs
diff --git a/kernel/src/lib.rs b/src/kernel/src/lib.rs
similarity index 100%
rename from kernel/src/lib.rs
rename to src/kernel/src/lib.rs
diff --git a/kernel/src/loader/elf.rs b/src/kernel/src/loader/elf.rs
similarity index 100%
rename from kernel/src/loader/elf.rs
rename to src/kernel/src/loader/elf.rs
diff --git a/kernel/src/loader/mod.rs b/src/kernel/src/loader/mod.rs
similarity index 100%
rename from kernel/src/loader/mod.rs
rename to src/kernel/src/loader/mod.rs
diff --git a/kernel/src/loader/test_elf.bin b/src/kernel/src/loader/test_elf.bin
similarity index 100%
rename from kernel/src/loader/test_elf.bin
rename to src/kernel/src/loader/test_elf.bin
diff --git a/kernel/src/loader/test_pe.bin b/src/kernel/src/loader/test_pe.bin
similarity index 100%
rename from kernel/src/loader/test_pe.bin
rename to src/kernel/src/loader/test_pe.bin
diff --git a/logger/Cargo.toml b/src/logger/Cargo.toml
similarity index 86%
rename from logger/Cargo.toml
rename to src/logger/Cargo.toml
index e335bdde69d..3fdd074a3a7 100644
--- a/logger/Cargo.toml
+++ b/src/logger/Cargo.toml
@@ -6,7 +6,7 @@ authors = ["Amazon Firecracker team "]
[dependencies]
lazy_static = ">=1.2"
libc = ">=0.2.39"
-log = { version = "0.4", features = ["std"] }
+log = { version = ">=0.4", features = ["std"] }
serde = ">=1.0.27"
serde_derive = ">=1.0.27"
serde_json = ">=1.0.9"
diff --git a/logger/src/error.rs b/src/logger/src/error.rs
similarity index 100%
rename from logger/src/error.rs
rename to src/logger/src/error.rs
diff --git a/logger/src/lib.rs b/src/logger/src/lib.rs
similarity index 100%
rename from logger/src/lib.rs
rename to src/logger/src/lib.rs
diff --git a/logger/src/metrics.rs b/src/logger/src/metrics.rs
similarity index 100%
rename from logger/src/metrics.rs
rename to src/logger/src/metrics.rs
diff --git a/memory_model/Cargo.toml b/src/memory_model/Cargo.toml
similarity index 99%
rename from memory_model/Cargo.toml
rename to src/memory_model/Cargo.toml
index 3cf361e9f58..49902467097 100644
--- a/memory_model/Cargo.toml
+++ b/src/memory_model/Cargo.toml
@@ -9,4 +9,3 @@ utils = { path = "../utils" }
[dev-dependencies]
tempfile = ">=3.0.2"
-
diff --git a/memory_model/src/guest_address.rs b/src/memory_model/src/guest_address.rs
similarity index 100%
rename from memory_model/src/guest_address.rs
rename to src/memory_model/src/guest_address.rs
diff --git a/memory_model/src/guest_memory.rs b/src/memory_model/src/guest_memory.rs
similarity index 100%
rename from memory_model/src/guest_memory.rs
rename to src/memory_model/src/guest_memory.rs
diff --git a/memory_model/src/lib.rs b/src/memory_model/src/lib.rs
similarity index 100%
rename from memory_model/src/lib.rs
rename to src/memory_model/src/lib.rs
diff --git a/memory_model/src/mmap.rs b/src/memory_model/src/mmap.rs
similarity index 100%
rename from memory_model/src/mmap.rs
rename to src/memory_model/src/mmap.rs
diff --git a/micro_http/Cargo.toml b/src/micro_http/Cargo.toml
similarity index 88%
rename from micro_http/Cargo.toml
rename to src/micro_http/Cargo.toml
index 23d6ea30e9a..22c82e0b1cc 100644
--- a/micro_http/Cargo.toml
+++ b/src/micro_http/Cargo.toml
@@ -4,4 +4,4 @@ version = "0.1.0"
authors = ["Amazon Firecracker team "]
[dependencies]
-epoll = "=4.0.1"
+epoll = ">=4.0.1"
diff --git a/micro_http/src/common/headers.rs b/src/micro_http/src/common/headers.rs
similarity index 100%
rename from micro_http/src/common/headers.rs
rename to src/micro_http/src/common/headers.rs
diff --git a/micro_http/src/common/mod.rs b/src/micro_http/src/common/mod.rs
similarity index 100%
rename from micro_http/src/common/mod.rs
rename to src/micro_http/src/common/mod.rs
diff --git a/micro_http/src/connection.rs b/src/micro_http/src/connection.rs
similarity index 100%
rename from micro_http/src/connection.rs
rename to src/micro_http/src/connection.rs
diff --git a/micro_http/src/lib.rs b/src/micro_http/src/lib.rs
similarity index 100%
rename from micro_http/src/lib.rs
rename to src/micro_http/src/lib.rs
diff --git a/micro_http/src/request.rs b/src/micro_http/src/request.rs
similarity index 100%
rename from micro_http/src/request.rs
rename to src/micro_http/src/request.rs
diff --git a/micro_http/src/response.rs b/src/micro_http/src/response.rs
similarity index 100%
rename from micro_http/src/response.rs
rename to src/micro_http/src/response.rs
diff --git a/micro_http/src/server.rs b/src/micro_http/src/server.rs
similarity index 100%
rename from micro_http/src/server.rs
rename to src/micro_http/src/server.rs
diff --git a/mmds/Cargo.toml b/src/mmds/Cargo.toml
similarity index 100%
rename from mmds/Cargo.toml
rename to src/mmds/Cargo.toml
diff --git a/mmds/src/data_store.rs b/src/mmds/src/data_store.rs
similarity index 100%
rename from mmds/src/data_store.rs
rename to src/mmds/src/data_store.rs
diff --git a/mmds/src/lib.rs b/src/mmds/src/lib.rs
similarity index 100%
rename from mmds/src/lib.rs
rename to src/mmds/src/lib.rs
diff --git a/net_gen/Cargo.toml b/src/net_gen/Cargo.toml
similarity index 100%
rename from net_gen/Cargo.toml
rename to src/net_gen/Cargo.toml
diff --git a/net_gen/src/if_tun.rs b/src/net_gen/src/if_tun.rs
similarity index 100%
rename from net_gen/src/if_tun.rs
rename to src/net_gen/src/if_tun.rs
diff --git a/net_gen/src/iff.rs b/src/net_gen/src/iff.rs
similarity index 100%
rename from net_gen/src/iff.rs
rename to src/net_gen/src/iff.rs
diff --git a/net_gen/src/inn.rs b/src/net_gen/src/inn.rs
similarity index 100%
rename from net_gen/src/inn.rs
rename to src/net_gen/src/inn.rs
diff --git a/net_gen/src/lib.rs b/src/net_gen/src/lib.rs
similarity index 100%
rename from net_gen/src/lib.rs
rename to src/net_gen/src/lib.rs
diff --git a/net_gen/src/sockios.rs b/src/net_gen/src/sockios.rs
similarity index 100%
rename from net_gen/src/sockios.rs
rename to src/net_gen/src/sockios.rs
diff --git a/rate_limiter/Cargo.toml b/src/rate_limiter/Cargo.toml
similarity index 92%
rename from rate_limiter/Cargo.toml
rename to src/rate_limiter/Cargo.toml
index 664b8aa8c58..5bf3206f15e 100644
--- a/rate_limiter/Cargo.toml
+++ b/src/rate_limiter/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Amazon Firecracker team "]
[dependencies]
libc = ">=0.2.39"
-timerfd = "1.0"
+timerfd = ">=1.0"
utils = { path = "../utils" }
logger = { path = "../logger" }
diff --git a/rate_limiter/src/lib.rs b/src/rate_limiter/src/lib.rs
similarity index 100%
rename from rate_limiter/src/lib.rs
rename to src/rate_limiter/src/lib.rs
diff --git a/seccomp/Cargo.toml b/src/seccomp/Cargo.toml
similarity index 100%
rename from seccomp/Cargo.toml
rename to src/seccomp/Cargo.toml
diff --git a/seccomp/src/lib.rs b/src/seccomp/src/lib.rs
similarity index 100%
rename from seccomp/src/lib.rs
rename to src/seccomp/src/lib.rs
diff --git a/utils/Cargo.toml b/src/utils/Cargo.toml
similarity index 92%
rename from utils/Cargo.toml
rename to src/utils/Cargo.toml
index bb3df3acbe5..244200c3043 100644
--- a/utils/Cargo.toml
+++ b/src/utils/Cargo.toml
@@ -5,7 +5,7 @@ authors = ["Amazon Firecracker team "]
edition = "2018"
[dependencies]
-vmm-sys-util = "0.2.0"
+vmm-sys-util = ">=0.2.0"
libc = ">=0.2.39"
serde = ">=1.0.27"
net_gen = { path = "../net_gen" }
diff --git a/utils/src/lib.rs b/src/utils/src/lib.rs
similarity index 73%
rename from utils/src/lib.rs
rename to src/utils/src/lib.rs
index ccc015cc3c7..740f799679b 100644
--- a/utils/src/lib.rs
+++ b/src/utils/src/lib.rs
@@ -1,13 +1,22 @@
+// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+// SPDX-License-Identifier: Apache-2.0
+//
#[macro_use]
extern crate vmm_sys_util;
-use std::os::raw::c_int;
+
pub use vmm_sys_util::{errno, eventfd, ioctl, signal, terminal};
+pub mod net;
+pub mod rand;
+pub mod structs;
+pub mod time;
+pub mod validators;
+
/// Wrapper to interpret syscall exit codes and provide a rustacean `io::Result`
-pub struct SyscallReturnCode(pub c_int);
+pub struct SyscallReturnCode(pub std::os::raw::c_int);
impl SyscallReturnCode {
/// Returns the last OS error if value is -1 or Ok(value) otherwise.
- pub fn into_result(self) -> std::io::Result {
+ pub fn into_result(self) -> std::io::Result {
if self.0 == -1 {
Err(std::io::Error::last_os_error())
} else {
@@ -20,9 +29,3 @@ impl SyscallReturnCode {
self.into_result().map(|_| ())
}
}
-
-pub mod net;
-pub mod rand;
-pub mod structs;
-pub mod time;
-pub mod validators;
diff --git a/utils/src/net/mod.rs b/src/utils/src/net/mod.rs
similarity index 100%
rename from utils/src/net/mod.rs
rename to src/utils/src/net/mod.rs
diff --git a/utils/src/net/tap.rs b/src/utils/src/net/tap.rs
similarity index 100%
rename from utils/src/net/tap.rs
rename to src/utils/src/net/tap.rs
diff --git a/utils/src/rand.rs b/src/utils/src/rand.rs
similarity index 100%
rename from utils/src/rand.rs
rename to src/utils/src/rand.rs
diff --git a/utils/src/structs.rs b/src/utils/src/structs.rs
similarity index 97%
rename from utils/src/structs.rs
rename to src/utils/src/structs.rs
index 3d636b63ceb..6c390c05745 100644
--- a/utils/src/structs.rs
+++ b/src/utils/src/structs.rs
@@ -26,13 +26,16 @@ impl fmt::Display for Error {
pub type Result = std::result::Result;
/// Reads a struct from an input buffer.
-/// This is unsafe because the struct is initialized to unverified data read from the input.
-/// `read_struct` should only be called to fill plain old data structs. It is not endian safe.
///
/// # Arguments
///
/// * `f` - The input to read from. Often this is a file.
/// * `out` - The struct to fill with data read from `f`.
+///
+/// # Safety
+///
+/// This is unsafe because the struct is initialized to unverified data read from the input.
+/// `read_struct` should only be called to fill plain old data structs. It is not endian safe.
pub unsafe fn read_struct(f: &mut F, out: &mut T) -> Result<()> {
let out_slice = std::slice::from_raw_parts_mut(out as *mut T as *mut u8, mem::size_of::());
f.read_exact(out_slice).map_err(Error::ReadStruct)?;
@@ -41,15 +44,16 @@ pub unsafe fn read_struct(f: &mut F, out: &mut T) -> Result<()
/// Reads an array of structs from an input buffer. Returns a Vec of structs initialized with data
/// from the specified input.
-/// This is unsafe because the structs are initialized to unverified data read from the input.
-/// `read_struct_slice` should only be called for plain old data structs. It is not endian safe.
///
/// # Arguments
///
/// * `f` - The input to read from. Often this is a file.
/// * `len` - The number of structs to fill with data read from `f`.
-// This lint check is now deprecated - https://github.com/rust-lang/rust-clippy/pull/3478/files
-// we can safely allow this.
+///
+/// # Safety
+///
+/// This is unsafe because the structs are initialized to unverified data read from the input.
+/// `read_struct_slice` should only be called for plain old data structs. It is not endian safe.
pub unsafe fn read_struct_slice(f: &mut F, len: usize) -> Result> {
let mut out: Vec = Vec::with_capacity(len);
out.set_len(len);
diff --git a/utils/src/time.rs b/src/utils/src/time.rs
similarity index 100%
rename from utils/src/time.rs
rename to src/utils/src/time.rs
diff --git a/utils/src/validators.rs b/src/utils/src/validators.rs
similarity index 100%
rename from utils/src/validators.rs
rename to src/utils/src/validators.rs
diff --git a/virtio_gen/Cargo.toml b/src/virtio_gen/Cargo.toml
similarity index 100%
rename from virtio_gen/Cargo.toml
rename to src/virtio_gen/Cargo.toml
diff --git a/virtio_gen/patches/0001-virtio_gen-remove-derive-Debug-from-packed-struct.patch b/src/virtio_gen/patches/0001-virtio_gen-remove-derive-Debug-from-packed-struct.patch
similarity index 99%
rename from virtio_gen/patches/0001-virtio_gen-remove-derive-Debug-from-packed-struct.patch
rename to src/virtio_gen/patches/0001-virtio_gen-remove-derive-Debug-from-packed-struct.patch
index 8cce23e5507..a4f242dbf8c 100644
--- a/virtio_gen/patches/0001-virtio_gen-remove-derive-Debug-from-packed-struct.patch
+++ b/src/virtio_gen/patches/0001-virtio_gen-remove-derive-Debug-from-packed-struct.patch
@@ -26,6 +26,5 @@ index 0b68d09..a1c9dca 100644
pub struct virtio_net_ctrl_mac {
pub entries: __virtio32,
pub macs: __IncompleteArrayField<[__u8; 6usize]>,
---
+--
2.7.4
-
diff --git a/virtio_gen/src/lib.rs b/src/virtio_gen/src/lib.rs
similarity index 100%
rename from virtio_gen/src/lib.rs
rename to src/virtio_gen/src/lib.rs
diff --git a/virtio_gen/src/virtio_blk.rs b/src/virtio_gen/src/virtio_blk.rs
similarity index 100%
rename from virtio_gen/src/virtio_blk.rs
rename to src/virtio_gen/src/virtio_blk.rs
diff --git a/virtio_gen/src/virtio_net.rs b/src/virtio_gen/src/virtio_net.rs
similarity index 100%
rename from virtio_gen/src/virtio_net.rs
rename to src/virtio_gen/src/virtio_net.rs
diff --git a/virtio_gen/src/virtio_ring.rs b/src/virtio_gen/src/virtio_ring.rs
similarity index 100%
rename from virtio_gen/src/virtio_ring.rs
rename to src/virtio_gen/src/virtio_ring.rs
diff --git a/vmm/Cargo.toml b/src/vmm/Cargo.toml
similarity index 91%
rename from vmm/Cargo.toml
rename to src/vmm/Cargo.toml
index 26524f8d9b7..4f55611835d 100644
--- a/vmm/Cargo.toml
+++ b/src/vmm/Cargo.toml
@@ -4,10 +4,10 @@ version = "0.1.0"
authors = ["Amazon Firecracker team "]
[dependencies]
-kvm-bindings = "0.1"
-kvm-ioctls = "0.3.0"
+kvm-bindings = ">=0.1"
+kvm-ioctls = ">=0.3.0"
libc = ">=0.2.39"
-epoll = "=4.0.1"
+epoll = ">=4.0.1"
serde = ">=1.0.27"
serde_derive = ">=1.0.27"
serde_json = ">=1.0.9"
@@ -29,4 +29,3 @@ cpuid = { path = "../cpuid" }
[dev-dependencies]
tempfile = ">=3.0.2"
-
diff --git a/vmm/src/default_syscalls/filters.rs b/src/vmm/src/default_syscalls/filters.rs
similarity index 100%
rename from vmm/src/default_syscalls/filters.rs
rename to src/vmm/src/default_syscalls/filters.rs
diff --git a/vmm/src/default_syscalls/macros.rs b/src/vmm/src/default_syscalls/macros.rs
similarity index 100%
rename from vmm/src/default_syscalls/macros.rs
rename to src/vmm/src/default_syscalls/macros.rs
diff --git a/vmm/src/default_syscalls/mod.rs b/src/vmm/src/default_syscalls/mod.rs
similarity index 100%
rename from vmm/src/default_syscalls/mod.rs
rename to src/vmm/src/default_syscalls/mod.rs
diff --git a/vmm/src/device_manager/legacy.rs b/src/vmm/src/device_manager/legacy.rs
similarity index 100%
rename from vmm/src/device_manager/legacy.rs
rename to src/vmm/src/device_manager/legacy.rs
diff --git a/vmm/src/device_manager/mmio.rs b/src/vmm/src/device_manager/mmio.rs
similarity index 100%
rename from vmm/src/device_manager/mmio.rs
rename to src/vmm/src/device_manager/mmio.rs
diff --git a/vmm/src/device_manager/mod.rs b/src/vmm/src/device_manager/mod.rs
similarity index 100%
rename from vmm/src/device_manager/mod.rs
rename to src/vmm/src/device_manager/mod.rs
diff --git a/vmm/src/error.rs b/src/vmm/src/error.rs
similarity index 100%
rename from vmm/src/error.rs
rename to src/vmm/src/error.rs
diff --git a/vmm/src/lib.rs b/src/vmm/src/lib.rs
similarity index 100%
rename from vmm/src/lib.rs
rename to src/vmm/src/lib.rs
diff --git a/vmm/src/signal_handler.rs b/src/vmm/src/signal_handler.rs
similarity index 100%
rename from vmm/src/signal_handler.rs
rename to src/vmm/src/signal_handler.rs
diff --git a/vmm/src/vmm_config/boot_source.rs b/src/vmm/src/vmm_config/boot_source.rs
similarity index 100%
rename from vmm/src/vmm_config/boot_source.rs
rename to src/vmm/src/vmm_config/boot_source.rs
diff --git a/vmm/src/vmm_config/device_config.rs b/src/vmm/src/vmm_config/device_config.rs
similarity index 100%
rename from vmm/src/vmm_config/device_config.rs
rename to src/vmm/src/vmm_config/device_config.rs
diff --git a/vmm/src/vmm_config/drive.rs b/src/vmm/src/vmm_config/drive.rs
similarity index 100%
rename from vmm/src/vmm_config/drive.rs
rename to src/vmm/src/vmm_config/drive.rs
diff --git a/vmm/src/vmm_config/instance_info.rs b/src/vmm/src/vmm_config/instance_info.rs
similarity index 100%
rename from vmm/src/vmm_config/instance_info.rs
rename to src/vmm/src/vmm_config/instance_info.rs
diff --git a/vmm/src/vmm_config/logger.rs b/src/vmm/src/vmm_config/logger.rs
similarity index 100%
rename from vmm/src/vmm_config/logger.rs
rename to src/vmm/src/vmm_config/logger.rs
diff --git a/vmm/src/vmm_config/machine_config.rs b/src/vmm/src/vmm_config/machine_config.rs
similarity index 100%
rename from vmm/src/vmm_config/machine_config.rs
rename to src/vmm/src/vmm_config/machine_config.rs
diff --git a/vmm/src/vmm_config/mod.rs b/src/vmm/src/vmm_config/mod.rs
similarity index 100%
rename from vmm/src/vmm_config/mod.rs
rename to src/vmm/src/vmm_config/mod.rs
diff --git a/vmm/src/vmm_config/net.rs b/src/vmm/src/vmm_config/net.rs
similarity index 100%
rename from vmm/src/vmm_config/net.rs
rename to src/vmm/src/vmm_config/net.rs
diff --git a/vmm/src/vmm_config/vsock.rs b/src/vmm/src/vmm_config/vsock.rs
similarity index 100%
rename from vmm/src/vmm_config/vsock.rs
rename to src/vmm/src/vmm_config/vsock.rs
diff --git a/vmm/src/vstate.rs b/src/vmm/src/vstate.rs
similarity index 100%
rename from vmm/src/vstate.rs
rename to src/vmm/src/vstate.rs
diff --git a/tests/integration_tests/build/test_coverage.py b/tests/integration_tests/build/test_coverage.py
index 9f83f230d11..37012d1835b 100644
--- a/tests/integration_tests/build/test_coverage.py
+++ b/tests/integration_tests/build/test_coverage.py
@@ -19,7 +19,7 @@
import host_tools.cargo_build as host # pylint: disable=import-error
-COVERAGE_TARGET_PCT = 84.8
+COVERAGE_TARGET_PCT = 85.2
COVERAGE_MAX_DELTA = 0.01
CARGO_KCOV_REL_PATH = os.path.join(host.CARGO_BUILD_REL_PATH, 'kcov')
diff --git a/tests/integration_tests/build/test_style.py b/tests/integration_tests/build/test_style.py
index ec8bb37aab4..4df3e34714a 100644
--- a/tests/integration_tests/build/test_style.py
+++ b/tests/integration_tests/build/test_style.py
@@ -116,6 +116,6 @@ def check_swagger_style(yaml_spec):
def test_firecracker_swagger():
"""Fail if Firecracker swagger specification is malformed."""
yaml_spec = os.path.normpath(
- os.path.join(os.getcwd(), '../api_server/swagger/firecracker.yaml')
+ os.path.join(os.getcwd(), '../src/api_server/swagger/firecracker.yaml')
)
check_swagger_style(yaml_spec)
diff --git a/tests/integration_tests/build/test_unittests.py b/tests/integration_tests/build/test_unittests.py
index ff5385642ec..d632ec2311a 100644
--- a/tests/integration_tests/build/test_unittests.py
+++ b/tests/integration_tests/build/test_unittests.py
@@ -36,12 +36,6 @@ def test_unittests(test_session_root_path, target):
" are already run as part of testing"
" code-coverage.")
- if MACHINE == "x86_64":
- extra_args += "--all-features "
-
- if MACHINE == "aarch64":
- extra_args += "--exclude cpuid "
-
host.cargo_test(
test_session_root_path,
extra_args=extra_args,
diff --git a/tests/integration_tests/security/demo_seccomp/Cargo.toml b/tests/integration_tests/security/demo_seccomp/Cargo.toml
index 4fe34b339d2..a4b8d4e13b0 100644
--- a/tests/integration_tests/security/demo_seccomp/Cargo.toml
+++ b/tests/integration_tests/security/demo_seccomp/Cargo.toml
@@ -6,6 +6,6 @@ authors = ["Amazon Firecracker team "]
[dependencies]
libc = ">0.2.39"
-seccomp = { path = "../../../../seccomp" }
+seccomp = { path = "../../../../src/seccomp" }
[workspace]
diff --git a/tests/testrun.sh b/tests/testrun.sh
index b3517693229..916f2137ca6 100755
--- a/tests/testrun.sh
+++ b/tests/testrun.sh
@@ -16,7 +16,7 @@
# attempt not to litter.
#
# # Solution
-#
+#
# - Everything that can go in a temporary directory will go in a temporary
# directory.
# - Use environment variables for state (to benefit form bash dynamic scoping).
@@ -27,7 +27,7 @@
# - All arguments given to this script are passed to the test runner.
#
# # Caveats
-#
+#
# - You need to run this script in the `tests/` dir of the `firecracker` repo.
# - Dependencies installed via the system's package manager (e.g., `python3`)
# are not uninstalled.
@@ -100,7 +100,7 @@ main() {
setup
say "Starting testrun: pytest $*"
-
+
pytest "$@"
# Run the test runner, `pytest`, passing the non-option arguments.
@@ -135,7 +135,7 @@ parse_options() {
set -- $opt
# Sets $opt as the options string.
-
+
while true; do
case "$1" in
-h | --help)
@@ -233,7 +233,7 @@ exit_if_in_rust_tmpenv() {
ensure_root() {
if [[ $EUID -ne 0 ]]; then
- err "$0 must be run as root."
+ err "$0 must be run as root."
fi
}
@@ -347,8 +347,8 @@ create_rust_tmpenv() {
export CARGO_HOME="$RUST_TMPENV/cargo"
record_global_symbol CARGO_HOME
-
- export ORIGINAL_PATH=$PATH
+
+ export ORIGINAL_PATH=$PATH
record_global_symbol ORIGINAL_PATH
export PATH="$CARGO_HOME/bin:$PATH"
# Bash executes the first matching executable found in the PATH dir list,
@@ -362,7 +362,7 @@ install_rust_and_deps() {
say "Setup: Installing Rust to: $RUST_TMPENV"
ensure curl $RUSTUP_URL -sSf | sh -s -- -y --no-modify-path >/dev/null 2>&1
-
+
ensure_cmd rustup
ensure_cmd cargo
ensure_cmd rustc
@@ -378,7 +378,7 @@ install_rust_and_deps() {
declare deps="${KCOV_YUM_DEPS[@]}"
elif [ $PKG_MANAGER == "apt-get" ]; then
declare deps="${KCOV_APT_GET_DEPS[@]}"
- fi
+ fi
ensure $PKG_MANAGER install -q -y $deps >/dev/null 2>&1
ensure cargo install -f -q cargo-kcov
@@ -471,7 +471,7 @@ ensure() {
ensure_cmd() {
# Ensures the existence of a command in the current environment. If it does
# not exist, terminate with an error showing the missing command.
- if ! check_cmd "$1"; then
+ if ! check_cmd "$1"; then
err "Need '$1' (command not found)."
fi
}
diff --git a/tools/devctr/Dockerfile.aarch64 b/tools/devctr/Dockerfile.aarch64
index add6edb72cf..de1f0634bf3 100644
--- a/tools/devctr/Dockerfile.aarch64
+++ b/tools/devctr/Dockerfile.aarch64
@@ -4,7 +4,7 @@ FROM ubuntu:18.04
# The Rust toolchain layer will get updated most frequently, but we could keep the system
# dependencies layer intact for much longer.
-ARG RUST_TOOLCHAIN="1.38.0"
+ARG RUST_TOOLCHAIN="1.39.0"
ARG TMP_BUILD_DIR=/tmp/build
ARG FIRECRACKER_SRC_DIR="/firecracker"
ARG FIRECRACKER_BUILD_DIR="$FIRECRACKER_SRC_DIR/build"
@@ -14,7 +14,6 @@ ARG CARGO_GIT_REGISTRY_DIR="$FIRECRACKER_BUILD_DIR/cargo_git_registry"
ENV CARGO_HOME=/usr/local/rust
ENV RUSTUP_HOME=/usr/local/rust
ENV PATH="$PATH:$CARGO_HOME/bin"
-ENV CARGO_TARGET_DIR="$FIRECRACKER_BUILD_DIR/cargo_target"
# Install system dependecies
#
@@ -72,6 +71,5 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$RUST_TOOL
&& ln -s "$CARGO_REGISTRY_DIR" "$CARGO_HOME/registry" \
&& rm -rf "$CARGO_HOME/git" \
&& ln -s "$CARGO_GIT_REGISTRY_DIR" "$CARGO_HOME/git"
-
-WORKDIR "$FIRECRACKER_SRC_DIR"
+WORKDIR "$FIRECRACKER_SRC_DIR"
diff --git a/tools/devctr/Dockerfile.x86_64 b/tools/devctr/Dockerfile.x86_64
index 365069ba3f6..c6d76c1a423 100644
--- a/tools/devctr/Dockerfile.x86_64
+++ b/tools/devctr/Dockerfile.x86_64
@@ -4,7 +4,7 @@ FROM ubuntu:18.04
# The Rust toolchain layer will get updated most frequently, but we could keep the system
# dependencies layer intact for much longer.
-ARG RUST_TOOLCHAIN="1.38.0"
+ARG RUST_TOOLCHAIN="1.39.0"
ARG TMP_BUILD_DIR=/tmp/build
ARG FIRECRACKER_SRC_DIR="/firecracker"
ARG FIRECRACKER_BUILD_DIR="$FIRECRACKER_SRC_DIR/build"
@@ -14,7 +14,6 @@ ARG CARGO_GIT_REGISTRY_DIR="$FIRECRACKER_BUILD_DIR/cargo_git_registry"
ENV CARGO_HOME=/usr/local/rust
ENV RUSTUP_HOME=/usr/local/rust
ENV PATH="$PATH:$CARGO_HOME/bin"
-ENV CARGO_TARGET_DIR="$FIRECRACKER_BUILD_DIR/cargo_target"
# Install system dependecies
#
@@ -81,6 +80,5 @@ RUN mkdir "$TMP_BUILD_DIR" \
&& ln -s "$CARGO_GIT_REGISTRY_DIR" "$CARGO_HOME/git" \
&& cd / \
&& rm -rf "$TMP_BUILD_DIR"
-
-WORKDIR "$FIRECRACKER_SRC_DIR"
+WORKDIR "$FIRECRACKER_SRC_DIR"
diff --git a/tools/devtool b/tools/devtool
index 3b55fdaffef..b979072b330 100755
--- a/tools/devtool
+++ b/tools/devtool
@@ -73,7 +73,7 @@
# Development container image (name:tag)
# This should be updated whenever we upgrade the development container.
# (Yet another step on our way to reproducible builds.)
-DEVCTR_IMAGE="fcuvm/dev:v12"
+DEVCTR_IMAGE="fcuvm/dev:v13"
# Naming things is hard
MY_NAME="Firecracker $(basename "$0")"
@@ -455,7 +455,7 @@ cmd_build() {
# Cargo uses the debug profile by default. If we're building the release
# binaries, we need to pass an extra argument to cargo.
cargo_args=("$@")
-
+
# Add the default target if we did not get that argument in the build command.
add_default_target=true
for flag in "${@}"; do
@@ -666,16 +666,16 @@ cmd_prepare_release() {
ensure_build_dir
# Get current version from the swagger spec.
- swagger="$FC_ROOT_DIR/api_server/swagger/firecracker.yaml"
+ swagger="$FC_ROOT_DIR/src/api_server/swagger/firecracker.yaml"
curr_ver=$(grep "version: " "$swagger" | awk -F : '{print $2}' | tr -d ' ')
say "Updating from $curr_ver to $version ..."
get_user_confirmation || die "Aborted."
# Update version in files.
- files_to_change=("$swagger" \
- "$FC_ROOT_DIR/Cargo.toml" \
- "$FC_ROOT_DIR/jailer/Cargo.toml")
+ files_to_change=("$swagger" \
+ "$FC_ROOT_DIR/src/firecracker/Cargo.toml" \
+ "$FC_ROOT_DIR/src/jailer/Cargo.toml")
say "Updating source files:"
for file in "${files_to_change[@]}"; do
say "- $file"