Skip to content

Commit 45bc481

Browse files
authored
Merge branch 'main' into snapshot-latency-test
2 parents 2daa6bf + c54ecd7 commit 45bc481

File tree

3 files changed

+40
-6
lines changed

3 files changed

+40
-6
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ and this project adheres to
1010

1111
### Added
1212

13+
### Changed
14+
15+
### Deprecated
16+
17+
### Removed
18+
19+
### Fixed
20+
21+
## [1.11.0]
22+
23+
### Added
24+
1325
- [#4987](https://github.com/firecracker-microvm/firecracker/pull/4987): Reset
1426
physical counter register (`CNTPCT_EL0`) on VM startup. This avoids VM reading
1527
the host physical counter value. This is only possible on 6.4 and newer
@@ -64,6 +76,9 @@ and this project adheres to
6476
- [#5046](https://github.com/firecracker-microvm/firecracker/pull/5046): Retry
6577
KVM_CREATE_VM on EINTR that occasionally happen on heavily loaded hosts to
6678
improve reliability of microVM creation.
79+
- [#5052](https://github.com/firecracker-microvm/firecracker/pull/5052): Build
80+
the empty seccomp policy as default for debug builds to avoid crashes on
81+
syscalls introduced by debug assertions from Rust 1.80.0.
6782

6883
## [1.10.1]
6984

docs/seccomp.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ follows:
1111
- API - right before launching the HTTP server;
1212
- VCPUs - right before executing guest code.
1313

14-
**Note**: On experimental GNU targets, there are no default seccomp filters
15-
installed, since they are not intended for production use.
14+
> [!WARNING]
15+
>
16+
> On debug binaries and experimental GNU targets, there are no default seccomp
17+
> filters installed, since they are not intended for production use.
1618
1719
Firecracker uses JSON files for expressing the filter rules and relies on the
1820
[seccompiler](seccompiler.md) tool for all the seccomp functionality.
@@ -58,6 +60,12 @@ Potential use cases:
5860
- Users of experimentally-supported targets (like GNU libc builds) may be able
5961
to use this feature to implement seccomp filters without needing to have a
6062
custom build of Firecracker.
63+
- Users of debug binaries who need to use a seccomp filter for any reason will
64+
be able to use this feature to implement seccomp filters without needing to
65+
have a custom build of Firecracker. Note: there may be some differences in
66+
syscalls between `debug` and `release` builds. A non-comprehensive list is:
67+
- `fcntl(F_GETFD)` is used by debug assertions to verify a dropped `fd` is
68+
valid.
6169
- Faced with a _theoretical_ production issue, due to a syscall that was issued
6270
by the Firecracker process, but not allowed by the seccomp policy, one may use
6371
a custom filter in order to quickly mitigate the issue. This can speed up the

src/firecracker/build.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,34 @@ const SECCOMPILER_SRC_DIR: &str = "../seccompiler/src";
1414
fn main() {
1515
// Target triple
1616
let target = std::env::var("TARGET").expect("Missing target.");
17+
let debug: bool = std::env::var("DEBUG")
18+
.expect("Missing debug.")
19+
.parse()
20+
.expect("Invalid env variable DEBUG");
1721
let out_dir = std::env::var("OUT_DIR").expect("Missing build-level OUT_DIR.");
1822
// Target arch (x86_64 / aarch64)
1923
let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").expect("Missing target arch.");
2024

2125
let seccomp_json_path = format!("{}/{}.json", JSON_DIR, target);
22-
// If the current target doesn't have a default filter, use a default, empty filter.
26+
// If the current target doesn't have a default filter, or if we're building a debug binary,
27+
// use a default, empty filter.
2328
// This is to make sure that Firecracker builds even with libc toolchains for which we don't
2429
// provide a default filter. For example, GNU libc.
25-
let seccomp_json_path = if Path::new(&seccomp_json_path).exists() {
26-
seccomp_json_path
27-
} else {
30+
let seccomp_json_path = if debug {
31+
println!(
32+
"cargo:warning=Using empty default seccomp policy for debug builds: \
33+
`resources/seccomp/unimplemented.json`."
34+
);
35+
format!("{}/unimplemented.json", JSON_DIR)
36+
} else if !Path::new(&seccomp_json_path).exists() {
2837
println!(
2938
"cargo:warning=No default seccomp policy for target: {}. Defaulting to \
3039
`resources/seccomp/unimplemented.json`.",
3140
target
3241
);
3342
format!("{}/unimplemented.json", JSON_DIR)
43+
} else {
44+
seccomp_json_path
3445
};
3546

3647
// Retrigger the build script if the JSON file has changed.

0 commit comments

Comments
 (0)