Skip to content

Commit

Permalink
ply: add new package
Browse files Browse the repository at this point in the history
A light-weight dynamic tracer for Linux that leverages
the kernel's BPF VM in concert with kprobes and tracepoints
to attach probes to arbitrary points in the kernel.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed May 5, 2024
1 parent c1b3e04 commit cc5a39b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
46 changes: 46 additions & 0 deletions utils/ply/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=ply
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/iovisor/ply
PKG_MIRROR_HASH:=88b13091060c304ea7ecd3471d3889cf9daf6c0e524f6f810e56502fe46a4803
PKG_SOURCE_DATE:=2023-05-19
PKG_SOURCE_VERSION:=1b57943db56692924bccb61c271de24a8264d8df

PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING
PKG_FIXUP:=autoreconf
PKG_MAINTAINER:=Jianhui Zhao <zhaojh329@gmail.com>

include $(INCLUDE_DIR)/package.mk

define Package/ply
SECTION:=base
CATEGORY:=Base system
TITLE:=A dynamic tracer for Linux
DEPENDS:=@(aarch64||arm||powerpc||x86_64||riscv64) +@KERNEL_BPF_EVENTS +@KERNEL_FTRACE_SYSCALLS \
+@KERNEL_ENABLE_DEFAULT_TRACERS +@KERNEL_FUNCTION_TRACER +@KERNEL_FUNCTION_GRAPH_TRACER \
+@KERNEL_DYNAMIC_FTRACE +@KERNEL_FUNCTION_PROFILER +@KERNEL_IRQSOFF_TRACER \
+@KERNEL_PREEMPT_TRACER
URL:=https://github.com/iovisor/ply
endef

define Package/ply/description
A light-weight dynamic tracer for Linux that leverages the
kernel's BPF VM in concert with kprobes and tracepoints to
attach probes to arbitrary points in the kernel.
endef

define Package/ply/install
$(call Build/Install/Default)

$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libply.so* $(1)/usr/lib

$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/ply $(1)/usr/sbin
endef

$(eval $(call BuildPackage,ply))
9 changes: 9 additions & 0 deletions utils/ply/patches/001-fix-autoconf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
AC_PREREQ(2.61)
-AC_INIT(ply, [m4_esyscmd_s(git describe --always --dirty)],
+AC_INIT(ply, [2.3.0-9-g1b57943],
https://github.com/wkz/ply/issues)

AC_GNU_SOURCE
11 changes: 11 additions & 0 deletions utils/ply/patches/002-use-BPF_FUNC_probe_read_str.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/libply/built-in/memory.c
+++ b/src/libply/built-in/memory.c
@@ -140,7 +140,7 @@ static int str_ir_post(const struct func
ir_emit_ldbp(pb->ir, BPF_REG_1, n->sym->irs.stack);
ir_emit_insn(ir, MOV_IMM((int32_t)type_sizeof(n->sym->type)), BPF_REG_2, 0);
ir_emit_sym_to_reg(ir, BPF_REG_3, ptr->sym);
- ir_emit_insn(ir, CALL(BPF_FUNC_probe_read_kernel_str), 0, 0);
+ ir_emit_insn(ir, CALL(BPF_FUNC_probe_read_str), 0, 0);
return 0;
}

0 comments on commit cc5a39b

Please sign in to comment.