From 9eb37102d48b814821b7f474986a7bfe86784192 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Wed, 17 Jun 2020 13:39:20 -0400 Subject: [PATCH] Use explicit @cast() operators for pfiles.stp and ioctl_handler.stp Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast() operations work and they no longer default to using the kernel debuginfo for type information. Need to include kernel as location for this information for the @cast() rather than just assuming a default. --- testsuite/systemtap.examples/process/pfiles.stp | 6 +++--- testsuite/systemtap.examples/profiling/ioctl_handler.stp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/testsuite/systemtap.examples/process/pfiles.stp b/testsuite/systemtap.examples/process/pfiles.stp index d52a1547b..6344a4c8d 100755 --- a/testsuite/systemtap.examples/process/pfiles.stp +++ b/testsuite/systemtap.examples/process/pfiles.stp @@ -787,9 +787,9 @@ function print_unix_socket(sock) { strlen(peername) > 0 ? peername . "\n" : "") try { # skip line in case of null pointers printf(" peercred pid: %d\n", - @defined(@cast(sock, "socket")->sk->sk_peer_pid) ? - @cast(sock, "socket")->sk->sk_peer_pid->numbers[0]->nr : - @cast(sock, "socket")->sk->sk_peercred->pid ); } catch { } + @defined(@cast(sock, "socket", "kernel")->sk->sk_peer_pid) ? + @cast(sock, "socket", "kernel")->sk->sk_peer_pid->numbers[0]->nr : + @cast(sock, "socket", "kernel")->sk->sk_peercred->pid ); } catch { } } function print_ipv4_socket(sock) { diff --git a/testsuite/systemtap.examples/profiling/ioctl_handler.stp b/testsuite/systemtap.examples/profiling/ioctl_handler.stp index 704418570..6f1e52c5a 100755 --- a/testsuite/systemtap.examples/profiling/ioctl_handler.stp +++ b/testsuite/systemtap.examples/profiling/ioctl_handler.stp @@ -9,7 +9,7 @@ probe syscall.ioctl { ioctl_requests[execname()] <<< 1 try { # Dig down through the task struct to find the actual function handling ioctl. - ioctl_func_address = @cast(task_current(), "struct task_struct")->files->fdt->fd[fd]->f_op->unlocked_ioctl + ioctl_func_address = @cast(task_current(), "struct task_struct", "kernel")->files->fdt->fd[fd]->f_op->unlocked_ioctl if (ioctl_func_address) ioctl_func[execname(), ioctl_func_address] <<< 1 } catch { -- 2.43.5