Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

An error in rbpf #647

Closed
LiuJun5817 opened this issue Dec 24, 2024 · 1 comment
Closed

An error in rbpf #647

LiuJun5817 opened this issue Dec 24, 2024 · 1 comment

Comments

@LiuJun5817
Copy link

In this test case, the expected value does not match the output value.

test_interpreter_and_jit_asm!(
        "
        mov32 r0, -1
        add64 r0, 0x1
        exit",
        [],
        (),
        TestContextObject::new(3),
        ProgramResult::Ok(0x0),
    );

Image
interpreter_result is "Ok(0x100000000)", but expected_result is "Ok(0)".
Could the problem be here? "ebpf::MOV32_IMM => self.reg[dst] = insn.imm as u32 as u64,"

@Lichtso
Copy link

Lichtso commented Dec 30, 2024

mov64 reg, imm is what you want here to get i64 sign extension, not mov32 reg, imm as that is limited to u32.
The ISA docs were wrong, so thanks for reporting it.

The patch is in the new repository, as this one is no longer maintained: anza-xyz#10

@Lichtso Lichtso closed this as completed Dec 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants