@@ -9,12 +9,6 @@ use vmm::seccomp::{BpfThreadMap, DeserializationError, deserialize_binary, get_e
99
1010const THREAD_CATEGORIES : [ & str ; 3 ] = [ "vmm" , "api" , "vcpu" ] ;
1111
12- // This byte limit is passed to `bincode` to guard against a potential memory
13- // allocation DOS caused by binary filters that are too large.
14- // This limit can be safely determined since the maximum length of a BPF
15- // filter is 4096 instructions and Firecracker has a finite number of threads.
16- const DESERIALIZATION_BYTES_LIMIT : Option < u64 > = Some ( 100_000 ) ;
17-
1812/// Error retrieving seccomp filters.
1913#[ derive( Debug , thiserror:: Error , displaydoc:: Display ) ]
2014pub enum FilterError {
@@ -72,15 +66,13 @@ pub fn get_filters(config: SeccompConfig) -> Result<BpfThreadMap, FilterError> {
7266fn get_default_filters ( ) -> Result < BpfThreadMap , FilterError > {
7367 // Retrieve, at compile-time, the serialized binary filter generated with seccompiler.
7468 let bytes: & [ u8 ] = include_bytes ! ( concat!( env!( "OUT_DIR" ) , "/seccomp_filter.bpf" ) ) ;
75- let map = deserialize_binary ( bytes, DESERIALIZATION_BYTES_LIMIT )
76- . map_err ( FilterError :: Deserialization ) ?;
69+ let map = deserialize_binary ( bytes) . map_err ( FilterError :: Deserialization ) ?;
7770 filter_thread_categories ( map)
7871}
7972
8073/// Retrieve custom seccomp filters.
8174fn get_custom_filters < R : Read + Debug > ( reader : R ) -> Result < BpfThreadMap , FilterError > {
82- let map = deserialize_binary ( BufReader :: new ( reader) , DESERIALIZATION_BYTES_LIMIT )
83- . map_err ( FilterError :: Deserialization ) ?;
75+ let map = deserialize_binary ( BufReader :: new ( reader) ) . map_err ( FilterError :: Deserialization ) ?;
8476 filter_thread_categories ( map)
8577}
8678
0 commit comments