Skip to content

Commit a02fc1e

Browse files
ilmanzoroypat
authored andcommitted
Make bpf filter compilation deterministic
replaced HashMap with BTreeMap in the bpf filter compiler Signed-off-by: Andrea Manzini <[email protected]>
1 parent bccb658 commit a02fc1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/seccompiler/src/lib.rs

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

4-
use std::collections::HashMap;
4+
use std::collections::BTreeMap;
55
use std::fs::File;
66
use std::io::{Read, Seek};
77
use std::os::fd::{AsRawFd, FromRawFd};
@@ -91,7 +91,7 @@ pub fn compile_bpf(
9191
// SAFETY: Safe because the parameters are valid.
9292
let mut memfd = unsafe { File::from_raw_fd(memfd_fd) };
9393

94-
let mut bpf_map: HashMap<String, Vec<u64>> = HashMap::new();
94+
let mut bpf_map: BTreeMap<String, Vec<u64>> = BTreeMap::new();
9595
for (name, filter) in bpf_map_json.0.iter() {
9696
let default_action = filter.default_action.to_scmp_type();
9797
let filter_action = filter.filter_action.to_scmp_type();

0 commit comments

Comments
 (0)