Преглед на файлове

src/lib.rs: make `prog_exec()` panic!() if we reach code after the loop

The only correct way to get out of the loop is by meeting an EXIT
instruction, that returns the value from register 0. The verifier should
have ensured that the program ends with an EXIT instruction so anything
after the loop parsing instructions should never be reached.
Quentin Monnet преди 8 години
родител
ревизия
d9cbbe20cc
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      src/lib.rs

+ 1 - 1
src/lib.rs

@@ -459,7 +459,7 @@ impl<'a> EbpfVmMbuff<'a> {
             }
             }
         }
         }
 
 
-        return 0;
+        unreachable!()
     }
     }
 
 
     fn check_mem(addr: u64, len: usize, access_type: &str, insn_ptr: usize,
     fn check_mem(addr: u64, len: usize, access_type: &str, insn_ptr: usize,