Skip to content

Commit

Permalink
[temp] Log ARM64 instructions failing to decode
Browse files Browse the repository at this point in the history
  • Loading branch information
p-lambert committed Jan 25, 2023
1 parent 16b3f01 commit 3ce61d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/network/go/asmscan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ package asmscan

import (
"debug/elf"
"encoding/hex"
"fmt"

"github.com/DataDog/datadog-agent/pkg/util/log"
"golang.org/x/arch/arm64/arm64asm"
"golang.org/x/arch/x86/x86asm"
)
Expand Down Expand Up @@ -115,7 +118,9 @@ func FindARM64ReturnInstructions(data []byte) ([]uint64, error) {
for cursor < len(data) {
instruction, err := arm64asm.Decode(data[cursor:])
if err != nil {
return nil, fmt.Errorf("failed to decode ARM 64 instruction at offset %d within function machine code: %w", cursor, err)
log.Warnf("failed to decode ARM 64 instruction (0x%s) at offset %d within function machine code: %s", hex.EncodeToString(data[cursor:]), cursor, err)
cursor += 4
continue
}

if instruction.Op == arm64asm.RET {
Expand Down

0 comments on commit 3ce61d0

Please sign in to comment.