Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is only support x86_64? #48

Open
bxcrs opened this issue Jan 5, 2020 · 10 comments · Fixed by solana-labs/solana#21215
Open

Is only support x86_64? #48

bxcrs opened this issue Jan 5, 2020 · 10 comments · Fixed by solana-labs/solana#21215

Comments

@bxcrs
Copy link

bxcrs commented Jan 5, 2020

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
@qmonnet
Copy link
Owner

qmonnet commented Jan 5, 2020

Yes, at this time x86_64 is the only supported target. I don't have time to work on JIT-compilers for other architectures, but as always, PRs are welcome.

@dcolley
Copy link

dcolley commented Sep 30, 2021

This issue prevents us from running Solana on arm64.
How can I contribute?
I have a Mac M1 - happy to run tests and provide feedback.

@qmonnet
Copy link
Owner

qmonnet commented Sep 30, 2021

Hi, you can contribute by writing a JIT-compiler for arm64 :).
I'm sorry, I don't have the time (or the hardware, for that matter) to work on this myself.

You can get some inspiration from the existing x86-64 JIT compiler. You cannot reuse anything from the arm64 JIT in the Linux kernel, which is under GPL; but DPDK has an arm64 JIT-compiler for eBPF under BSD-3-Clause, so you could look at it if it's helpful.

@dcolley
Copy link

dcolley commented Sep 30, 2021

Writing a JIT compiler for anything is beyond my skillz ;), but thanks for the suggestion.
I think my main contribution could be in testing.

/opt/rbpf# cargo test --no-fail-fast --workspace
   Compiling rbpf v0.1.0 (/opt/rbpf)
    Finished test [unoptimized + debuginfo] target(s) in 2.40s
     Running unittests (target/debug/deps/rbpf-4eb3a350c844e8cc)

running 117 tests
test asm_parser::tests::test_error_eof ... ok
test asm_parser::tests::test_empty ... ok
test asm_parser::tests::test_error_unexpected_character ... ok
test asm_parser::tests::test_exit ... ok
test asm_parser::tests::test_ident ... ok
test asm_parser::tests::test_initial_whitespace ... ok
test asm_parser::tests::test_ja ... ok
test asm_parser::tests::test_instruction ... ok
test asm_parser::tests::test_integer ... ok
test asm_parser::tests::test_lsh ... ok
test asm_parser::tests::test_operand ... ok
test asm_parser::tests::test_ldxh ... ok
test insn_builder::tests::byte_swap_instructions::convert_host_to_big_endian_32bits ... ok
test asm_parser::tests::test_register ... ok
test insn_builder::tests::byte_swap_instructions::convert_host_to_big_endian_16bits ... ok
test insn_builder::tests::byte_swap_instructions::convert_host_to_big_endian_64bit ... ok
test insn_builder::tests::byte_swap_instructions::convert_host_to_little_endian_32bits ... ok
test insn_builder::tests::byte_swap_instructions::convert_host_to_little_endian_16bits ... ok
test asm_parser::tests::test_tcp_sack ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_equals_const ... ok
test insn_builder::tests::byte_swap_instructions::convert_host_to_little_endian_64bit ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_bit_and_with_const_not_equal_zero ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_greater_or_equals_to_const ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_greater_than_const ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_lower_or_equals_src_signed ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_lower_or_equals_to_const ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_greater_or_equals_src_signed ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_greater_than_const_signed ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_lower_than_const ... ok
test insn_builder::tests::jump_instructions::immediate::jump_to_label ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_bit_and_with_src_not_equal_zero ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_lower_than_const_signed ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_equals_src ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_greater_or_equals_src_signed ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_greater_than_src ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_greater_or_equals_to_src ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_greater_than_src_signed ... ok
test insn_builder::tests::jump_instructions::immediate::jump_on_dst_not_equals_const ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_lower_than_src ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_not_equals_src ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_lower_than_src_signed ... ok
test insn_builder::tests::load_instructions::immediate::load_abs_double_word ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_lower_or_equals_src_signed ... ok
test insn_builder::tests::load_instructions::immediate::load_abs_byte ... ok
test insn_builder::tests::jump_instructions::register::jump_on_dst_lower_or_equals_to_src ... ok
test insn_builder::tests::load_instructions::immediate::load_abs_half_word ... ok
test insn_builder::tests::load_instructions::immediate::load_double_word ... ok
test insn_builder::tests::load_instructions::immediate::load_indirect_double_word ... ok
test insn_builder::tests::load_instructions::immediate::load_indirect_byte ... ok
test insn_builder::tests::load_instructions::immediate::load_indirect_half_word ... ok
test insn_builder::tests::load_instructions::immediate::load_indirect_word ... ok
test insn_builder::tests::load_instructions::register::load_byte_from_set_src_with_offset ... ok
test insn_builder::tests::load_instructions::immediate::load_abs_word ... ok
test insn_builder::tests::load_instructions::register::load_word_from_set_src_with_offset ... ok
test insn_builder::tests::load_instructions::register::load_double_word_from_set_src_with_offset ... ok
test insn_builder::tests::load_instructions::register::load_half_word_from_set_src_with_offset ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_bit_xor_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_bit_or_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_and_add_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_left_shift_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_logical_right_shift_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_mod_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_div_constant_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_bit_and_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_mul_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_signed_right_shift_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_negate_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_bit_and_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_bit_or_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_bit_xor_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_div_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::immediate::move_sub_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_from_register_to_another_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_and_add_from_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_logical_right_shift_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_mul_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_left_shift_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_sub_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_mod_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x32::register::move_signed_right_shift_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_bit_or_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_bit_and_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_and_add_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_bit_xor_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_div_constant_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_left_shift_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_logical_right_shift_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_mul_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_mod_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_sub_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_negate_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::immediate::move_signed_right_shift_const_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_bit_xor_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_and_add_from_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_bit_or_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_from_register_to_another_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_bit_and_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_left_shift_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_logical_right_shift_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_signed_right_shift_from_register_to_register ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_mod_from_register_to_register ... ok
test insn_builder::tests::programs::example_from_assembler ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_sub_from_register_to_register ... ok
test insn_builder::tests::special::exit_operation ... ok
test insn_builder::tests::store_instructions::store_byte_from_dst_into_immediate_address ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_div_from_register_to_register ... ok
test insn_builder::tests::store_instructions::store_byte_from_dst_into_src_address ... ok
test insn_builder::tests::special::call_immediate ... ok
test insn_builder::tests::moves_instructions::arch_x64::register::move_mul_from_register_to_register ... ok
test insn_builder::tests::store_instructions::store_double_word_from_dst_into_src_address ... ok
test insn_builder::tests::store_instructions::store_half_word_from_dst_into_immediate_address ... ok
test insn_builder::tests::store_instructions::store_half_word_from_dst_into_src_address ... ok
test insn_builder::tests::store_instructions::store_double_word_from_dst_into_immediate_address ... ok
test insn_builder::tests::store_instructions::store_word_from_dst_into_immediate_address ... ok
test insn_builder::tests::store_instructions::store_word_from_dst_into_src_address ... ok

test result: ok. 117 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

     Running tests/assembler.rs (target/debug/deps/assembler-9271eb991f34eb40)

running 32 tests
test test_alu_unary ... ok
test test_add64 ... ok
test test_call ... ok
test test_empty ... ok
test test_be32 ... ok
test test_endian ... ok
test test_error_invalid_instruction ... ok
test test_error_unexpected_operands ... ok
test test_exit ... ok
test test_error_operands_out_of_range ... ok
test test_ja ... ok
test test_alu_binary ... ok
test test_jeq ... ok
test test_error_too_many_operands ... ok
test test_ldabsw ... ok
test test_jump_conditional ... ok
test test_lddw ... ok
test test_large_immediate ... ok
test test_ldindw ... ok
test test_ldxdw ... ok
test test_load_abs ... ok
test test_ldxw ... ok
test test_load_ind ... ok
test test_neg64 ... ok
test test_load_reg ... ok
test test_sth ... ok
test test_stw ... ok
test test_store_reg ... ok
test test_store_imm ... ok
test test_stxh ... ok
test test_stxw ... ok
test test_tcp_sack ... ok

test result: ok. 32 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

     Running tests/common.rs (target/debug/deps/common-d497b3688a2600f9)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/disassembler.rs (target/debug/deps/disassembler-a8f392b8f627093d)

running 27 tests
test test_alu_unary ... ok
test test_be32 ... ok
test test_add64 ... ok
test test_call ... ok
test test_empty ... ok
test test_exit ... ok
test test_endian ... ok
test test_ja ... ok
test test_jeq ... ok
test test_large_immediate ... ok
test test_ldabsw ... ok
test test_ldindw ... ok
test test_alu_binary ... ok
test test_ldxdw ... ok
test test_jump_conditional ... ok
test test_ldxw ... ok
test test_load_abs ... ok
test test_load_ind ... ok
test test_load_reg ... ok
test test_lddw ... ok
test test_neg64 ... ok
test test_store_imm ... ok
test test_sth ... ok
test test_stxh ... ok
test test_store_reg ... ok
test test_stxw ... ok
test test_stw ... ok

test result: ok. 27 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/misc.rs (target/debug/deps/misc-07fc6b44224245d9)

running 20 tests
     Running tests/ubpf_jit_x86_64.rs (target/debug/deps/ubpf_jit_x86_64-3800d1c4ecb08bb7)

running 101 tests
     Running tests/ubpf_verifier.rs (target/debug/deps/ubpf_verifier-2147b1623e83a4cb)

running 12 tests
test test_verifier_err_endian_size - should panic ... ok
test test_verifier_err_incomplete_lddw - should panic ... ok
test test_verifier_err_infinite_loop - should panic ... ok
test test_verifier_err_invalid_reg_src - should panic ... ok
test test_verifier_err_div_by_zero_imm - should panic ... ok
test test_verifier_err_invalid_reg_dst - should panic ... ok
test test_verifier_err_jmp_lddw - should panic ... ok
test test_verifier_err_unknown_opcode - should panic ... ok
test test_verifier_err_jmp_out - should panic ... ok
test test_verifier_err_no_exit - should panic ... ok
test test_verifier_err_write_r10 - should panic ... ok
test test_verifier_err_too_many_instructions - should panic ... ok

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running tests/ubpf_vm.rs (target/debug/deps/ubpf_vm-c184efc7c25409be)

running 102 tests
test test_vm_add ... ok
test test_vm_alu64_bit ... ok
test test_vm_alu_arith ... ok
test test_vm_alu64_arith ... ok
test test_vm_arsh32_high_shift ... ok
test test_vm_arsh64 ... ok
test test_vm_alu_bit ... ok
test test_vm_be16 ... ok
test test_vm_arsh_reg ... ok
test test_vm_be16_high ... ok
test test_vm_arsh ... ok
test test_vm_be32_high ... ok
test test_vm_be32 ... ok
test test_vm_be64 ... ok
test test_vm_call_memfrob ... ok
test test_vm_call ... ok
test test_vm_div32_imm ... ok
test test_vm_div32_reg ... ok
test test_vm_div32_high_divisor ... ok
test test_vm_div64_imm ... ok
test test_vm_early_exit ... ok
test test_vm_div64_reg ... ok
test test_vm_err_call_unreg - should panic ... ok
test test_vm_err_div_by_zero_reg - should panic ... ok
test test_vm_err_div64_by_zero_reg - should panic ... ok
test test_vm_err_mod64_by_zero_reg - should panic ... ok
test test_vm_err_stack_out_of_bound - should panic ... ok
test test_vm_err_mod_by_zero_reg - should panic ... ok
test test_vm_exit ... ok
test test_vm_ja ... ok
test test_vm_jeq_imm ... ok
test test_vm_jge_imm ... ok
test test_vm_jeq_reg ... ok
test test_vm_jgt_imm ... ok
test test_vm_jit_bounce ... ok
test test_vm_jgt_reg ... ok
test test_vm_jle_imm ... ok
test test_vm_jlt_imm ... ok
test test_vm_jle_reg ... ok
test test_vm_jlt_reg ... ok
test test_vm_jset_imm ... ok
test test_vm_jne_reg ... ok
test test_vm_jset_reg ... ok
test test_vm_jsge_imm ... ok
test test_vm_jsge_reg ... ok
test test_vm_jsgt_imm ... ok
test test_vm_jsle_imm ... ok
test test_vm_jsgt_reg ... ok
test test_vm_jsle_reg ... ok
test test_vm_lddw ... ok
test test_vm_jslt_reg ... ok
test test_vm_lddw2 ... ok
test test_vm_jslt_imm ... ok
test test_vm_ldxdw ... ok
test test_vm_ldxb ... ok
test test_vm_ldxb_all ... ok
test test_vm_ldxh ... ok
test test_vm_ldxw ... ok
test test_vm_ldxh_same_reg ... ok
test test_vm_ldxh_all2 ... ok
test test_vm_ldxw_all ... ok
test test_vm_le32 ... ok
test test_vm_le16 ... ok
test test_vm_ldxh_all ... ok
test test_vm_lsh_reg ... ok
test test_vm_mod32 ... ok
test test_vm_le64 ... ok
test test_vm_mod ... ok
test test_vm_mod64 ... ok
test test_vm_mul32_imm ... ok
test test_vm_mov ... ok
test test_vm_mul32_reg_overflow ... ok
test test_vm_mul32_reg ... ok
test test_vm_mul64_reg ... ok
test test_vm_mul64_imm ... ok
test test_vm_mul_loop ... ok
test test_vm_neg ... ok
test test_vm_neg64 ... ok
test test_vm_rsh_reg ... ok
test test_vm_stack ... ok
test test_vm_rhs32 ... ok
test test_vm_prime ... ok
test test_vm_stack2 ... ok
test test_vm_stb ... ok
test test_vm_stdw ... ok
test test_vm_sth ... ok
test test_vm_stw ... ok
test test_vm_stxb ... ok
test test_vm_stxb_all ... ok
test test_vm_stxb_all2 ... ok
test test_vm_stxdw ... ok
test test_vm_string_stack ... ok
test test_vm_stxb_chain ... ok
test test_vm_tcp_port80_match ... ok
test test_vm_stxh ... ok
test test_vm_tcp_port80_nomatch_ethertype ... ok
test test_vm_subnet ... ok
test test_vm_tcp_port80_nomatch ... ok
test test_vm_tcp_port80_nomatch_proto ... ok
test test_vm_stxw ... ok
test test_vm_tcp_sack_match ... ok
test test_vm_tcp_sack_nomatch ... ok

test result: ok. 102 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

   Doc-tests rbpf

running 47 tests
test src/disassembler.rs - disassembler::disassemble (line 322) ... ok
test src/ebpf.rs - ebpf::Insn::to_array (line 413) ... ok
test src/assembler.rs - assembler::assemble (line 210) ... ok
test src/disassembler.rs - disassembler::to_insn_vec (line 121) ... ok
test src/ebpf.rs - ebpf::get_insn (line 484) ... ok
test src/ebpf.rs - ebpf::get_insn (line 497) ... ok
test src/ebpf.rs - ebpf::Insn::to_vec (line 445) ... ok
test src/ebpf.rs - ebpf::to_insn_vec (line 533) ... ok
test src/helpers.rs - helpers::bpf_time_getns (line 41) ... ok
test src/helpers.rs - helpers::bpf_trace_printf (line 72) ... ok
test src/helpers.rs - helpers::gather_bytes (line 122) ... ok
test src/helpers.rs - helpers::memfrob (line 142) ... ok
test src/helpers.rs - helpers::rand (line 251) ... ok
test src/helpers.rs - helpers::sqrti (line 190) ... ok
test src/helpers.rs - helpers::strcmp (line 206) ... ok
test src/lib.rs - EbpfVmFixedMbuff (line 737) ... ok
test src/lib.rs - EbpfVmFixedMbuff::execute_program (line 942) ... ok
test src/lib.rs - EbpfVmFixedMbuff::execute_program_jit (line 1027) ... FAILED
test src/lib.rs - EbpfVmFixedMbuff::new (line 782) ... ok
test src/lib.rs - EbpfVmFixedMbuff::jit_compile (line 982) ... ok
test src/lib.rs - EbpfVmFixedMbuff::register_helper (line 896) ... ok
test src/lib.rs - EbpfVmFixedMbuff::set_program (line 818) ... ok
test src/lib.rs - EbpfVmFixedMbuff::set_verifier (line 859) ... ok
test src/lib.rs - EbpfVmMbuff (line 74) ... ok
test src/lib.rs - EbpfVmMbuff::execute_program (line 250) ... ok
test src/lib.rs - EbpfVmMbuff::jit_compile (line 609) ... ok
test src/lib.rs - EbpfVmMbuff::execute_program_jit (line 650) ... FAILED
test src/lib.rs - EbpfVmMbuff::new (line 115) ... ok
test src/lib.rs - EbpfVmMbuff::register_helper (line 210) ... ok
test src/lib.rs - EbpfVmMbuff::set_program (line 142) ... ok
test src/lib.rs - EbpfVmMbuff::set_verifier (line 169) ... ok
test src/lib.rs - EbpfVmNoData (line 1338) ... ok
test src/lib.rs - EbpfVmNoData::execute_program (line 1526) ... ok
test src/lib.rs - EbpfVmNoData::execute_program_jit (line 1557) ... FAILED
test src/lib.rs - EbpfVmNoData::jit_compile (line 1505) ... ok
test src/lib.rs - EbpfVmNoData::new (line 1383) ... ok
test src/lib.rs - EbpfVmNoData::register_helper (line 1473) ... ok
test src/lib.rs - EbpfVmNoData::set_program (line 1404) ... ok
test src/lib.rs - EbpfVmNoData::set_verifier (line 1436) ... ok
test src/lib.rs - EbpfVmRaw (line 1084) ... ok
test src/lib.rs - EbpfVmRaw::execute_program (line 1239) ... ok
test src/lib.rs - EbpfVmRaw::execute_program_jit (line 1304) ... FAILED
test src/lib.rs - EbpfVmRaw::new (line 1113) ... ok
test src/lib.rs - EbpfVmRaw::jit_compile (line 1267) ... ok
test src/lib.rs - EbpfVmRaw::register_helper (line 1205) ... ok
test src/lib.rs - EbpfVmRaw::set_program (line 1135) ... ok
test src/lib.rs - EbpfVmRaw::set_verifier (line 1168) ... ok

failures:

---- src/lib.rs - EbpfVmFixedMbuff::execute_program_jit (line 1027) stdout ----
Test executable failed (terminated by signal).

---- src/lib.rs - EbpfVmMbuff::execute_program_jit (line 650) stdout ----
Test executable failed (terminated by signal).

---- src/lib.rs - EbpfVmNoData::execute_program_jit (line 1557) stdout ----
Test executable failed (terminated by signal).

---- src/lib.rs - EbpfVmRaw::execute_program_jit (line 1304) stdout ----
Test executable failed (terminated by signal).


failures:
    src/lib.rs - EbpfVmFixedMbuff::execute_program_jit (line 1027)
    src/lib.rs - EbpfVmMbuff::execute_program_jit (line 650)
    src/lib.rs - EbpfVmNoData::execute_program_jit (line 1557)
    src/lib.rs - EbpfVmRaw::execute_program_jit (line 1304)

test result: FAILED. 43 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.27s

error: test failed, to rerun pass '--doc'

Caused by:
  process didn't exit successfully: `/opt/rbpf/target/debug/deps/misc-07fc6b44224245d9` (signal: 4, SIGILL: illegal instruction)
  process didn't exit successfully: `/opt/rbpf/target/debug/deps/ubpf_jit_x86_64-3800d1c4ecb08bb7` (signal: 4, SIGILL: illegal instruction)
  process didn't exit successfully: `rustdoc --crate-type lib --crate-name rbpf --test /opt/rbpf/src/lib.rs -L dependency=/opt/rbpf/target/debug/deps -L dependency=/opt/rbpf/target/debug/deps --extern byteorder=/opt/rbpf/target/debug/deps/libbyteorder-c4449e0d9db73772.rlib --extern combine=/opt/rbpf/target/debug/deps/libcombine-6dce058e1ecfe321.rlib --extern elf=/opt/rbpf/target/debug/deps/libelf-7fdcd9da34d28f07.rlib --extern json=/opt/rbpf/target/debug/deps/libjson-38fe87d6bb051b31.rlib --extern libc=/opt/rbpf/target/debug/deps/liblibc-951faa70776cf17b.rlib --extern rbpf=/opt/rbpf/target/debug/deps/librbpf-73ed35ecaf59ddf6.rlib --extern time=/opt/rbpf/target/debug/deps/libtime-fb72e813ad45dac2.rlib -C embed-bitcode=no --error-format human` (exit status: 101)

@qmonnet
Copy link
Owner

qmonnet commented Oct 12, 2022

@Alan-Jowett
Copy link
Contributor

Alan-Jowett commented Nov 7, 2022

Here is a working ARM64 JIT in the C uBPF project. https://github.com/iovisor/ubpf/blob/main/vm/ubpf_jit_arm64.c

@bxcrs I don't think it should be too hard to port this to rust. Ping me if you need help or if anything isn't clear in the code and I can try to help.

@qmonnet
Copy link
Owner

qmonnet commented Nov 8, 2022

Agreed it shouldn't be too hard, I'm concerned about CI though. @Alan-Jowett do you have a solution for running CI for the arm64 JIT in uBPF, by any chance?

@Alan-Jowett
Copy link
Contributor

@Alan-Jowett
Copy link
Contributor

In case it's not clear:
bpf_conformance is a test suite that exercises all the possible BPF instructions. It uses a plugin model, where it passes bytecode + memory contents to a plugin that executes the bytecode and returns the result.

The plugin is then either an arm64 binary running under qemu or a native x64 binary. Because the interface between the test and the plugin is via stdin / stdout and command line, it's able to bridge the x64 -> arm64 gap.

@qmonnet
Copy link
Owner

qmonnet commented Sep 6, 2023

Coming back to the initial issue: We now have an alternative implementation of the JIT (#86, as an opt-in feature), which should support ARM. It hasn't been tested extensively yet, but it passes all the CI tests, so it should be about as robust as the existing JIT, feel free to experiment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants