Skip to contentSkip to conversation

syzkaller: Fix check-syzos with llvm-objdump on x86-64

PATCH New Khem Raj 1 participant 1 message Dec 1

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 syzkaller: Fix check-syzos with llvm-objdump on x86-64

Since check-syzos.sh uses $OBJDUMP, x86-64 builds with the clang toolchain run llvm-objdump instead of the host GNU objdump. llvm-objdump prints RIP-relative targets as "# 0x2cf730 <sym>", which the script's hex2dec() cannot parse, so check_syzos reports every RIP-relative instruction in the guest section and do_compile fails:

[FAIL] Found problematic data access instructions in 'guest'.
In function <_ZL28guest_handle_set_irq_handlerP10api_call_2>:
2d0018: 48 8d 15 11 f7 ff ff leaq -0x8ef(%rip), %rdx # 0x2cf730 <__start_guest>

All of these targets are inside the guest section. Add a patch that strips the 0x prefix before the address is converted.

AI-Generated: Uses Claude Code

---
 ...Accept-0x-prefixed-targets-from-llvm.patch | 38 +++++++++++++++++++
 .../recipes-test/syzkaller/syzkaller_git.bb   |  1 +
 2 files changed, 39 insertions(+)
 create mode 100644 meta-oe/recipes-test/syzkaller/syzkaller/0002-tools-check-syzos.sh-Accept-0x-prefixed-targets-from-llvm.patch
meta-oe/recipes-test/syzkaller/syzkaller/0002-tools-check-syzos.sh-Accept-0x-prefixed-targets-from-llvm.patch new file +38 -0
new file mode 100644
index 0000000000..f3e89c20ed
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 30 Nov 2026 15:09:08 -0800
+Subject: [PATCH] tools/check-syzos.sh: Accept 0x-prefixed targets from
+ llvm-objdump
+
+For amd64 the script takes the target address of each RIP-relative
+instruction from the objdump comment. GNU objdump prints it without a
+prefix ("# 2cf730 <__start_guest>"), llvm-objdump with one
+("# 0x2cf730 <__start_guest>"). hex2dec() rejects the "x", so with
+llvm-objdump every RIP-relative instruction in the guest section is
+reported, including references inside the section:
+
+  [FAIL] Found problematic data access instructions in 'guest'.
+    In function <_ZL28guest_handle_set_irq_handlerP10api_call_2>:
+      2d0018: 48 8d 15 11 f7 ff ff  leaq -0x8ef(%rip), %rdx  # 0x2cf730 <__start_guest>
+
+Strip an optional 0x prefix before converting the address.
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ tools/check-syzos.sh | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/tools/check-syzos.sh b/tools/check-syzos.sh
+index 3f1b6a9..d66a068 100644
+--- a/tools/check-syzos.sh
++++ b/tools/check-syzos.sh
+@@ -181,6 +181,8 @@ amd64|arm64|loong64)
+         if (!sub(/^.*#[[:space:]]*/, "", target_hex))
+             next
+         sub(/[[:space:]].*$/, "", target_hex)
++        # llvm-objdump prints the target as 0x<hex>, GNU objdump as <hex>.
++        sub(/^0[xX]/, "", target_hex)
+         target = hex2dec(target_hex)
+         if (target < 0 || target < guest_start || target >= guest_end)
+             report(0)
meta-oe/recipes-test/syzkaller/syzkaller_git.bb +1 -0
index 384eeb0bb7..59e8efb371 100644
@@ -8,6 +8,7 @@ require ${BPN}-licenses.inc
 
 SRC_URI = "git://${GO_IMPORT};protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX};branch=master \
            file://0001-tools-check-syzos.sh-Use-OBJDUMP-when-it-is-set.patch;patchdir=src/${GO_IMPORT} \
+           file://0002-tools-check-syzos.sh-Accept-0x-prefixed-targets-from-llvm.patch;patchdir=src/${GO_IMPORT} \
 "
 SRCREV = "e1f06033b21b05580a0f70130bae79f56b54f31b"
 require ${BPN}-go-mods.inc