diff --git a/fuzz/fuzz_targets/common.rs b/fuzz/fuzz_targets/common.rs index f2f3e7e9..17e8d0c7 100644 --- a/fuzz/fuzz_targets/common.rs +++ b/fuzz/fuzz_targets/common.rs @@ -12,7 +12,6 @@ pub struct ConfigTemplate { enable_stack_frame_gaps: bool, enable_symbol_and_section_labels: bool, sanitize_user_provided_values: bool, - reject_callx_r10: bool, optimize_rodata: bool, } @@ -26,7 +25,6 @@ impl<'a> Arbitrary<'a> for ConfigTemplate { enable_stack_frame_gaps: bools & (1 << 0) != 0, enable_symbol_and_section_labels: bools & (1 << 1) != 0, sanitize_user_provided_values: bools & (1 << 3) != 0, - reject_callx_r10: bools & (1 << 6) != 0, optimize_rodata: bools & (1 << 9) != 0, }) } @@ -49,7 +47,6 @@ impl From for Config { enable_stack_frame_gaps, enable_symbol_and_section_labels, sanitize_user_provided_values, - reject_callx_r10, optimize_rodata, } => Config { max_call_depth, @@ -58,7 +55,6 @@ impl From for Config { enable_symbol_and_section_labels, noop_instruction_rate, sanitize_user_provided_values, - reject_callx_r10, optimize_rodata, ..Default::default() }, diff --git a/src/verifier.rs b/src/verifier.rs index 1846f0de..0e7b3504 100644 --- a/src/verifier.rs +++ b/src/verifier.rs @@ -201,7 +201,6 @@ fn check_imm_shift(insn: &ebpf::Insn, insn_ptr: usize, imm_bits: u64) -> Result< fn check_callx_register( insn: &ebpf::Insn, insn_ptr: usize, - config: &Config, sbpf_version: &SBPFVersion, ) -> Result<(), VerifierError> { let reg = if sbpf_version.callx_uses_src_reg() { @@ -209,7 +208,7 @@ fn check_callx_register( } else { insn.imm }; - if !(0..=10).contains(®) || (reg == 10 && config.reject_callx_r10) { + if !(0..10).contains(®) { return Err(VerifierError::InvalidRegister(insn_ptr)); } Ok(()) @@ -221,7 +220,7 @@ pub struct RequisiteVerifier {} impl Verifier for RequisiteVerifier { /// Check the program against the verifier's rules #[rustfmt::skip] - fn verify(prog: &[u8], config: &Config, sbpf_version: &SBPFVersion, function_registry: &FunctionRegistry, syscall_registry: &FunctionRegistry>) -> Result<(), VerifierError> { + fn verify(prog: &[u8], _config: &Config, sbpf_version: &SBPFVersion, function_registry: &FunctionRegistry, syscall_registry: &FunctionRegistry>) -> Result<(), VerifierError> { check_prog_len(prog)?; let program_range = 0..prog.len() / ebpf::INSN_SIZE; @@ -378,7 +377,7 @@ impl Verifier for RequisiteVerifier { ebpf::CALL_IMM if sbpf_version.static_syscalls() && insn.src != 0 => { check_call_target(insn.imm as u32, function_registry)?; }, ebpf::CALL_IMM if sbpf_version.static_syscalls() && insn.src == 0 => { check_call_target(insn.imm as u32, syscall_registry)?; }, ebpf::CALL_IMM => {}, - ebpf::CALL_REG => { check_callx_register(&insn, insn_ptr, config, sbpf_version)?; }, + ebpf::CALL_REG => { check_callx_register(&insn, insn_ptr, sbpf_version)?; }, ebpf::EXIT => {}, _ => { diff --git a/src/vm.rs b/src/vm.rs index 969a339e..3d976364 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -74,8 +74,6 @@ pub struct Config { pub sanitize_user_provided_values: bool, /// Throw ElfError::SymbolHashCollision when a BPF function collides with a registered syscall pub external_internal_function_hash_collision: bool, - /// Have the verifier reject "callx r10" - pub reject_callx_r10: bool, /// Avoid copying read only sections when possible pub optimize_rodata: bool, /// Use aligned memory mapping @@ -106,7 +104,6 @@ impl Default for Config { noop_instruction_rate: 256, sanitize_user_provided_values: true, external_internal_function_hash_collision: true, - reject_callx_r10: true, optimize_rodata: true, aligned_memory_mapping: true, enabled_sbpf_versions: SBPFVersion::V1..=SBPFVersion::V2,