Skip to content

Commit

Permalink
Fix complex atomic instructions handling (#2584)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roeegg2 authored Dec 26, 2024
1 parent 9907b22 commit e160cbc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions arch/BPF/BPFDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,9 @@ static bpf_insn op2insn_ld_ebpf(unsigned opcode)
#define COMPLEX_CASE(c) \
case BPF_ATOMIC_##c | BPF_MODE_FETCH: \
if (BPF_SIZE(opcode) == BPF_SIZE_DW) \
return BPF_INS_A##c##64;
return BPF_INS_A##c##64; \
else \
return BPF_INS_INVALID;

#define CASE(c) \
case BPF_SIZE_##c: \
Expand Down Expand Up @@ -524,7 +526,7 @@ static bpf_insn op2insn_st(unsigned opcode, const uint32_t imm)
ALU_CASE_FETCH(XOR);
COMPLEX_CASE(XCHG);
COMPLEX_CASE(CMPXCHG);
default: // Could only be reached if complex atomic operation is used without fetch modifier, or not as DW
default: // Reached if complex atomic operation is used without fetch modifier
return BPF_INS_INVALID;
}
}
Expand Down

0 comments on commit e160cbc

Please sign in to comment.