Skip to contentSkip to conversation

vock: add recipe

PATCH Superseded Yunseong Kim 2 participants 3 messages Nov 16 – Nov 18

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vock: add recipe

vock reports the kernel code a userspace command executes, using KCOV or hardware tracing (Intel PT, AMD LBR/IBS and Arm Coresight ETMv4), symbolized against a vmlinux and annotated with kernel source. Forked children and threads are followed through an LD_PRELOAD library in KCOV mode and through inherited per-CPU perf events in hardware mode. It is useful to see which kernel paths a workload reaches when testing or debugging an embedded system.

COMPATIBLE_HOST is limited to x86_64 and aarch64, the only architectures with syscall decoding and trace backends.

Tested with poky on qemux86-64 and qemuarm64 (build, packaging, update_crates) and by running KCOV coverage, fork following and syscall tracing in core-image-minimal on qemux86-64 with a KCOV kernel.

---
 meta-oe/recipes-kernel/vock/vock-crates.inc |  8 +++++
 meta-oe/recipes-kernel/vock/vock.bb         | 33 +++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/vock/vock-crates.inc
 create mode 100644 meta-oe/recipes-kernel/vock/vock.bb
meta-oe/recipes-kernel/vock/vock-crates.inc new file +8 -0
new file mode 100644
index 0000000000..9ddbda00cd
@@ -0,0 +1,8 @@
+# Autogenerated with 'bitbake -c update_crates vock'
+
+# from Cargo.lock
+SRC_URI += " \
+    crate://crates.io/libc/0.2.189 \
+"
+
+SRC_URI[libc-0.2.189.sha256sum] = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
meta-oe/recipes-kernel/vock/vock.bb new file +33 -0
new file mode 100644
index 0000000000..530ca6dd16
@@ -0,0 +1,33 @@
+SUMMARY = "Kernel code coverage of a user-space command (KCOV, Intel PT, AMD LBR and Arm Coresight ETMv4)"
+DESCRIPTION = "vock runs a command and reports which kernel code it executed, \
+using KCOV or hardware tracing (Intel PT, AMD LBR/IBS and Arm Coresight ETMv4), \
+optionally with an strace-style syscall trace and syzkaller-compatible output. \
+Coverage is symbolized against a vmlinux (DWARF or BTF) and annotated with kernel source."
+HOMEPAGE = "https://github.com/yskzalloc/vock"
+BUGTRACKER = "https://github.com/yskzalloc/vock/issues"
+SECTION = "devel"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=daf2426a488a4a2b68a88bd7cf6410e4"
+
+SRC_URI = "git://github.com/yskzalloc/vock.git;protocol=https;branch=main"
+SRCREV = "db50863d4d70038738a157379d24a9d9e5e4ce2a"
+PV = "0.1.0+git"
+
+inherit cargo cargo-update-recipe-crates
+
+require ${BPN}-crates.inc
+
+# Syscall decoding, ptrace register access and the hardware-trace backends
+# are implemented for x86_64 and aarch64 only.
+COMPATIBLE_HOST = "(x86_64|aarch64).*-linux"
+
+do_install:append() {
+    # LD_PRELOAD shim used by --mode kcov to follow forks and threads. vock
+    # looks it up next to its binary as ../lib/vock/kcov.so, i.e. under
+    # ${nonarch_libdir} regardless of multilib.
+    install -Dm 0755 ${B}/target/${CARGO_TARGET_SUBDIR}/libkcov_preload.so \
+        ${D}${nonarch_libdir}/vock/kcov.so
+}
+
+FILES:${PN} += "${nonarch_libdir}/vock"
Signature · 1 line
2.55.0
#1 lore raw

Fails to build on TCLIBC = "musl"

Quoted 102 lines · Yunseong Kim via openembedded-devel

vock reports the kernel code a userspace command executes, using KCOV or hardware tracing (Intel PT, AMD LBR/IBS and Arm Coresight ETMv4), symbolized against a vmlinux and annotated with kernel source. Forked children and threads are followed through an LD_PRELOAD library in KCOV mode and through inherited per-CPU perf events in hardware mode. It is useful to see which kernel paths a workload reaches when testing or debugging an embedded system.

COMPATIBLE_HOST is limited to x86_64 and aarch64, the only architectures with syscall decoding and trace backends.

Tested with poky on qemux86-64 and qemuarm64 (build, packaging, update_crates) and by running KCOV coverage, fork following and syscall tracing in core-image-minimal on qemux86-64 with a KCOV kernel.

---
 meta-oe/recipes-kernel/vock/vock-crates.inc |  8 +++++
 meta-oe/recipes-kernel/vock/vock.bb         | 33 +++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 meta-oe/recipes-kernel/vock/vock-crates.inc
 create mode 100644 meta-oe/recipes-kernel/vock/vock.bb
meta-oe/recipes-kernel/vock/vock-crates.inc new file +8 -0
new file mode 100644
index 0000000000..9ddbda00cd
@@ -0,0 +1,8 @@
+# Autogenerated with 'bitbake -c update_crates vock'
+
+# from Cargo.lock
+SRC_URI += " \
+    crate://crates.io/libc/0.2.189 \
+"
+
+SRC_URI[libc-0.2.189.sha256sum] =

"3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"

meta-oe/recipes-kernel/vock/vock.bb new file +1 -0
new file mode 100644
index 0000000000..530ca6dd16
@@ -0,0 +1,33 @@
+SUMMARY = "Kernel code coverage of a user-space command (KCOV, Intel PT,

AMD LBR and Arm Coresight ETMv4)"
+DESCRIPTION = "vock runs a command and reports which kernel code it executed, \
+using KCOV or hardware tracing (Intel PT, AMD LBR/IBS and Arm Coresight ETMv4), \
+optionally with an strace-style syscall trace and syzkaller-compatible output. \
+Coverage is symbolized against a vmlinux (DWARF or BTF) and annotated with kernel source."

meta-oe/recipes-kernel/vock/vock.bb new file +8 -0
+HOMEPAGE = "https://github.com/yskzalloc/vock"
+BUGTRACKER = "https://github.com/yskzalloc/vock/issues"
+SECTION = "devel"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=daf2426a488a4a2b68a88bd7cf6410e4"
+
+SRC_URI = "git://github.com/yskzalloc/vock.git;protocol=https;branch=main

"

meta-oe/recipes-kernel/vock/vock.bb new file +13 -0
+SRCREV = "db50863d4d70038738a157379d24a9d9e5e4ce2a"
+PV = "0.1.0+git"
+
+inherit cargo cargo-update-recipe-crates
+
+require ${BPN}-crates.inc
+
+# Syscall decoding, ptrace register access and the hardware-trace backends
+# are implemented for x86_64 and aarch64 only.
+COMPATIBLE_HOST = "(x86_64|aarch64).*-linux"
+
+do_install:append() {
+    # LD_PRELOAD shim used by --mode kcov to follow forks and threads.

vock

meta-oe/recipes-kernel/vock/vock.bb new file +3 -0
+    # looks it up next to its binary as ../lib/vock/kcov.so, i.e. under
+    # ${nonarch_libdir} regardless of multilib.
+    install -Dm 0755

${B}/target/${CARGO_TARGET_SUBDIR}/libkcov_preload.so \

meta-oe/recipes-kernel/vock/vock.bb new file +4 -1
+        ${D}${nonarch_libdir}/vock/kcov.so
+}
+
+FILES:${PN} += "${nonarch_libdir}/vock"
--

2.55.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#132454):
https://lists.openembedded.org/g/openembedded-devel/message/132454
Mute This Topic: https://lists.openembedded.org/mt/122295770/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Khem,

Quoted 1 line · Khem Raj

Fails to build on TCLIBC = "musl"

Thanks for the pointing out. I've found the issue.

I will send the v2 with the fix.

Many thanks!

Best regards,
Yunseong