Description
I run it in router
[Linux RT-AC68U 2.6.36.4brcmarm #1 SMP PREEMPT Fri May 10 22:16:14 CST 2019 armv7l GNU/Linux],
execute_program_jit is alway Segmentation fault
main.rs:
extern crate rbpf;
fn main() {
let prog = &[
0x71, 0x10, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, // ldxh r0, [r1+2]
0x95, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // exit
];
// Let's use some data.
let mem = &mut [
0xaa, 0xbb, 0x11, 0xcc, 0xdd
];
println!("next EbpfVmRaw::new");
// This is an eBPF VM for programs reading from a given memory area (it
// directly reads from packet data)
let mut vm = rbpf::EbpfVmRaw::new(prog).unwrap();
println!("next jit_compile");
// This time we JIT-compile the program.
vm.jit_compile().unwrap();
println!("next execute_program_jit");
// Then we execute it. For this kind of VM, a reference to the packet data
// must be passed to the function that executes the program.
unsafe { assert_eq!(vm.execute_program_jit(mem).unwrap(), 0x11); }
println!("finnal");
}
run it in router:
next EbpfVmRaw::new
next jit_compile
next execute_program_jit
Segmentation fault
Metadata
Metadata
Assignees
Labels
No labels