Skip to content

Commit c979583

Browse files
authored
Merge branch 'main' into allow-snapshot-tap-changes
2 parents ff7fabd + 3fb06e9 commit c979583

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1152
-4477
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ and this project adheres to
1616
unnecessary fields (`max_connections` and `max_pending_resets`) from the
1717
snapshot format, bumping the snapshot version to 5.0.0. Users need to
1818
regenerate snapshots.
19+
- [#4926](https://github.com/firecracker-microvm/firecracker/pull/4926): Replace
20+
underlying implementation for seccompiler from in house one in favor of
21+
`libseccomp` which produces smaller and more optimized BPF code.
1922

2023
### Deprecated
2124

@@ -28,6 +31,10 @@ and this project adheres to
2831
- [#4916](https://github.com/firecracker-microvm/firecracker/pull/4916): Fixed
2932
`IovDeque` implementation to work with any host page size. This fixes
3033
virtio-net device on non 4K host kernels.
34+
- [#4991](https://github.com/firecracker-microvm/firecracker/pull/4991): Fixed
35+
`mem_size_mib` and `track_dirty_pages` being mandatory for all
36+
`PATCH /machine-config` requests. Now, they can be omitted which leaves these
37+
parts of the machine configuration unchanged.
3138

3239
## [1.10.1]
3340

Cargo.lock

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

NOTICE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ SPDX-License-Identifier: Apache-2.0
55
Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
66
Use of this source code is governed by a BSD-style license that can be
77
found in the THIRD-PARTY file.
8+
9+
The Firecracker release bundle includes libseccomp which is available
10+
under the LGPLv2.1 license. This is used in the Firecracker build process
11+
to produce cBPF bytecode that is shipped alongside Firecracker for use by
12+
the Linux kernel.

src/cpu-template-helper/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn run(cli: Cli) -> Result<(), HelperError> {
161161
let (vmm, vm_resources) = utils::build_microvm_from_config(config, template)?;
162162

163163
let cpu_template = vm_resources
164-
.vm_config
164+
.machine_config
165165
.cpu_template
166166
.get_cpu_template()?
167167
.into_owned();

src/cpu-template-helper/src/utils/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::sync::{Arc, Mutex};
1212
use vmm::builder::{build_microvm_for_boot, StartMicrovmError};
1313
use vmm::cpu_config::templates::{CustomCpuTemplate, Numeric};
1414
use vmm::resources::VmResources;
15-
use vmm::seccomp_filters::get_empty_filters;
15+
use vmm::seccomp::get_empty_filters;
1616
use vmm::vmm_config::instance_info::{InstanceInfo, VmState};
1717
use vmm::{EventManager, Vmm, HTTP_MAX_PAYLOAD_SIZE};
1818
use vmm_sys_util::tempfile::TempFile;

src/firecracker/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ libc = "0.2.169"
2222
log-instrument = { path = "../log-instrument", optional = true }
2323
micro_http = { git = "https://github.com/firecracker-microvm/micro-http" }
2424

25-
seccompiler = { path = "../seccompiler" }
2625
serde = { version = "1.0.217", features = ["derive"] }
2726
serde_derive = "1.0.136"
2827
serde_json = "1.0.135"
@@ -42,13 +41,12 @@ serde = { version = "1.0.217", features = ["derive"] }
4241
userfaultfd = "0.8.1"
4342

4443
[build-dependencies]
45-
bincode = "1.2.1"
4644
seccompiler = { path = "../seccompiler" }
4745
serde = { version = "1.0.217" }
4846
serde_json = "1.0.135"
4947

5048
[features]
51-
tracing = ["log-instrument", "seccompiler/tracing", "utils/tracing", "vmm/tracing"]
49+
tracing = ["log-instrument", "utils/tracing", "vmm/tracing"]
5250
gdb = ["vmm/gdb"]
5351

5452
[lints]

src/firecracker/build.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4-
use std::collections::BTreeMap;
5-
use std::fs::File;
64
use std::path::Path;
75

8-
use seccompiler::common::BpfProgram;
9-
use seccompiler::compiler::{Compiler, JsonFile};
10-
116
const ADVANCED_BINARY_FILTER_FILE_NAME: &str = "seccomp_filter.bpf";
127

138
const JSON_DIR: &str = "../../resources/seccomp";
@@ -44,19 +39,7 @@ fn main() {
4439
// Also retrigger the build script on any seccompiler source code change.
4540
println!("cargo:rerun-if-changed={}", SECCOMPILER_SRC_DIR);
4641

47-
let input = std::fs::read_to_string(seccomp_json_path).expect("Correct input file");
48-
let filters: JsonFile = serde_json::from_str(&input).expect("Input read");
49-
50-
let arch = target_arch.as_str().try_into().expect("Target");
51-
let compiler = Compiler::new(arch);
52-
53-
// transform the IR into a Map of BPFPrograms
54-
let bpf_data: BTreeMap<String, BpfProgram> = compiler
55-
.compile_blob(filters.0, false)
56-
.expect("Successfull compilation");
57-
58-
// serialize the BPF programs & output them to a file
5942
let out_path = format!("{}/{}", out_dir, ADVANCED_BINARY_FILTER_FILE_NAME);
60-
let output_file = File::create(out_path).expect("Create seccompiler output path");
61-
bincode::serialize_into(output_file, &bpf_data).expect("Seccompiler serialization");
43+
seccompiler::compile_bpf(&seccomp_json_path, &target_arch, &out_path, false)
44+
.expect("Cannot compile seccomp filters");
6245
}

src/firecracker/examples/seccomp/jailer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::fs::File;
55
use std::os::unix::process::CommandExt;
66
use std::process::{Command, Stdio};
77

8-
use seccompiler::{apply_filter, deserialize_binary};
8+
use vmm::seccomp::{apply_filter, deserialize_binary};
99

1010
fn main() {
1111
let args: Vec<String> = args().collect();

src/firecracker/examples/seccomp/panic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::env::args;
44
use std::fs::File;
55

6-
use seccompiler::{apply_filter, deserialize_binary};
6+
use vmm::seccomp::{apply_filter, deserialize_binary};
77

88
fn main() {
99
let args: Vec<String> = args().collect();

src/firecracker/examples/uffd/fault_all_handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ fn main() {
2424
let (stream, _) = listener.accept().expect("Cannot listen on UDS socket");
2525

2626
let mut runtime = Runtime::new(stream, file);
27+
runtime.install_panic_hook();
2728
runtime.run(|uffd_handler: &mut UffdHandler| {
2829
// Read an event from the userfaultfd.
2930
let event = uffd_handler

0 commit comments

Comments
 (0)