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

Interpreter LD_DW_IMM: add !sbpf_version.disable_lddw() checking #563

Closed
shenghaoyuan opened this issue May 8, 2024 · 0 comments · Fixed by #570
Closed

Interpreter LD_DW_IMM: add !sbpf_version.disable_lddw() checking #563

shenghaoyuan opened this issue May 8, 2024 · 0 comments · Fixed by #570

Comments

@shenghaoyuan
Copy link

Hi,
I wonder if the interpreter could add a checking before executing LD_DW_IMM if SBF enables or disables the LD_DW_IMM instruction.

//interpreter.rs
            ebpf::LD_DW_IMM  => {
                ebpf::augment_lddw_unchecked(self.program, &mut insn);
                self.reg[dst] = insn.imm as u64;
                self.reg[11] += 1;
                next_pc += 1;
            },

The new code may be:

//interpreter.rs
            ebpf::LD_DW_IMM  if !self.executable.get_sbpf_version().disable_lddw() => {
                ebpf::augment_lddw_unchecked(self.program, &mut insn);
                self.reg[dst] = insn.imm as u64;
                self.reg[11] += 1;
                next_pc += 1;
            },
@shenghaoyuan shenghaoyuan changed the title Interpreter LD_DW_IMM: missing !sbpf_version.disable_lddw() checking Interpreter LD_DW_IMM: add !sbpf_version.disable_lddw() checking May 8, 2024
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.

1 participant