From 5444b58da712d66673657a710798ac4be2ca164f Mon Sep 17 00:00:00 2001 From: Roee Toledano Date: Tue, 17 Dec 2024 18:27:04 +0200 Subject: [PATCH] Fix complex atomic instructions handling --- arch/BPF/BPFDisassembler.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/BPF/BPFDisassembler.c b/arch/BPF/BPFDisassembler.c index f6d46bae75..dc8538d711 100644 --- a/arch/BPF/BPFDisassembler.c +++ b/arch/BPF/BPFDisassembler.c @@ -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: \ @@ -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; } }