Skip to content

Commit 08fa6c3

Browse files
shashank-mahadasyamavagin
authored andcommitted
zdtm: add a test for --allow-uprobes option
Program flow: - Parse the test's own executable to calculate the file offset of the uprobe target function symbol - Enable the uprobe at the target function - Call the target function to trigger the uprobe, and hence the uprobes vma creation - C/R - Call the target function again to check that no SIGTRAP is sent, since the uprobe is still active At least v1.7 of libtracefs is required because that's when tracefs_instance_reset was introduced. The uprobes API was introduced in v1.4, and the dynamic events API was introduced in v1.3. Ubuntu Focal doesn't have libtracefs. Jammy has v1.2.5, and Noble has v1.7. Signed-off-by: Shashank Balaji <[email protected]>
1 parent f0e6b6d commit 08fa6c3

File tree

8 files changed

+326
-3
lines changed

8 files changed

+326
-3
lines changed

contrib/dependencies/apk-packages.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ apk add --no-cache \
66
build-base \
77
coreutils \
88
e2fsprogs \
9+
elfutils-dev \
910
git \
1011
gnutls-dev \
1112
go \
@@ -20,6 +21,8 @@ apk add --no-cache \
2021
libdrm-dev \
2122
libnet-dev \
2223
libnl3-dev \
24+
libtraceevent-dev \
25+
libtracefs-dev \
2326
nftables \
2427
nftables-dev \
2528
perl \

contrib/dependencies/apt-cross-packages.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ fi
1414
libc6-"${DEBIAN_ARCH}"-cross \
1515
libc6-dev-"${DEBIAN_ARCH}"-cross \
1616
libcap-dev:"${DEBIAN_ARCH}" \
17+
libdrm-dev:"${DEBIAN_ARCH}" \
18+
libelf-dev:"${DEBIAN_ARCH}" \
1719
libexpat1-dev:"${DEBIAN_ARCH}" \
1820
libgnutls28-dev:"${DEBIAN_ARCH}" \
1921
libnet-dev:"${DEBIAN_ARCH}" \
@@ -23,9 +25,10 @@ fi
2325
libprotobuf-c-dev:"${DEBIAN_ARCH}" \
2426
libprotobuf-dev:"${DEBIAN_ARCH}" \
2527
libssl-dev:"${DEBIAN_ARCH}" \
28+
libtraceevent-dev:"${DEBIAN_ARCH}" \
29+
libtracefs-dev:"${DEBIAN_ARCH}" \
2630
ncurses-dev:"${DEBIAN_ARCH}" \
2731
uuid-dev:"${DEBIAN_ARCH}" \
28-
libdrm-dev:"${DEBIAN_ARCH}" \
2932
build-essential \
3033
pkg-config \
3134
git \

contrib/dependencies/apt-packages.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ fi
1919
libbsd-dev \
2020
libcap-dev \
2121
libdrm-dev \
22+
libelf-dev \
2223
libgnutls28-dev \
2324
libgnutls30 \
2425
libnet-dev \
@@ -28,6 +29,8 @@ fi
2829
libprotobuf-c-dev \
2930
libprotobuf-dev \
3031
libselinux-dev \
32+
libtraceevent-dev \
33+
libtracefs-dev \
3134
pkg-config \
3235
protobuf-c-compiler \
3336
protobuf-compiler \

contrib/dependencies/dnf-packages.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
dnf install -y \
44
asciidoc \
55
binutils \
6+
elfutils-libelf-devel \
67
gcc \
78
git \
89
glibc-devel \
@@ -18,6 +19,8 @@ dnf install -y \
1819
libnet-devel \
1920
libnl3-devel \
2021
libselinux-devel \
22+
libtraceevent-devel \
23+
libtracefs-devel \
2124
libuuid-devel \
2225
make \
2326
nftables \
@@ -27,9 +30,9 @@ dnf install -y \
2730
protobuf-c-devel \
2831
protobuf-compiler \
2932
protobuf-devel \
30-
python-devel \
3133
python3-importlib-metadata \
3234
python3-protobuf \
3335
python3-pyyaml \
36+
python-devel \
3437
rubygem-asciidoctor \
3538
xmlto

contrib/dependencies/pacman-packages.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ pacman -Syu --noconfirm \
1515
libbsd \
1616
libcap \
1717
libdrm \
18+
libelf \
1819
libnet \
1920
libnl \
21+
libtraceevent \
22+
libtracefs \
2023
nftables \
2124
pkg-config \
2225
protobuf \

test/zdtm/static/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ TST_NOFILE := \
290290
291291
PKG_CONFIG ?= pkg-config
292292
pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
293+
pkg-config-atleast-version = $(shell sh -c '$(PKG_CONFIG) --atleast-version=$(2) $(1) && echo y')
293294
ifeq ($(call pkg-config-check,libbpf),y)
294295
TST_NOFILE += \
295296
bpf_hash \
@@ -298,7 +299,10 @@ endif
298299

299300
ifneq ($(ARCH),arm)
300301
ifneq ($(COMPAT_TEST),y)
301-
TST_NOFILE += maps03
302+
TST_NOFILE += maps03
303+
ifeq ($(call pkg-config-atleast-version,libtracefs,1.7),y)
304+
TST_NOFILE += uprobes
305+
endif
302306
endif
303307
endif
304308

@@ -727,6 +731,9 @@ sk-unix-listen04: CFLAGS += -DSK_UNIX_LISTEN02 -DSK_UNIX_LISTEN03
727731

728732
cgroupv2_01: LDLIBS += -pthread
729733

734+
uprobes: CFLAGS += $(call pkg-cflags, libtracefs libtraceevent)
735+
uprobes: LDLIBS += $(call pkg-libs, libtracefs libelf)
736+
730737
$(LIB): force
731738
$(Q) $(MAKE) -C $(LIBDIR)
732739

0 commit comments

Comments
 (0)