Skip to content

Commit 997e71c

Browse files
Alexandra Iordachealexandruag
authored andcommitted
seccomp: allow madvise(*, *, MADV_DONTNEED)
The musl allocator calls it to punch holes in large chunks of allocated memory: https://elixir.bootlin.com/musl/v1.1.20/source/src/malloc/malloc.c#L501 Signed-off-by: Alexandra Iordache <[email protected]>
1 parent 0a33413 commit 997e71c

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Fixed
6+
7+
- A `madvise` call issued by the `musl` allocator was added to the seccomp
8+
whitelist to prevent Firecracker from terminating abruptly when allocating
9+
memory in certain conditions.
10+
311
## [0.15.0]
412

513
### Added

Cargo.lock

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

vmm/src/default_syscalls/x86_64.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ pub const ALLOWED_SYSCALLS: &[i64] = &[
2323
libc::SYS_futex,
2424
libc::SYS_ioctl,
2525
libc::SYS_lseek,
26+
#[cfg(musl)]
27+
libc::SYS_madvise,
2628
libc::SYS_mmap,
2729
libc::SYS_munmap,
2830
libc::SYS_open,
@@ -241,6 +243,21 @@ pub fn default_context() -> Result<SeccompFilterContext, Error> {
241243
libc::SYS_lseek,
242244
(0, vec![SeccompRule::new(vec![], SeccompAction::Allow)]),
243245
),
246+
#[cfg(musl)]
247+
(
248+
libc::SYS_madvise,
249+
(
250+
0,
251+
vec![SeccompRule::new(
252+
vec![SeccompCondition::new(
253+
2,
254+
SeccompCmpOp::Eq,
255+
libc::MADV_DONTNEED as u64,
256+
)?],
257+
SeccompAction::Allow,
258+
)],
259+
),
260+
),
244261
(
245262
libc::SYS_mmap,
246263
(

0 commit comments

Comments
 (0)