[DTrace-devel] [PATCH] test: ensure tst.exitcore.sh works on all systems

Kris Van Hees kris.van.hees at oracle.com
Tue Feb 28 01:10:47 UTC 2023


Some systems have a very strict separation between reading from kernel
vs userspace addresses.  The test has been updated to always use
copyin() and copyinstr() when accessing userspace addresses.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 test/unittest/proc/tst.exitcore.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/test/unittest/proc/tst.exitcore.sh b/test/unittest/proc/tst.exitcore.sh
index dff3fbe1..7c43fdbb 100755
--- a/test/unittest/proc/tst.exitcore.sh
+++ b/test/unittest/proc/tst.exitcore.sh
@@ -20,9 +20,12 @@ ulimit -c unlimited
 script()
 {
 	$dtrace $dt_flags -s /dev/stdin <<EOF
+	uintptr_t	*argv;
+
 	syscall::execve:entry
-	/copyinstr((uintptr_t)args[1][0]) == "sleep" && args[1][1] &&
-	 copyinstr((uintptr_t)args[1][1]) == "10000"/
+	/args[1] && (argv = copyin((uintptr_t)args[1], 2 * sizeof(char *))) &&
+	 copyinstr(argv[0]) == "sleep" && argv[1] &&
+	 copyinstr(argv[1]) == "10000"/
 	{
 		core_pid = pid;
 	}
-- 
2.39.1




More information about the DTrace-devel mailing list