From: eugene.loh@oracle.com
To: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: [PATCH] Fix progenyof to compare TGIDs
Date: Sat, 28 Mar 2026 12:41:59 -0400 [thread overview]
Message-ID: <20260328164159.15149-1-eugene.loh@oracle.com> (raw)
From: Eugene Loh <eugene.loh@oracle.com>
Switch the BPF progenyof helper to read TASK_TGID so it matches the
process IDs returned by ppid and expand the progenyof test to cover both
pid and ppid. The original tst.progenyof.d only exercised probes in the
main DTrace thread where tid == tgid, so it never exposed the mismatch.
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
bpf/progenyof.S | 6 +++---
test/unittest/funcs/tst.progenyof2.sh | 31 +++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 3 deletions(-)
create mode 100755 test/unittest/funcs/tst.progenyof2.sh
diff --git a/bpf/progenyof.S b/bpf/progenyof.S
index 5b4ce60fa..8ee76e63c 100644
--- a/bpf/progenyof.S
+++ b/bpf/progenyof.S
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * Copyright (c) 2022, 2024, Oracle and/or its affiliates.
+ * Copyright (c) 2022, 2026, Oracle and/or its affiliates.
*/
#include <bpf_asm_helpers.h>
@@ -34,11 +34,11 @@ dt_progenyof:
/* if (count <= 0) goto Lret0 */
jsle CNT, 0, .Lret0
- /* val = *((uint32_t *)(ptr + TASK_PID)), using [%fp+-8] as temp */
+ /* val = *((uint32_t *)(ptr + TASK_TGID)), using [%fp+-8] as temp */
mov %r1, %fp
add %r1, -8
mov %r2, 4
- lddw %r3, TASK_PID
+ lddw %r3, TASK_TGID
add %r3, PTR
call BPF_FUNC_probe_read
jne %r0, 0, .Lret0
diff --git a/test/unittest/funcs/tst.progenyof2.sh b/test/unittest/funcs/tst.progenyof2.sh
new file mode 100755
index 000000000..1f284cdd8
--- /dev/null
+++ b/test/unittest/funcs/tst.progenyof2.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+
+dtrace=$1
+
+DIRNAME="$tmpdir/progenyof2.$$.$RANDOM"
+mkdir -p $DIRNAME
+cd $DIRNAME
+
+# make the trigger
+
+cat << EOF > a.c
+int main(void) {
+ return 0;
+}
+EOF
+$CC $test_cppflags $test_ldflags a.c
+if [ $? -ne 0 ]; then
+ echo ERROR: compiling trigger
+ exit 1
+fi
+
+# check that progenyof(ppid) and progenyof(pid) are nonzero
+
+$dtrace -c ./a.out -qn 'pid$target:a.out:main:* { exit((progenyof(ppid) && progenyof(pid)) ? 0 : 1) }'
+
+exit $?
--
2.47.3
reply other threads:[~2026-03-28 16:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260328164159.15149-1-eugene.loh@oracle.com \
--to=eugene.loh@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox