* [PATCH 2/4] test: Use syscall in case of no execveat() wrapper
2025-10-06 21:57 [PATCH 1/4] test: Turn char[16] into string to ignore garbage bytes eugene.loh
@ 2025-10-06 21:57 ` eugene.loh
2025-10-07 15:38 ` [DTrace-devel] " Kris Van Hees
2025-10-06 21:57 ` [PATCH 3/4] test: Supply XFAIL for tests that use vtimestamp eugene.loh
` (2 subsequent siblings)
3 siblings, 1 reply; 10+ messages in thread
From: eugene.loh @ 2025-10-06 21:57 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
While execveat() appeared in kernel 3.19, GNU C library support
came later. We are still testing on some systems with older libc.
Do not assume libc has an execveat() wrapper: use syscall().
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
test/unittest/proc/tst.exec-execveat.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/unittest/proc/tst.exec-execveat.sh b/test/unittest/proc/tst.exec-execveat.sh
index db68a5043..e4b9dfa5e 100755
--- a/test/unittest/proc/tst.exec-execveat.sh
+++ b/test/unittest/proc/tst.exec-execveat.sh
@@ -17,7 +17,7 @@ cd $DIRNAME
cat << EOF > parent.c
#include <stdio.h>
#include <linux/fcntl.h> /* Definition of AT_* constants */
-#define __USE_GNU /* so unistd.h will find execveat */
+#include <sys/syscall.h> /* Definition of SYS_* constants */
#include <unistd.h>
int main(int c, char **v) {
@@ -26,7 +26,7 @@ int main(int c, char **v) {
int rc;
printf("exec\n");
- rc = execveat(AT_FDCWD, "bogus_direc/bogus_exec", argv, envp, 0);
+ rc = syscall(__NR_execveat, AT_FDCWD, "bogus_direc/bogus_exec", argv, envp, 0);
return 0;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread* Re: [DTrace-devel] [PATCH 2/4] test: Use syscall in case of no execveat() wrapper
2025-10-06 21:57 ` [PATCH 2/4] test: Use syscall in case of no execveat() wrapper eugene.loh
@ 2025-10-07 15:38 ` Kris Van Hees
2025-10-07 17:44 ` Eugene Loh
0 siblings, 1 reply; 10+ messages in thread
From: Kris Van Hees @ 2025-10-07 15:38 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
On Mon, Oct 06, 2025 at 05:57:24PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> While execveat() appeared in kernel 3.19, GNU C library support
> came later. We are still testing on some systems with older libc.
Wow, we do? I am curious where...
> Do not assume libc has an execveat() wrapper: use syscall().
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> test/unittest/proc/tst.exec-execveat.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/unittest/proc/tst.exec-execveat.sh b/test/unittest/proc/tst.exec-execveat.sh
> index db68a5043..e4b9dfa5e 100755
> --- a/test/unittest/proc/tst.exec-execveat.sh
> +++ b/test/unittest/proc/tst.exec-execveat.sh
> @@ -17,7 +17,7 @@ cd $DIRNAME
> cat << EOF > parent.c
> #include <stdio.h>
> #include <linux/fcntl.h> /* Definition of AT_* constants */
> -#define __USE_GNU /* so unistd.h will find execveat */
> +#include <sys/syscall.h> /* Definition of SYS_* constants */
> #include <unistd.h>
>
> int main(int c, char **v) {
> @@ -26,7 +26,7 @@ int main(int c, char **v) {
> int rc;
>
> printf("exec\n");
> - rc = execveat(AT_FDCWD, "bogus_direc/bogus_exec", argv, envp, 0);
> + rc = syscall(__NR_execveat, AT_FDCWD, "bogus_direc/bogus_exec", argv, envp, 0);
>
> return 0;
> }
> --
> 2.47.3
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [DTrace-devel] [PATCH 2/4] test: Use syscall in case of no execveat() wrapper
2025-10-07 15:38 ` [DTrace-devel] " Kris Van Hees
@ 2025-10-07 17:44 ` Eugene Loh
0 siblings, 0 replies; 10+ messages in thread
From: Eugene Loh @ 2025-10-07 17:44 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
On 10/7/25 11:38, Kris Van Hees wrote:
> On Mon, Oct 06, 2025 at 05:57:24PM -0400, eugene.loh--- via DTrace-devel wrote:
>> From: Eugene Loh <eugene.loh@oracle.com>
>>
>> While execveat() appeared in kernel 3.19, GNU C library support
>> came later. We are still testing on some systems with older libc.
> Wow, we do?
Yeah, I know.
> I am curious where...
E.g., I just launched a fresh OCI OL8 instance.
$ uname -r
5.15.0-312.187.5.1.el8uek.x86_64
$ ls -l /usr/lib64/libc.so*
-rw-r--r--. 1 root root 253 Aug 5 17:05 /usr/lib64/libc.so
lrwxrwxrwx. 1 root root 12 Aug 5 17:06 /usr/lib64/libc.so.6 ->
libc-2.28.so
$ nm /usr/lib64/libc.so.6 |& grep execve
00000000000388d0 t __execve
00000000000388d0 W execve
0000000000108500 T fexecve
00000000000388d0 t __GI___execve
00000000000388d0 t __GI_execve
On an OL9 instance I get:
$ ls -l /usr/lib64/libc.*
-rw-r--r--. 1 root root 7000662 Aug 5 08:18 /usr/lib64/libc.a
-rw-r--r--. 1 root root 253 Aug 5 08:15 /usr/lib64/libc.so
-rwxr-xr-x. 1 root root 2544448 Aug 5 08:18 /usr/lib64/libc.so.6
$ nm /usr/lib64/libc.so.6 | grep execve
00000000000d9eb0 t __execve
00000000000d9eb0 W execve
00000000000fd300 T execveat
00000000000d9ee0 T fexecve
00000000000d9eb0 t __GI___execve
00000000000d9eb0 t __GI_execve
$ ldd --version
ldd (GNU libc) 2.34
>> Do not assume libc has an execveat() wrapper: use syscall().
>>
>> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] test: Supply XFAIL for tests that use vtimestamp
2025-10-06 21:57 [PATCH 1/4] test: Turn char[16] into string to ignore garbage bytes eugene.loh
2025-10-06 21:57 ` [PATCH 2/4] test: Use syscall in case of no execveat() wrapper eugene.loh
@ 2025-10-06 21:57 ` eugene.loh
2025-10-07 15:41 ` [DTrace-devel] " Kris Van Hees
2025-10-06 21:57 ` [PATCH 4/4] test: Skip D return() action if kernel not configured right eugene.loh
2025-10-07 15:37 ` [PATCH 1/4] test: Turn char[16] into string to ignore garbage bytes Kris Van Hees
3 siblings, 1 reply; 10+ messages in thread
From: eugene.loh @ 2025-10-06 21:57 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
test/stress/fbtsafety/tst.index.d | 2 ++
test/stress/fbtsafety/tst.strjoin.d | 2 ++
test/stress/fbtsafety/tst.strstr.d | 2 ++
test/stress/fbtsafety/tst.strtok.d | 2 ++
test/stress/fbtsafety/tst.substr.d | 2 ++
test/unittest/variables/bvar/tst.vtimestamp.d | 2 +-
6 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/test/stress/fbtsafety/tst.index.d b/test/stress/fbtsafety/tst.index.d
index e30b94c0a..3a2e40567 100644
--- a/test/stress/fbtsafety/tst.index.d
+++ b/test/stress/fbtsafety/tst.index.d
@@ -5,6 +5,8 @@
* http://oss.oracle.com/licenses/upl.
*/
+/* @@xfail: dtv2: need vtimestamp support */
+
#pragma D option bufsize=1000
#pragma D option bufpolicy=ring
#pragma D option statusrate=10ms
diff --git a/test/stress/fbtsafety/tst.strjoin.d b/test/stress/fbtsafety/tst.strjoin.d
index a22cc7943..4192bdf9e 100644
--- a/test/stress/fbtsafety/tst.strjoin.d
+++ b/test/stress/fbtsafety/tst.strjoin.d
@@ -5,6 +5,8 @@
* http://oss.oracle.com/licenses/upl.
*/
+/* @@xfail: dtv2: need vtimestamp support */
+
#pragma D option bufsize=1000
#pragma D option bufpolicy=ring
#pragma D option statusrate=10ms
diff --git a/test/stress/fbtsafety/tst.strstr.d b/test/stress/fbtsafety/tst.strstr.d
index 13f4a9245..ee8512f0f 100644
--- a/test/stress/fbtsafety/tst.strstr.d
+++ b/test/stress/fbtsafety/tst.strstr.d
@@ -5,6 +5,8 @@
* http://oss.oracle.com/licenses/upl.
*/
+/* @@xfail: dtv2: need vtimestamp support */
+
#pragma D option bufsize=1000
#pragma D option bufpolicy=ring
#pragma D option statusrate=10ms
diff --git a/test/stress/fbtsafety/tst.strtok.d b/test/stress/fbtsafety/tst.strtok.d
index bc0a707eb..0c5d586fb 100644
--- a/test/stress/fbtsafety/tst.strtok.d
+++ b/test/stress/fbtsafety/tst.strtok.d
@@ -5,6 +5,8 @@
* http://oss.oracle.com/licenses/upl.
*/
+/* @@xfail: dtv2: need vtimestamp support */
+
#pragma D option bufsize=1000
#pragma D option bufpolicy=ring
#pragma D option statusrate=10ms
diff --git a/test/stress/fbtsafety/tst.substr.d b/test/stress/fbtsafety/tst.substr.d
index 8cd021176..ee7234473 100644
--- a/test/stress/fbtsafety/tst.substr.d
+++ b/test/stress/fbtsafety/tst.substr.d
@@ -5,6 +5,8 @@
* http://oss.oracle.com/licenses/upl.
*/
+/* @@xfail: dtv2: need vtimestamp support */
+
#pragma D option bufsize=1000
#pragma D option bufpolicy=ring
#pragma D option statusrate=10ms
diff --git a/test/unittest/variables/bvar/tst.vtimestamp.d b/test/unittest/variables/bvar/tst.vtimestamp.d
index b72eb8a7f..7d92bf4cc 100644
--- a/test/unittest/variables/bvar/tst.vtimestamp.d
+++ b/test/unittest/variables/bvar/tst.vtimestamp.d
@@ -4,7 +4,7 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
-/* @@xfail: dtv2 need vtimestamp support */
+/* @@xfail: dtv2: need vtimestamp support */
/*
* ASSERTION: The 'vtimestamp' variable can be accessed and is not -1.
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [DTrace-devel] [PATCH 3/4] test: Supply XFAIL for tests that use vtimestamp
2025-10-06 21:57 ` [PATCH 3/4] test: Supply XFAIL for tests that use vtimestamp eugene.loh
@ 2025-10-07 15:41 ` Kris Van Hees
2025-10-07 22:54 ` Eugene Loh
0 siblings, 1 reply; 10+ messages in thread
From: Kris Van Hees @ 2025-10-07 15:41 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
Given that vtimestamp is used here in a way that is not actually depending on
its meaning, I'd rather you just change the tests to not depend on vtimestamp,
but instead use something else (e.g. timestamp).
XFAILing them does not seem to e right since vtimestamp is not relevant here.
On Mon, Oct 06, 2025 at 05:57:25PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> ---
> test/stress/fbtsafety/tst.index.d | 2 ++
> test/stress/fbtsafety/tst.strjoin.d | 2 ++
> test/stress/fbtsafety/tst.strstr.d | 2 ++
> test/stress/fbtsafety/tst.strtok.d | 2 ++
> test/stress/fbtsafety/tst.substr.d | 2 ++
> test/unittest/variables/bvar/tst.vtimestamp.d | 2 +-
> 6 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/test/stress/fbtsafety/tst.index.d b/test/stress/fbtsafety/tst.index.d
> index e30b94c0a..3a2e40567 100644
> --- a/test/stress/fbtsafety/tst.index.d
> +++ b/test/stress/fbtsafety/tst.index.d
> @@ -5,6 +5,8 @@
> * http://oss.oracle.com/licenses/upl.
> */
>
> +/* @@xfail: dtv2: need vtimestamp support */
> +
> #pragma D option bufsize=1000
> #pragma D option bufpolicy=ring
> #pragma D option statusrate=10ms
> diff --git a/test/stress/fbtsafety/tst.strjoin.d b/test/stress/fbtsafety/tst.strjoin.d
> index a22cc7943..4192bdf9e 100644
> --- a/test/stress/fbtsafety/tst.strjoin.d
> +++ b/test/stress/fbtsafety/tst.strjoin.d
> @@ -5,6 +5,8 @@
> * http://oss.oracle.com/licenses/upl.
> */
>
> +/* @@xfail: dtv2: need vtimestamp support */
> +
> #pragma D option bufsize=1000
> #pragma D option bufpolicy=ring
> #pragma D option statusrate=10ms
> diff --git a/test/stress/fbtsafety/tst.strstr.d b/test/stress/fbtsafety/tst.strstr.d
> index 13f4a9245..ee8512f0f 100644
> --- a/test/stress/fbtsafety/tst.strstr.d
> +++ b/test/stress/fbtsafety/tst.strstr.d
> @@ -5,6 +5,8 @@
> * http://oss.oracle.com/licenses/upl.
> */
>
> +/* @@xfail: dtv2: need vtimestamp support */
> +
> #pragma D option bufsize=1000
> #pragma D option bufpolicy=ring
> #pragma D option statusrate=10ms
> diff --git a/test/stress/fbtsafety/tst.strtok.d b/test/stress/fbtsafety/tst.strtok.d
> index bc0a707eb..0c5d586fb 100644
> --- a/test/stress/fbtsafety/tst.strtok.d
> +++ b/test/stress/fbtsafety/tst.strtok.d
> @@ -5,6 +5,8 @@
> * http://oss.oracle.com/licenses/upl.
> */
>
> +/* @@xfail: dtv2: need vtimestamp support */
> +
> #pragma D option bufsize=1000
> #pragma D option bufpolicy=ring
> #pragma D option statusrate=10ms
> diff --git a/test/stress/fbtsafety/tst.substr.d b/test/stress/fbtsafety/tst.substr.d
> index 8cd021176..ee7234473 100644
> --- a/test/stress/fbtsafety/tst.substr.d
> +++ b/test/stress/fbtsafety/tst.substr.d
> @@ -5,6 +5,8 @@
> * http://oss.oracle.com/licenses/upl.
> */
>
> +/* @@xfail: dtv2: need vtimestamp support */
> +
> #pragma D option bufsize=1000
> #pragma D option bufpolicy=ring
> #pragma D option statusrate=10ms
> diff --git a/test/unittest/variables/bvar/tst.vtimestamp.d b/test/unittest/variables/bvar/tst.vtimestamp.d
> index b72eb8a7f..7d92bf4cc 100644
> --- a/test/unittest/variables/bvar/tst.vtimestamp.d
> +++ b/test/unittest/variables/bvar/tst.vtimestamp.d
> @@ -4,7 +4,7 @@
> * Licensed under the Universal Permissive License v 1.0 as shown at
> * http://oss.oracle.com/licenses/upl.
> */
> -/* @@xfail: dtv2 need vtimestamp support */
> +/* @@xfail: dtv2: need vtimestamp support */
>
> /*
> * ASSERTION: The 'vtimestamp' variable can be accessed and is not -1.
> --
> 2.47.3
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel@oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [DTrace-devel] [PATCH 3/4] test: Supply XFAIL for tests that use vtimestamp
2025-10-07 15:41 ` [DTrace-devel] " Kris Van Hees
@ 2025-10-07 22:54 ` Eugene Loh
0 siblings, 0 replies; 10+ messages in thread
From: Eugene Loh @ 2025-10-07 22:54 UTC (permalink / raw)
To: Kris Van Hees; +Cc: dtrace, dtrace-devel
Okay. I'm withdrawing this patch. An alternative will be posted shortly.
On 10/7/25 11:41, Kris Van Hees wrote:
> Given that vtimestamp is used here in a way that is not actually depending on
> its meaning, I'd rather you just change the tests to not depend on vtimestamp,
> but instead use something else (e.g. timestamp).
>
> XFAILing them does not seem to e right since vtimestamp is not relevant here.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] test: Skip D return() action if kernel not configured right
2025-10-06 21:57 [PATCH 1/4] test: Turn char[16] into string to ignore garbage bytes eugene.loh
2025-10-06 21:57 ` [PATCH 2/4] test: Use syscall in case of no execveat() wrapper eugene.loh
2025-10-06 21:57 ` [PATCH 3/4] test: Supply XFAIL for tests that use vtimestamp eugene.loh
@ 2025-10-06 21:57 ` eugene.loh
2025-10-06 22:14 ` Kris Van Hees
2025-10-07 15:37 ` [PATCH 1/4] test: Turn char[16] into string to ignore garbage bytes Kris Van Hees
3 siblings, 1 reply; 10+ messages in thread
From: eugene.loh @ 2025-10-06 21:57 UTC (permalink / raw)
To: dtrace, dtrace-devel
From: Eugene Loh <eugene.loh@oracle.com>
Most of the err.* tests can still be run, since they test other
failure modes.
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
---
.../unittest/actions/return/err.destructive.x | 1 +
.../unittest/actions/return/tst.destructive.x | 67 +++++++++++++++++++
.../return/tst.override-getpid-entry.x | 1 +
.../return/tst.override-getpid-return.x | 1 +
4 files changed, 70 insertions(+)
create mode 120000 test/unittest/actions/return/err.destructive.x
create mode 100755 test/unittest/actions/return/tst.destructive.x
create mode 120000 test/unittest/actions/return/tst.override-getpid-entry.x
create mode 120000 test/unittest/actions/return/tst.override-getpid-return.x
diff --git a/test/unittest/actions/return/err.destructive.x b/test/unittest/actions/return/err.destructive.x
new file mode 120000
index 000000000..2cb5b1159
--- /dev/null
+++ b/test/unittest/actions/return/err.destructive.x
@@ -0,0 +1 @@
+tst.destructive.s
\ No newline at end of file
diff --git a/test/unittest/actions/return/tst.destructive.x b/test/unittest/actions/return/tst.destructive.x
new file mode 100755
index 000000000..d54bbb2fa
--- /dev/null
+++ b/test/unittest/actions/return/tst.destructive.x
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2025, 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.
+
+# For us to use the return() action, the kernel needs to be configured
+# properly. In /usr/include/linux/bpf.h, we see that bpf_override_return()
+# needs both CONFIG_BPF_KPROBE_OVERRIDE and CONFIG_FUNCTION_ERROR_INJECTION.
+
+# To check kernel configuration parameters, check
+# https://docs.rockylinux.org/10/gemstones/core/view_kernel_conf/
+
+# Look for a file with kernel configuration parameters.
+
+file=""
+for x in \
+ /boot/config-$(uname -r) \
+ /lib/modules/$(uname -r)/config \
+ /lib/modules/$(uname -r)/build/.config \
+ /usr/src/kernels/$(uname -r)/.config \
+; do
+ if [ -e $x ]; then
+ file=$x
+ fi
+done
+
+# If such a file is found, look for the necessary parameters.
+
+if [ $file != "" ]; then
+ if ! grep -q CONFIG_BPF_KPROBE_OVERRIDE=y $file; then
+ echo need CONFIG_BPF_KPROBE_OVERRIDE=y for D return action, not found in $file
+ exit 2
+ fi
+ if ! grep -q CONFIG_FUNCTION_ERROR_INJECTION=y $file; then
+ echo need CONFIG_FUNCTION_ERROR_INJECTION=y for D return action, not found in $file
+ exit 2
+ fi
+
+ exit 0
+fi
+
+# Some distributions, like Gentoo and Arch, use the configs kernel module to provide
+# /proc/config.gz by default instead.
+
+if [ -e /proc/config.gz ]; then
+ echo try gentoo
+ # zcat /proc/config.gz | grep -i <keyword>
+ # zgrep <keyword> /proc/config.gz
+ if ! zgrep -q CONFIG_BPF_KPROBE_OVERRIDE=y /proc/config.gz; then
+ echo need CONFIG_BPF_KPROBE_OVERRIDE=y for D return action
+ exit 2
+ fi
+ if ! zgrep -q grep CONFIG_FUNCTION_ERROR_INJECTION=y /proc/config.gz; then
+ echo need CONFIG_FUNCTION_ERROR_INJECTION=y for D return action
+ exit 2
+ fi
+
+ exit 0
+fi
+
+
+# We cannot figure out the kernel configuration parameters.
+# Go ahead, run the test, and hope for the best.
+
+exit 0
diff --git a/test/unittest/actions/return/tst.override-getpid-entry.x b/test/unittest/actions/return/tst.override-getpid-entry.x
new file mode 120000
index 000000000..36e160027
--- /dev/null
+++ b/test/unittest/actions/return/tst.override-getpid-entry.x
@@ -0,0 +1 @@
+tst.destructive.x
\ No newline at end of file
diff --git a/test/unittest/actions/return/tst.override-getpid-return.x b/test/unittest/actions/return/tst.override-getpid-return.x
new file mode 120000
index 000000000..36e160027
--- /dev/null
+++ b/test/unittest/actions/return/tst.override-getpid-return.x
@@ -0,0 +1 @@
+tst.destructive.x
\ No newline at end of file
--
2.47.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] test: Skip D return() action if kernel not configured right
2025-10-06 21:57 ` [PATCH 4/4] test: Skip D return() action if kernel not configured right eugene.loh
@ 2025-10-06 22:14 ` Kris Van Hees
0 siblings, 0 replies; 10+ messages in thread
From: Kris Van Hees @ 2025-10-06 22:14 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
Why not just check /sys/kernel/debug/error_injection/list?
On Mon, Oct 06, 2025 at 05:57:26PM -0400, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> Most of the err.* tests can still be run, since they test other
> failure modes.
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
> ---
> .../unittest/actions/return/err.destructive.x | 1 +
> .../unittest/actions/return/tst.destructive.x | 67 +++++++++++++++++++
> .../return/tst.override-getpid-entry.x | 1 +
> .../return/tst.override-getpid-return.x | 1 +
> 4 files changed, 70 insertions(+)
> create mode 120000 test/unittest/actions/return/err.destructive.x
> create mode 100755 test/unittest/actions/return/tst.destructive.x
> create mode 120000 test/unittest/actions/return/tst.override-getpid-entry.x
> create mode 120000 test/unittest/actions/return/tst.override-getpid-return.x
>
> diff --git a/test/unittest/actions/return/err.destructive.x b/test/unittest/actions/return/err.destructive.x
> new file mode 120000
> index 000000000..2cb5b1159
> --- /dev/null
> +++ b/test/unittest/actions/return/err.destructive.x
> @@ -0,0 +1 @@
> +tst.destructive.s
> \ No newline at end of file
> diff --git a/test/unittest/actions/return/tst.destructive.x b/test/unittest/actions/return/tst.destructive.x
> new file mode 100755
> index 000000000..d54bbb2fa
> --- /dev/null
> +++ b/test/unittest/actions/return/tst.destructive.x
> @@ -0,0 +1,67 @@
> +#!/bin/bash
> +#
> +# Oracle Linux DTrace.
> +# Copyright (c) 2025, 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.
> +
> +# For us to use the return() action, the kernel needs to be configured
> +# properly. In /usr/include/linux/bpf.h, we see that bpf_override_return()
> +# needs both CONFIG_BPF_KPROBE_OVERRIDE and CONFIG_FUNCTION_ERROR_INJECTION.
> +
> +# To check kernel configuration parameters, check
> +# https://docs.rockylinux.org/10/gemstones/core/view_kernel_conf/
> +
> +# Look for a file with kernel configuration parameters.
> +
> +file=""
> +for x in \
> + /boot/config-$(uname -r) \
> + /lib/modules/$(uname -r)/config \
> + /lib/modules/$(uname -r)/build/.config \
> + /usr/src/kernels/$(uname -r)/.config \
> +; do
> + if [ -e $x ]; then
> + file=$x
> + fi
> +done
> +
> +# If such a file is found, look for the necessary parameters.
> +
> +if [ $file != "" ]; then
> + if ! grep -q CONFIG_BPF_KPROBE_OVERRIDE=y $file; then
> + echo need CONFIG_BPF_KPROBE_OVERRIDE=y for D return action, not found in $file
> + exit 2
> + fi
> + if ! grep -q CONFIG_FUNCTION_ERROR_INJECTION=y $file; then
> + echo need CONFIG_FUNCTION_ERROR_INJECTION=y for D return action, not found in $file
> + exit 2
> + fi
> +
> + exit 0
> +fi
> +
> +# Some distributions, like Gentoo and Arch, use the configs kernel module to provide
> +# /proc/config.gz by default instead.
> +
> +if [ -e /proc/config.gz ]; then
> + echo try gentoo
> + # zcat /proc/config.gz | grep -i <keyword>
> + # zgrep <keyword> /proc/config.gz
> + if ! zgrep -q CONFIG_BPF_KPROBE_OVERRIDE=y /proc/config.gz; then
> + echo need CONFIG_BPF_KPROBE_OVERRIDE=y for D return action
> + exit 2
> + fi
> + if ! zgrep -q grep CONFIG_FUNCTION_ERROR_INJECTION=y /proc/config.gz; then
> + echo need CONFIG_FUNCTION_ERROR_INJECTION=y for D return action
> + exit 2
> + fi
> +
> + exit 0
> +fi
> +
> +
> +# We cannot figure out the kernel configuration parameters.
> +# Go ahead, run the test, and hope for the best.
> +
> +exit 0
> diff --git a/test/unittest/actions/return/tst.override-getpid-entry.x b/test/unittest/actions/return/tst.override-getpid-entry.x
> new file mode 120000
> index 000000000..36e160027
> --- /dev/null
> +++ b/test/unittest/actions/return/tst.override-getpid-entry.x
> @@ -0,0 +1 @@
> +tst.destructive.x
> \ No newline at end of file
> diff --git a/test/unittest/actions/return/tst.override-getpid-return.x b/test/unittest/actions/return/tst.override-getpid-return.x
> new file mode 120000
> index 000000000..36e160027
> --- /dev/null
> +++ b/test/unittest/actions/return/tst.override-getpid-return.x
> @@ -0,0 +1 @@
> +tst.destructive.x
> \ No newline at end of file
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/4] test: Turn char[16] into string to ignore garbage bytes
2025-10-06 21:57 [PATCH 1/4] test: Turn char[16] into string to ignore garbage bytes eugene.loh
` (2 preceding siblings ...)
2025-10-06 21:57 ` [PATCH 4/4] test: Skip D return() action if kernel not configured right eugene.loh
@ 2025-10-07 15:37 ` Kris Van Hees
3 siblings, 0 replies; 10+ messages in thread
From: Kris Van Hees @ 2025-10-07 15:37 UTC (permalink / raw)
To: eugene.loh; +Cc: dtrace, dtrace-devel
On Mon, Oct 06, 2025 at 05:57:23PM -0400, eugene.loh@oracle.com wrote:
> From: Eugene Loh <eugene.loh@oracle.com>
>
> In commit 308e996c0 ("cg, agg: fix alignment of key components"), a new
> test test/unittest/aggs/tst.chararray-key.d used a char[16] as an agg key.
> The problem is that the char array, curpsinfo->pr_fname, could have
> garbage bytes after the first NUL byte, polluting test output.
>
> Since we do not care about any such garbage bytes, convert to a string.
>
> Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
> ---
> test/unittest/aggs/tst.chararray-key.d | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/unittest/aggs/tst.chararray-key.d b/test/unittest/aggs/tst.chararray-key.d
> index af45d4a5e..2bb638372 100644
> --- a/test/unittest/aggs/tst.chararray-key.d
> +++ b/test/unittest/aggs/tst.chararray-key.d
> @@ -15,7 +15,7 @@
>
> BEGIN
> {
> - @[curpsinfo->pr_fname] = count();
> + @[(string)curpsinfo->pr_fname] = count();
> exit(0);
> }
>
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 10+ messages in thread