forked from firecracker-microvm/firecracker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for clean panic with FC seccomp filters
Signed-off-by: George Pisaltu <gpl@amazon.com>
- Loading branch information
1 parent
2995a22
commit 498b3e3
Showing
4 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
tests/integration_tests/security/demo_seccomp/src/bin/demo_panic.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
use std::env::args; | ||
use std::fs::File; | ||
|
||
use seccompiler::{apply_filter, deserialize_binary}; | ||
|
||
fn main() { | ||
let args: Vec<String> = args().collect(); | ||
let bpf_path = &args[1]; | ||
let filter_thread = &args[2]; | ||
|
||
let filter_file = File::open(bpf_path).unwrap(); | ||
let map = deserialize_binary(&filter_file, None).unwrap(); | ||
apply_filter(map.get(filter_thread).unwrap()).unwrap(); | ||
panic!("Expected panic."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters