4
0
Эх сурвалжийг харах

fix: Remove the 16-byte alignment requirement for the stack

Signed-off-by: Godones <chenlinfeng25@outlook.com>
Godones 1 сар өмнө
parent
commit
5a19859295
2 өөрчлөгдсөн 0 нэмэгдсэн , 20 устгасан
  1. 0 10
      src/stack.rs
  2. 0 10
      tests/misc.rs

+ 0 - 10
src/stack.rs

@@ -120,16 +120,6 @@ impl StackVerifier {
             }
             None => return Ok(ty),
         }
-        if ty.stack_usage() % 16 > 0 {
-            Err(Error::new(
-                ErrorKind::Other,
-                format!(
-                    "local function (at PC {}) has improperly sized stack use ({})",
-                    pc,
-                    ty.stack_usage()
-                ),
-            ))?;
-        }
         Ok(ty)
     }
 }

+ 0 - 10
tests/misc.rs

@@ -693,16 +693,6 @@ fn test_vm_jit_other_type_call(){
     unsafe { vm.execute_program_jit().unwrap() };
 }
 
-#[test]
-#[should_panic(expected = "local function (at PC 0) has improperly sized stack use (15)")]
-fn test_invalid_stack_alignment(){
-    let prog = assemble("
-        mov r0, 0x1
-        exit").unwrap();
-    let mut vm = rbpf::EbpfVmNoData::new(Some(&prog)).unwrap();
-    vm.set_stack_usage_calculator(|_,_,_| 15, Box::new(())).unwrap();
-}
-
 #[test]
 #[should_panic(expected = "Error: out of bounds memory store (insn #8)")]
 fn test_stack_overflow(){