Skip to content

Commit e725273

Browse files
authored
Merge branch 'main' into rustify-snapshot-module
2 parents b268b25 + 9b6f067 commit e725273

File tree

51 files changed

+547
-545
lines changed

Some content is hidden

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

51 files changed

+547
-545
lines changed

.buildkite/pipeline_pr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
changed_files = get_changed_files()
2929

3030
# run sanity build of devtool if Dockerfile is changed
31-
if any(x.name == "Dockerfile" for x in changed_files):
31+
if any(x.parent.name == "devctr" for x in changed_files):
3232
pipeline.build_group_per_arch(
3333
"🐋 Dev Container Sanity Build",
34-
"./tools/devtool -y build_devctr",
34+
"./tools/devtool -y build_devctr && DEVCTR_IMAGE_TAG=latest ./tools/devtool test -- integration_tests/functional/test_api.py",
3535
)
3636

3737
if any(
File renamed without changes.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ missing_debug_implementations = "warn"
1313
[workspace.lints.clippy]
1414
ptr_as_ptr = "warn"
1515
undocumented_unsafe_blocks = "warn"
16-
cast_lossless = "warn"
1716
cast_possible_truncation = "warn"
1817
cast_possible_wrap = "warn"
1918
cast_sign_loss = "warn"

deny.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[licenses]
2+
version = 2
23
allow = [
34
"MIT",
45
"Apache-2.0",
@@ -8,12 +9,6 @@ allow = [
89
"OpenSSL"
910
]
1011

11-
# Lint level for licenses considered copyleft
12-
copyleft = "deny"
13-
14-
# The lint level for crates which do not have a detectable license
15-
unlicensed = "deny"
16-
1712
[[bans.deny]]
1813
name = "serde_derive"
1914
version = ">1.0.171, < 1.0.184"

docs/device-api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ specification:
125125
| | track_dirty_pages | O | O | O | O | O | O |
126126
| | vcpu_count | O | O | O | O | O | O |
127127

128+
## Known device limitations
129+
130+
If more than 64 devices are configured for a VM in total on aarch64, only first
131+
64 of them are functional
132+
([related issue](https://github.com/firecracker-microvm/firecracker/issues/4207)).
133+
128134
## Instance Actions
129135

130136
All instance actions can be found in the [Swagger](https://swagger.io)

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# allowlisted using a toolchain that requires it, causing the A/B-test to
1212
# always fail.
1313
[toolchain]
14-
channel = "1.76.0"
14+
channel = "1.79.0"
1515
targets = ["x86_64-unknown-linux-musl", "aarch64-unknown-linux-musl"]
1616
profile = "minimal"
1717

src/acpi-tables/src/aml.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ pub type Usize = usize;
262262

263263
impl Aml for Usize {
264264
fn append_aml_bytes(&self, bytes: &mut Vec<u8>) {
265-
if *self <= u8::max_value().into() {
265+
if *self <= u8::MAX.into() {
266266
TryInto::<u8>::try_into(*self)
267267
.unwrap()
268268
.append_aml_bytes(bytes)
269-
} else if *self <= u16::max_value().into() {
269+
} else if *self <= u16::MAX.into() {
270270
TryInto::<u16>::try_into(*self)
271271
.unwrap()
272272
.append_aml_bytes(bytes)
273-
} else if *self <= u32::max_value() as usize {
273+
} else if *self <= u32::MAX as usize {
274274
TryInto::<u32>::try_into(*self)
275275
.unwrap()
276276
.append_aml_bytes(bytes)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ mod tests {
299299

300300
#[test]
301301
fn test_template_strip_command() {
302-
let files = vec![generate_sample_template(), generate_sample_template()];
302+
let files = [generate_sample_template(), generate_sample_template()];
303303

304304
let mut args = vec!["cpu-template-helper", "template", "strip", "-p"];
305305
let paths = files

src/jailer/src/env.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,25 @@ fn dup2(old_fd: libc::c_int, new_fd: libc::c_int) -> Result<(), JailerError> {
8080
// manner to the fork syscall. The libc wrapper prevents use of a NULL stack pointer, so we will
8181
// call the syscall directly.
8282
fn clone(child_stack: *mut libc::c_void, flags: libc::c_int) -> Result<libc::c_int, JailerError> {
83-
// Clone parameters order is different between x86_64 and aarch64.
84-
#[cfg(target_arch = "x86_64")]
85-
return SyscallReturnCode(
83+
SyscallReturnCode(
8684
// SAFETY: This is safe because we are using a library function with valid parameters.
8785
libc::c_int::try_from(unsafe {
86+
// Note: the order of arguments in the raw syscall differs between platforms.
87+
// On x86-64, for example, the parameters passed are `flags`, `stack`, `parent_tid`,
88+
// `child_tid`, and `tls`. But on On x86-32, and several other common architectures
89+
// (including score, ARM, ARM 64) the order of the last two arguments is reversed,
90+
// and instead we must pass `flags`, `stack`, `parent_tid`, `tls`, and `child_tid`.
91+
// This difference in architecture currently doesn't matter because the last 2
92+
// arguments are all 0 but if this were to change we should add an attribute such as
93+
// #[cfg(target_arch = "x86_64")] or #[cfg(target_arch = "aarch64")] for each different
94+
// call.
8895
libc::syscall(libc::SYS_clone, flags, child_stack, 0, 0, 0)
8996
})
9097
// Unwrap is needed because PIDs are 32-bit.
9198
.unwrap(),
9299
)
93100
.into_result()
94-
.map_err(JailerError::Clone);
95-
#[cfg(target_arch = "aarch64")]
96-
return SyscallReturnCode(
97-
// SAFETY: This is safe because we are using a library function with valid parameters.
98-
libc::c_int::try_from(unsafe {
99-
libc::syscall(libc::SYS_clone, flags, child_stack, 0, 0, 0)
100-
})
101-
// Unwrap is needed because PIDs are 32-bit.
102-
.unwrap(),
103-
)
104-
.into_result()
105-
.map_err(JailerError::Clone);
101+
.map_err(JailerError::Clone)
106102
}
107103

108104
#[derive(Debug, thiserror::Error)]

src/seccompiler/src/backend.rs

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ impl SeccompRule {
554554
offset: &mut u8,
555555
) {
556556
// Tries to detect whether prepending the current condition will produce an unjumpable
557-
// offset (since BPF jumps are a maximum of 255 instructions, which is std::u8::MAX).
557+
// offset (since BPF jumps are a maximum of 255 instructions, which is u8::MAX).
558558
if offset.checked_add(CONDITION_MAX_LEN + 1).is_none() {
559559
// If that is the case, three additional helper jumps are prepended and the offset
560560
// is reset to 1.
@@ -1010,15 +1010,15 @@ mod tests {
10101010
let rules = vec![allow_syscall_if(
10111011
libc::SYS_ioctl,
10121012
vec![SeccompRule::new(
1013-
vec![Cond::new(2, SeccompCmpArgLen::Qword, Eq, std::u64::MAX).unwrap()],
1013+
vec![Cond::new(2, SeccompCmpArgLen::Qword, Eq, u64::MAX).unwrap()],
10141014
SeccompAction::Allow,
10151015
)],
10161016
)];
10171017
// check syscalls that are supposed to work
10181018
validate_seccomp_filter(
10191019
rules.clone(),
10201020
|| unsafe {
1021-
libc::ioctl(0, 0, std::u64::MAX);
1021+
libc::ioctl(0, 0, u64::MAX);
10221022
},
10231023
false,
10241024
);
@@ -1064,16 +1064,16 @@ mod tests {
10641064
let rules = vec![allow_syscall_if(
10651065
libc::SYS_ioctl,
10661066
vec![SeccompRule::new(
1067-
vec![Cond::new(2, SeccompCmpArgLen::Qword, Ge, u64::from(std::u32::MAX)).unwrap()],
1067+
vec![Cond::new(2, SeccompCmpArgLen::Qword, Ge, u64::from(u32::MAX)).unwrap()],
10681068
SeccompAction::Allow,
10691069
)],
10701070
)];
10711071
// check syscalls that are supposed to work
10721072
validate_seccomp_filter(
10731073
rules.clone(),
10741074
|| unsafe {
1075-
libc::ioctl(0, 0, u64::from(std::u32::MAX));
1076-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 1);
1075+
libc::ioctl(0, 0, u64::from(u32::MAX));
1076+
libc::ioctl(0, 0, u64::from(u32::MAX) + 1);
10771077
},
10781078
false,
10791079
);
@@ -1118,29 +1118,23 @@ mod tests {
11181118
let rules = vec![allow_syscall_if(
11191119
libc::SYS_ioctl,
11201120
vec![SeccompRule::new(
1121-
vec![Cond::new(
1122-
2,
1123-
SeccompCmpArgLen::Qword,
1124-
Gt,
1125-
u64::from(std::u32::MAX) + 10,
1126-
)
1127-
.unwrap()],
1121+
vec![Cond::new(2, SeccompCmpArgLen::Qword, Gt, u64::from(u32::MAX) + 10).unwrap()],
11281122
SeccompAction::Allow,
11291123
)],
11301124
)];
11311125
// check syscalls that are supposed to work
11321126
validate_seccomp_filter(
11331127
rules.clone(),
11341128
|| unsafe {
1135-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 11);
1129+
libc::ioctl(0, 0, u64::from(u32::MAX) + 11);
11361130
},
11371131
false,
11381132
);
11391133
// check syscalls that are not supposed to work
11401134
validate_seccomp_filter(
11411135
rules,
11421136
|| unsafe {
1143-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 10);
1137+
libc::ioctl(0, 0, u64::from(u32::MAX) + 10);
11441138
},
11451139
true,
11461140
);
@@ -1178,30 +1172,24 @@ mod tests {
11781172
let rules = vec![allow_syscall_if(
11791173
libc::SYS_ioctl,
11801174
vec![SeccompRule::new(
1181-
vec![Cond::new(
1182-
2,
1183-
SeccompCmpArgLen::Qword,
1184-
Le,
1185-
u64::from(std::u32::MAX) + 10,
1186-
)
1187-
.unwrap()],
1175+
vec![Cond::new(2, SeccompCmpArgLen::Qword, Le, u64::from(u32::MAX) + 10).unwrap()],
11881176
SeccompAction::Allow,
11891177
)],
11901178
)];
11911179
// check syscalls that are supposed to work
11921180
validate_seccomp_filter(
11931181
rules.clone(),
11941182
|| unsafe {
1195-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 10);
1196-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 9);
1183+
libc::ioctl(0, 0, u64::from(u32::MAX) + 10);
1184+
libc::ioctl(0, 0, u64::from(u32::MAX) + 9);
11971185
},
11981186
false,
11991187
);
12001188
// check syscalls that are not supposed to work
12011189
validate_seccomp_filter(
12021190
rules,
12031191
|| unsafe {
1204-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 11);
1192+
libc::ioctl(0, 0, u64::from(u32::MAX) + 11);
12051193
},
12061194
true,
12071195
);
@@ -1238,29 +1226,23 @@ mod tests {
12381226
let rules = vec![allow_syscall_if(
12391227
libc::SYS_ioctl,
12401228
vec![SeccompRule::new(
1241-
vec![Cond::new(
1242-
2,
1243-
SeccompCmpArgLen::Qword,
1244-
Lt,
1245-
u64::from(std::u32::MAX) + 10,
1246-
)
1247-
.unwrap()],
1229+
vec![Cond::new(2, SeccompCmpArgLen::Qword, Lt, u64::from(u32::MAX) + 10).unwrap()],
12481230
SeccompAction::Allow,
12491231
)],
12501232
)];
12511233
// check syscalls that are supposed to work
12521234
validate_seccomp_filter(
12531235
rules.clone(),
12541236
|| unsafe {
1255-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 9);
1237+
libc::ioctl(0, 0, u64::from(u32::MAX) + 9);
12561238
},
12571239
false,
12581240
);
12591241
// check syscalls that are not supposed to work
12601242
validate_seccomp_filter(
12611243
rules,
12621244
|| unsafe {
1263-
libc::ioctl(0, 0, u64::from(std::u32::MAX) + 10);
1245+
libc::ioctl(0, 0, u64::from(u32::MAX) + 10);
12641246
},
12651247
true,
12661248
);
@@ -1307,8 +1289,8 @@ mod tests {
13071289
vec![Cond::new(
13081290
2,
13091291
SeccompCmpArgLen::Qword,
1310-
MaskedEq(u64::from(std::u32::MAX)),
1311-
std::u64::MAX,
1292+
MaskedEq(u64::from(u32::MAX)),
1293+
u64::MAX,
13121294
)
13131295
.unwrap()],
13141296
SeccompAction::Allow,
@@ -1318,8 +1300,8 @@ mod tests {
13181300
validate_seccomp_filter(
13191301
rules.clone(),
13201302
|| unsafe {
1321-
libc::ioctl(0, 0, u64::from(std::u32::MAX));
1322-
libc::ioctl(0, 0, std::u64::MAX);
1303+
libc::ioctl(0, 0, u64::from(u32::MAX));
1304+
libc::ioctl(0, 0, u64::MAX);
13231305
},
13241306
false,
13251307
);
@@ -1364,7 +1346,7 @@ mod tests {
13641346
let rules = vec![allow_syscall_if(
13651347
libc::SYS_ioctl,
13661348
vec![SeccompRule::new(
1367-
vec![Cond::new(2, SeccompCmpArgLen::Qword, Ne, std::u64::MAX).unwrap()],
1349+
vec![Cond::new(2, SeccompCmpArgLen::Qword, Ne, u64::MAX).unwrap()],
13681350
SeccompAction::Allow,
13691351
)],
13701352
)];
@@ -1380,7 +1362,7 @@ mod tests {
13801362
validate_seccomp_filter(
13811363
rules,
13821364
|| unsafe {
1383-
libc::ioctl(0, 0, std::u64::MAX);
1365+
libc::ioctl(0, 0, u64::MAX);
13841366
},
13851367
true,
13861368
);

0 commit comments

Comments
 (0)