Blame SOURCES/rhbz1855264.patch

ccdb4d
commit 0a281a96ddf7cae9a0f0cc0eb505a752ffdd932e
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Tue Jun 16 16:02:11 2020 -0400
ccdb4d
ccdb4d
    Make sizeof.stp runnable with the bpf backend.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.examples/general/sizeof.meta b/testsuite/systemtap.examples/general/sizeof.meta
ccdb4d
index 29713e4..b30078d 100644
ccdb4d
--- a/testsuite/systemtap.examples/general/sizeof.meta
ccdb4d
+++ b/testsuite/systemtap.examples/general/sizeof.meta
ccdb4d
@@ -2,7 +2,7 @@ title: Print the Size of a C Type
ccdb4d
 name: sizeof.stp
ccdb4d
 version: 1.0
ccdb4d
 author: anonymous
ccdb4d
-keywords: statistics memory
ccdb4d
+keywords: statistics memory bpf
ccdb4d
 subsystem: any
ccdb4d
 status: proposed
ccdb4d
 exit: event-ended
ccdb4d
@@ -11,3 +11,5 @@ scope: system-wide
ccdb4d
 description: This script prints the size of a type, based on dwarf debuginfo for any kernel or userspace module, or trial-compilation of a given header file name.
ccdb4d
 test_check: stap -p4 sizeof.stp task_struct 'kernel<include/linux/sched.h>'
ccdb4d
 test_installcheck: stap sizeof.stp FILE '</usr/include/stdio.h>'
ccdb4d
+test_check_bpf: stap -p4 --bpf sizeof.stp task_struct 'kernel<include/linux/sched.h>'
ccdb4d
+test_installcheck_bpf: stap --bpf sizeof.stp FILE '</usr/include/stdio.h>'
ccdb4d
diff --git a/testsuite/systemtap.examples/general/sizeof.stp b/testsuite/systemtap.examples/general/sizeof.stp
ccdb4d
index 0c77dce..5aec674 100755
ccdb4d
--- a/testsuite/systemtap.examples/general/sizeof.stp
ccdb4d
+++ b/testsuite/systemtap.examples/general/sizeof.stp
ccdb4d
@@ -7,9 +7,11 @@
ccdb4d
 #          sizeof.stp TYPENAME </usr/include/someheader.h>
ccdb4d
 
ccdb4d
 probe oneshot {
ccdb4d
-  println("type ", @1, 
ccdb4d
-          %( $# > 1 %? " in ", @2, %)   /* module or header file name */
ccdb4d
-          " byte-size: ",
ccdb4d
-          %( $# > 1 %? @cast_module_sizeof(@2, @1) %: @cast_sizeof(@1) %)
ccdb4d
-          )
ccdb4d
+  %( $# > 1 %?
ccdb4d
+     printf("type %s in %s byte-size: %d\n", @1, @2,
ccdb4d
+	    @cast_module_sizeof(@2, @1))
ccdb4d
+  %:
ccdb4d
+     printf("type %s byte-size: %d\n", @1,
ccdb4d
+	    @cast_sizeof(@1))
ccdb4d
+  %)
ccdb4d
 }
ccdb4d
commit 2b2b6a622dc1d434c60d0ea159b260f660068ad1
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Wed Jun 17 11:57:18 2020 -0400
ccdb4d
ccdb4d
    Fix sizeof.stp to explicitly use kernel debuginfo if one not specified
ccdb4d
    
ccdb4d
    Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
ccdb4d
    operations work and they no longer default to using the kernel
ccdb4d
    debuginfo for type information.  Need to use the @cast_module_sizeof()
ccdb4d
    instead of @cast_size() to use the kernel debuginfo.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.examples/general/sizeof.stp b/testsuite/systemtap.examples/general/sizeof.stp
ccdb4d
index 5aec674..b45f593 100755
ccdb4d
--- a/testsuite/systemtap.examples/general/sizeof.stp
ccdb4d
+++ b/testsuite/systemtap.examples/general/sizeof.stp
ccdb4d
@@ -12,6 +12,6 @@ probe oneshot {
ccdb4d
 	    @cast_module_sizeof(@2, @1))
ccdb4d
   %:
ccdb4d
      printf("type %s byte-size: %d\n", @1,
ccdb4d
-	    @cast_sizeof(@1))
ccdb4d
+	    @cast_module_sizeof("kernel", @1))
ccdb4d
   %)
ccdb4d
 }
ccdb4d
ccdb4d
commit 717b7dddd08b66b3caa5585221472d84e40be658
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Wed Jun 17 13:08:30 2020 -0400
ccdb4d
ccdb4d
    Use explicit @cast() operators to fslatency-nd.stp and fsslower-nd.stp
ccdb4d
    
ccdb4d
    Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
ccdb4d
    operations work and they no longer default to using the kernel
ccdb4d
    debuginfo for type information.  Need to include kernel as location for
ccdb4d
    this information for the  @cast() rather than just assuming a default.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.examples/lwtools/fslatency-nd.stp b/testsuite/systemtap.examples/lwtools/fslatency-nd.stp
ccdb4d
index 6008399..0bee34f 100755
ccdb4d
--- a/testsuite/systemtap.examples/lwtools/fslatency-nd.stp
ccdb4d
+++ b/testsuite/systemtap.examples/lwtools/fslatency-nd.stp
ccdb4d
@@ -63,8 +63,8 @@ probe __vfs_read = kprobe.function("__vfs_read")
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_read() wouldn't be called.
ccdb4d
 	file = pointer_arg(1)
ccdb4d
-	if (!file || @cast(file, "file")->f_op->read
ccdb4d
-	    || !@cast(file, "file")->f_op->read_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->read
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->read_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
 
ccdb4d
@@ -75,8 +75,8 @@ probe __vfs_write = kprobe.function("__vfs_write")
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_write() wouldn't be called.
ccdb4d
 	file = pointer_arg(1)
ccdb4d
-	if (!file || @cast(file, "file")->f_op->write
ccdb4d
-	    || !@cast(file, "file")->f_op->write_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->write
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->write_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
 
ccdb4d
@@ -102,8 +102,8 @@ probe __vfs_read.return = kprobe.function("__vfs_read").return
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_read() wouldn't be called.
ccdb4d
 	file = @entry(pointer_arg(1))
ccdb4d
-	if (!file || @cast(file, "file")->f_op->read
ccdb4d
-	    || !@cast(file, "file")->f_op->read_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->read
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->read_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
 
ccdb4d
@@ -115,8 +115,8 @@ probe __vfs_write.return = kprobe.function("__vfs_write")
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_write() wouldn't be called.
ccdb4d
 	file = pointer_arg(1)
ccdb4d
-	if (!file || @cast(file, "file")->f_op->write
ccdb4d
-	    || !@cast(file, "file")->f_op->write_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->write
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->write_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
 
ccdb4d
diff --git a/testsuite/systemtap.examples/lwtools/fsslower-nd.stp b/testsuite/systemtap.examples/lwtools/fsslower-nd.stp
ccdb4d
index 64abe41..90fa9b5 100755
ccdb4d
--- a/testsuite/systemtap.examples/lwtools/fsslower-nd.stp
ccdb4d
+++ b/testsuite/systemtap.examples/lwtools/fsslower-nd.stp
ccdb4d
@@ -65,8 +65,8 @@ probe __vfs_read = kprobe.function("__vfs_read")
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_read() wouldn't be called.
ccdb4d
 	file = pointer_arg(1)
ccdb4d
-	if (!file || @cast(file, "file")->f_op->read
ccdb4d
-	    || !@cast(file, "file")->f_op->read_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->read
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->read_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
 
ccdb4d
@@ -77,8 +77,8 @@ probe __vfs_write = kprobe.function("__vfs_write")
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_write() wouldn't be called.
ccdb4d
 	file = pointer_arg(1)
ccdb4d
-	if (!file || @cast(file, "file")->f_op->write
ccdb4d
-	    || !@cast(file, "file")->f_op->write_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->write
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->write_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
 
ccdb4d
@@ -110,8 +110,8 @@ probe __vfs_read.return = kprobe.function("__vfs_read").return
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_read() wouldn't be called.
ccdb4d
 	file = @entry(pointer_arg(1))
ccdb4d
-	if (!file || @cast(file, "file")->f_op->read
ccdb4d
-	    || !@cast(file, "file")->f_op->read_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->read
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->read_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
 
ccdb4d
@@ -123,7 +123,7 @@ probe __vfs_write.return = kprobe.function("__vfs_write")
ccdb4d
 {
ccdb4d
 	# Skip the call if new_sync_write() wouldn't be called.
ccdb4d
 	file = pointer_arg(1)
ccdb4d
-	if (!file || @cast(file, "file")->f_op->write
ccdb4d
-	    || !@cast(file, "file")->f_op->write_iter)
ccdb4d
+	if (!file || @cast(file, "file", "kernel")->f_op->write
ccdb4d
+	    || !@cast(file, "file", "kernel")->f_op->write_iter)
ccdb4d
 		next
ccdb4d
 }
ccdb4d
ccdb4d
commit 9eb37102d48b814821b7f474986a7bfe86784192
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Wed Jun 17 13:39:20 2020 -0400
ccdb4d
ccdb4d
    Use explicit @cast() operators for pfiles.stp and ioctl_handler.stp
ccdb4d
    
ccdb4d
    Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
ccdb4d
    operations work and they no longer default to using the kernel
ccdb4d
    debuginfo for type information.  Need to include kernel as location for
ccdb4d
    this information for the  @cast() rather than just assuming a default.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.examples/process/pfiles.stp b/testsuite/systemtap.examples/process/pfiles.stp
ccdb4d
index d52a154..6344a4c 100755
ccdb4d
--- a/testsuite/systemtap.examples/process/pfiles.stp
ccdb4d
+++ b/testsuite/systemtap.examples/process/pfiles.stp
ccdb4d
@@ -787,9 +787,9 @@ function print_unix_socket(sock) {
ccdb4d
 		strlen(peername) > 0 ? peername . "\n" : "")
ccdb4d
         try { # skip line in case of null pointers
ccdb4d
 	printf("        peercred pid: %d\n",
ccdb4d
-            @defined(@cast(sock, "socket")->sk->sk_peer_pid) ?
ccdb4d
-	    @cast(sock, "socket")->sk->sk_peer_pid->numbers[0]->nr :
ccdb4d
-	    @cast(sock, "socket")->sk->sk_peercred->pid ); } catch { }
ccdb4d
+            @defined(@cast(sock, "socket", "kernel")->sk->sk_peer_pid) ?
ccdb4d
+	    @cast(sock, "socket", "kernel")->sk->sk_peer_pid->numbers[0]->nr :
ccdb4d
+	    @cast(sock, "socket", "kernel")->sk->sk_peercred->pid ); } catch { }
ccdb4d
 }
ccdb4d
 
ccdb4d
 function print_ipv4_socket(sock) {
ccdb4d
diff --git a/testsuite/systemtap.examples/profiling/ioctl_handler.stp b/testsuite/systemtap.examples/profiling/ioctl_handler.stp
ccdb4d
index 7044185..6f1e52c 100755
ccdb4d
--- a/testsuite/systemtap.examples/profiling/ioctl_handler.stp
ccdb4d
+++ b/testsuite/systemtap.examples/profiling/ioctl_handler.stp
ccdb4d
@@ -9,7 +9,7 @@ probe syscall.ioctl {
ccdb4d
   ioctl_requests[execname()] <<< 1
ccdb4d
   try {
ccdb4d
     # Dig down through the task struct to find the actual function handling ioctl.
ccdb4d
-    ioctl_func_address = @cast(task_current(), "struct task_struct")->files->fdt->fd[fd]->f_op->unlocked_ioctl
ccdb4d
+    ioctl_func_address = @cast(task_current(), "struct task_struct", "kernel")->files->fdt->fd[fd]->f_op->unlocked_ioctl
ccdb4d
     if (ioctl_func_address)
ccdb4d
       ioctl_func[execname(), ioctl_func_address] <<< 1
ccdb4d
   } catch {
ccdb4d
ccdb4d
commit 3040d4e8ddb6a9b1d1a57a0185206498670c3f1a
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Wed Jun 17 13:53:58 2020 -0400
ccdb4d
ccdb4d
    Use explicit @cast() operators for stapgames/pingpong.stp tapset.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.examples/stapgames/tapset/gmtty.stp b/testsuite/systemtap.examples/stapgames/tapset/gmtty.stp
ccdb4d
index 026e4a9..f6ad2db 100644
ccdb4d
--- a/testsuite/systemtap.examples/stapgames/tapset/gmtty.stp
ccdb4d
+++ b/testsuite/systemtap.examples/stapgames/tapset/gmtty.stp
ccdb4d
@@ -10,12 +10,12 @@ global GM_tty_ws_row, GM_tty_ws_col, GM_tty_name
ccdb4d
 # Initialize current TTY -- must be called from begin
ccdb4d
 function game_tty_init:long ()
ccdb4d
 {
ccdb4d
-	tty = @cast(task_current(), "task_struct")->signal->tty
ccdb4d
+	tty = @cast(task_current(), "task_struct", "kernel")->signal->tty
ccdb4d
 	if (tty) {
ccdb4d
-		namep = @cast(tty,"tty_struct")->name
ccdb4d
+		namep = @cast(tty,"tty_struct", "kernel")->name
ccdb4d
 		GM_tty_name = kernel_string(namep)
ccdb4d
-		GM_tty_ws_col = @cast(tty, "tty_struct")->winsize->ws_col
ccdb4d
-		GM_tty_ws_row = @cast(tty, "tty_struct")->winsize->ws_row
ccdb4d
+		GM_tty_ws_col = @cast(tty, "tty_struct", "kernel")->winsize->ws_col
ccdb4d
+		GM_tty_ws_row = @cast(tty, "tty_struct", "kernel")->winsize->ws_row
ccdb4d
 	}
ccdb4d
 	return tty
ccdb4d
 }
ccdb4d
ccdb4d
commit 3d922919dbe5657becf48917f1c661bf6711e956
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Thu Jun 18 13:32:50 2020 -0400
ccdb4d
ccdb4d
    Use explicit @cast() operators for periodic.stp
ccdb4d
    
ccdb4d
    Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
ccdb4d
    operations work and they no longer default to using the kernel
ccdb4d
    debuginfo for type information.  Need to include kernel as location for
ccdb4d
    this information for the  @cast() rather than just assuming a default.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.examples/profiling/periodic.stp b/testsuite/systemtap.examples/profiling/periodic.stp
ccdb4d
index f18f183..b9052e5 100755
ccdb4d
--- a/testsuite/systemtap.examples/profiling/periodic.stp
ccdb4d
+++ b/testsuite/systemtap.examples/profiling/periodic.stp
ccdb4d
@@ -18,8 +18,8 @@ probe kernel.trace("timer_expire_entry")
ccdb4d
     period[$timer] <<< elapsed
ccdb4d
     funct[$timer] = $timer->function
ccdb4d
     data[$timer] = @defined($timer->data) ? $timer->data : 0
ccdb4d
-    proc_info[$timer] = @defined($timer->data) ? 0 : @container_of($timer, "struct process_timer", timer)->task
ccdb4d
-    delayed_work_info[$timer] = @defined($timer->data) ? 0 : & @container_of($timer, "struct delayed_work", timer)
ccdb4d
+    proc_info[$timer] = @defined($timer->data) ? 0 : @module_container_of($timer, "kernel", "struct process_timer", timer)->task
ccdb4d
+    delayed_work_info[$timer] = @defined($timer->data) ? 0 : & @module_container_of($timer, "kernel", "struct delayed_work", timer)
ccdb4d
   }
ccdb4d
   last_expire[$timer] = new_expire
ccdb4d
 }
ccdb4d
ccdb4d
commit b2d18cb3afca76536506fe4992fdd6ef091ce82f
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Thu Jun 18 15:01:40 2020 -0400
ccdb4d
ccdb4d
    Use explicit @cast() operators for semop-watch.stp example.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.examples/process/semop-watch.stp b/testsuite/systemtap.examples/process/semop-watch.stp
ccdb4d
index ca2bf0a..bf1d632 100755
ccdb4d
--- a/testsuite/systemtap.examples/process/semop-watch.stp
ccdb4d
+++ b/testsuite/systemtap.examples/process/semop-watch.stp
ccdb4d
@@ -3,7 +3,7 @@ global times;
ccdb4d
 
ccdb4d
 probe syscall.{semop,semtimedop}
ccdb4d
 {
ccdb4d
-  sembuf_sz = @cast_sizeof("struct sembuf");
ccdb4d
+  sembuf_sz = @cast_module_sizeof("kernel", "struct sembuf");
ccdb4d
   res = sprintf("set %d sems", semid)
ccdb4d
 
ccdb4d
   %( systemtap_v < "2.3" %? 
ccdb4d
@@ -14,7 +14,7 @@ probe syscall.{semop,semtimedop}
ccdb4d
   for(i = 0; i < nsops; i++) {
ccdb4d
     offset = i * sembuf_sz;
ccdb4d
     pointer = sops_uaddr + offset;
ccdb4d
-    num_addr = & @cast(pointer, "struct sembuf")->sem_num;
ccdb4d
+    num_addr = & @cast(pointer, "struct sembuf", "kernel")->sem_num;
ccdb4d
     num = user_short(num_addr);
ccdb4d
 
ccdb4d
     res = sprintf("%s %d", res, num);
ccdb4d
ccdb4d
commit a948c291c9cd7320d3c9b18b5037908cbbdf70b7
ccdb4d
Author: William Cohen <wcohen@redhat.com>
ccdb4d
Date:   Mon Jun 22 11:28:32 2020 -0400
ccdb4d
ccdb4d
    Use explicit @cast() operators pointing to kernel for tapsets
ccdb4d
    
ccdb4d
    Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
ccdb4d
    operations work and they no longer default to using the kernel
ccdb4d
    debuginfo for type information.  Need to include kernel as location for
ccdb4d
    this information for the  @cast() rather than just assuming a default.
ccdb4d
ea03ca
diff --git a/tapset/linux/dentry.stp b/tapset/linux/dentry.stp
ea03ca
index 4e73532..d148c57 100644
ea03ca
--- a/tapset/linux/dentry.stp
ea03ca
+++ b/tapset/linux/dentry.stp
ea03ca
@@ -28,7 +28,7 @@
ea03ca
 
ea03ca
 @__private30 function __dentry_IS_ROOT:long(dentry:long)
ea03ca
 {
ea03ca
-        return (@cast(dentry, "dentry")->d_parent == dentry)
ea03ca
+        return (@cast(dentry, "dentry", "kernel")->d_parent == dentry)
ea03ca
 }
ea03ca
 
ea03ca
 
ea03ca
@@ -61,7 +61,7 @@
ea03ca
  */
ea03ca
 function d_name:string(dentry:long)
ea03ca
 {
ea03ca
-        s = & @cast(dentry, "dentry")->d_name;
ea03ca
+        s = & @cast(dentry, "dentry", "kernel")->d_name;
ea03ca
         return kernel_string_n(s->name, s->len);
ea03ca
 }
ea03ca
 
ea03ca
@@ -70,8 +70,8 @@ function d_name:string(dentry:long)
ea03ca
 {
ea03ca
         /* i_dentry is an hlist_head on 3.6+, or a list_head before that.  */
ea03ca
         d_alias = @choose_defined(
ea03ca
-                        @cast(inode, "struct inode")->i_dentry->first,
ea03ca
-                        @cast(inode, "struct inode")->i_dentry->next)
ea03ca
+                        @cast(inode, "struct inode", "kernel")->i_dentry->first,
ea03ca
+                        @cast(inode, "struct inode", "kernel")->i_dentry->next)
ea03ca
 
ea03ca
 	if (@type_member_defined("struct dentry", d_alias)) {
ea03ca
         	return & @container_of(d_alias, "struct dentry", d_alias)
ea03ca
@@ -86,8 +86,8 @@ function d_name:string(dentry:long)
ea03ca
 {
ea03ca
         /* s_mounts was added in kernel 3.6, commit b3d9b7a3c.  */
ea03ca
         if (@type_member_defined("struct super_block", s_mounts)) {
ea03ca
-                mnt_ns = @cast(task_current(), "struct task_struct")->nsproxy->mnt_ns
ea03ca
-                sb = @cast(inode, "struct inode")->i_sb
ea03ca
+                mnt_ns = @cast(task_current(), "struct task_struct", "kernel<linux/sched.h>")->nsproxy->mnt_ns
ea03ca
+                sb = @cast(inode, "struct inode", "kernel")->i_sb
ea03ca
 
ea03ca
                 /* Look for the mount which matches the current namespace */
ea03ca
                 head = &sb->s_mounts
ea03ca
@@ -141,7 +141,7 @@ function reverse_path_walk:string(dentry:long)
ea03ca
 {
ea03ca
         while(1) {
ea03ca
                 name = __dentry_prepend(dentry, name);
ea03ca
-                dentry = @cast(dentry, "dentry")->d_parent;
ea03ca
+                dentry = @cast(dentry, "dentry", "kernel")->d_parent;
ea03ca
                 if (__dentry_IS_ROOT(dentry))
ea03ca
                         return name;
ea03ca
         }
ea03ca
@@ -209,8 +209,8 @@ function task_dentry_path:string(task:long,dentry:long,vfsmnt:long)
ea03ca
 	 * dentry == vfsmnt->mnt_root.  In that case, we'll just go
ea03ca
 	 * ahead and handle them normally.
ea03ca
 	 */
ea03ca
-	dentry = & @cast(dentry, "dentry")
ea03ca
-	vfsmnt = & @cast(vfsmnt, "vfsmount")
ea03ca
+	dentry = & @cast(dentry, "dentry", "kernel")
ea03ca
+	vfsmnt = & @cast(vfsmnt, "vfsmount", "kernel")
ea03ca
 
ea03ca
 	if (@type_member_defined("dentry", d_op->d_dname)
ea03ca
 	    && dentry->d_op && dentry->d_op->d_dname
ea03ca
@@ -230,7 +230,7 @@ function task_dentry_path:string(task:long,dentry:long,vfsmnt:long)
ea03ca
 			return sprintf("ANON_INODE:%s", d_name(dentry))
ea03ca
 		}
ea03ca
 		else if (vfsmnt->mnt_sb->s_magic == @const("NSFS_MAGIC")) {
ea03ca
-			ns_ops = &@cast(dentry->d_fsdata, "proc_ns_operations")
ea03ca
+			ns_ops = &@cast(dentry->d_fsdata, "proc_ns_operations", "kernel")
ea03ca
 			return sprintf("%s:[%lu]", kernel_string(ns_ops->name),
ea03ca
 				       dentry->d_inode->i_ino)
ea03ca
 		}
ea03ca
@@ -239,16 +239,16 @@ function task_dentry_path:string(task:long,dentry:long,vfsmnt:long)
ea03ca
 
ea03ca
 	# Handle old-school vs. new-school fs_structs.
ea03ca
 	if (@type_member_defined("fs_struct", rootmnt)) {
ea03ca
-		root_dentry = & @cast(task, "task_struct")->fs->root
ea03ca
-		root_vfsmnt = & @cast(task, "task_struct")->fs->rootmnt
ea03ca
+		root_dentry = & @cast(task, "task_struct", "kernel")->fs->root
ea03ca
+		root_vfsmnt = & @cast(task, "task_struct", "kernel")->fs->rootmnt
ea03ca
 	}
ea03ca
 	else {
ea03ca
-		root_dentry = @cast(task, "task_struct")->fs->root->dentry
ea03ca
-		root_vfsmnt = @cast(task, "task_struct")->fs->root->mnt
ea03ca
+		root_dentry = @cast(task, "task_struct", "kernel")->fs->root->dentry
ea03ca
+		root_vfsmnt = @cast(task, "task_struct", "kernel")->fs->root->mnt
ea03ca
 	}
ea03ca
 
ea03ca
 	if (@type_member_defined("mount", mnt_parent)) {
ea03ca
-		mnt = &@cast(real_mount(vfsmnt), "mount")
ea03ca
+		mnt = &@cast(real_mount(vfsmnt), "mount", "kernel")
ea03ca
 		if (mnt == 0)
ea03ca
 			return "<unknown>"
ea03ca
 	}
ea03ca
@@ -305,10 +305,10 @@ function task_dentry_path:string(task:long,dentry:long,vfsmnt:long)
ea03ca
  */
ea03ca
 function d_path:string(nd:long)
ea03ca
 {
ea03ca
-	dentry = @choose_defined(@cast(nd,"nameidata")->path->dentry,
ea03ca
-			         @cast(nd,"nameidata")->dentry)
ea03ca
-	vfsmnt = @choose_defined(@cast(nd,"nameidata")->path->mnt,
ea03ca
-			         @cast(nd,"nameidata")->mnt)
ea03ca
+	dentry = @choose_defined(@cast(nd,"nameidata", "kernel")->path->dentry,
ea03ca
+			         @cast(nd,"nameidata", "kernel")->dentry)
ea03ca
+	vfsmnt = @choose_defined(@cast(nd,"nameidata", "kernel")->path->mnt,
ea03ca
+			         @cast(nd,"nameidata", "kernel")->mnt)
ea03ca
 
ea03ca
 	return sprintf("%s/", task_dentry_path(task_current(), dentry, vfsmnt))
ea03ca
 }
ea03ca
@@ -353,8 +353,8 @@ function fullpath_struct_path:string(path:long)
ea03ca
 function fullpath_struct_file:string(task:long, file:long)
ea03ca
 {
ea03ca
   return task_dentry_path(task,
ea03ca
-			  @choose_defined(@cast(file, "file")->f_path->dentry,
ea03ca
-					  @cast(file, "file")->f_dentry),
ea03ca
-			  @choose_defined(@cast(file, "file")->f_path->mnt,
ea03ca
-					  @cast(file, "file")->f_vfsmnt))
ea03ca
+			  @choose_defined(@cast(file, "file", "kernel")->f_path->dentry,
ea03ca
+					  @cast(file, "file", "kernel")->f_dentry),
ea03ca
+			  @choose_defined(@cast(file, "file", "kernel")->f_path->mnt,
ea03ca
+					  @cast(file, "file", "kernel")->f_vfsmnt))
ea03ca
 }
ea03ca
diff --git a/tapset/linux/dev.stp b/tapset/linux/dev.stp
ea03ca
index 0232fc9..079ce1c 100644
ea03ca
--- a/tapset/linux/dev.stp
ea03ca
+++ b/tapset/linux/dev.stp
ea03ca
@@ -56,8 +56,8 @@ function usrdev2kerndev:long(dev:long)
ea03ca
 function disk_name:string(hd:long, partno:long)
ea03ca
 {
ea03ca
 	if (!partno)
ea03ca
-		return kernel_string(@cast(hd, "gendisk")->disk_name)
ea03ca
-	disk_name = kernel_string(@cast(hd, "gendisk")->disk_name)
ea03ca
+		return kernel_string(@cast(hd, "gendisk", "kernel")->disk_name)
ea03ca
+	disk_name = kernel_string(@cast(hd, "gendisk", "kernel")->disk_name)
ea03ca
 	if (isdigit(substr(disk_name, strlen(disk_name)-1, 1)))
ea03ca
 		return sprintf("%sp%d", disk_name, partno)
ea03ca
 	else
ea03ca
@@ -66,7 +66,7 @@ function disk_name:string(hd:long, partno:long)
ea03ca
 
ea03ca
 function bdevname:string(bdev:long)
ea03ca
 {
ea03ca
-	bdev = & @cast(bdev, "block_device")
ea03ca
+	bdev = & @cast(bdev, "block_device", "kernel")
ea03ca
 	if (bdev == 0)
ea03ca
 		return "N/A"
ea03ca
 
ea03ca
diff --git a/tapset/linux/ioblock.stp b/tapset/linux/ioblock.stp
ea03ca
index ad3603c..9d8f57b 100644
ea03ca
--- a/tapset/linux/ioblock.stp
ea03ca
+++ b/tapset/linux/ioblock.stp
ea03ca
@@ -107,12 +107,12 @@ function bio_rw_str(rw:long)
ea03ca
 @__private30 function __bio_start_sect:long(bio:long)
ea03ca
 {
ea03ca
     try {
ea03ca
-	if (@defined(@cast(bio, "bio")->bi_dev)) {
ea03ca
-	    return @cast(bio, "bio")->bi_bdev->bd_part->start_sect
ea03ca
+	if (@defined(@cast(bio, "bio", "kernel")->bi_dev)) {
ea03ca
+	    return @cast(bio, "bio", "kernel")->bi_bdev->bd_part->start_sect
ea03ca
 	}
ea03ca
-	else if (@defined(@cast(bio, "bio")->bi_disk)) {
ea03ca
- 	    return disk_get_part_start_sect(@cast(bio, "bio")->bi_disk,
ea03ca
-					    @cast(bio, "bio")->bi_partno)
ea03ca
+	else if (@defined(@cast(bio, "bio", "kernel")->bi_disk)) {
ea03ca
+	    return disk_get_part_start_sect(@cast(bio, "bio", "kernel")->bi_disk,
ea03ca
+					    @cast(bio, "bio", "kernel")->bi_partno)
ea03ca
 	}
ea03ca
     } catch {
ea03ca
         return -1
ea03ca
@@ -122,12 +122,12 @@ function bio_rw_str(rw:long)
ea03ca
 /* returns the block device name */
ea03ca
 @__private30 function __bio_devname:string(bio:long)
ea03ca
 {
ea03ca
-    if (@defined(@cast(bio, "bio")->bi_bdev)) {
ea03ca
-	return bdevname(@cast(bio, "bio")->bi_bdev)
ea03ca
+    if (@defined(@cast(bio, "bio", "kernel")->bi_bdev)) {
ea03ca
+	return bdevname(@cast(bio, "bio", "kernel")->bi_bdev)
ea03ca
     }
ea03ca
     else {
ea03ca
-	return disk_name(@cast(bio, "bio")->bi_disk,
ea03ca
-			 @cast(bio, "bio")->bi_partno)
ea03ca
+	return disk_name(@cast(bio, "bio", "kernel")->bi_disk,
ea03ca
+			 @cast(bio, "bio", "kernel")->bi_partno)
ea03ca
     }
ea03ca
 }
ea03ca
 
ccdb4d
diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp
ccdb4d
index 4afc458..b542b61 100644
ccdb4d
--- a/tapset/linux/task.stp
ccdb4d
+++ b/tapset/linux/task.stp
ccdb4d
@@ -40,7 +40,7 @@ function task_current:long () {
ccdb4d
         return -1;
ccdb4d
     }
ccdb4d
     sig = @task(task)->signal;
ccdb4d
-    return @cast(sig, "signal_struct")->rlim[nd_limit]->rlim_cur;
ccdb4d
+    return @cast(sig, "signal_struct", "kernel")->rlim[nd_limit]->rlim_cur;
ea03ca
 }
ea03ca
 
ccdb4d
 /* sfunction task_rlimit - The current resource limit of the task
ccdb4d
ccdb4d
commit 403e927796c3008ad5d5fed9bd97dc7cbad424bb
ccdb4d
Author: Martin Cermak <mcermak@redhat.com>
ccdb4d
Date:   Mon Jun 29 16:30:34 2020 +0200
ccdb4d
ccdb4d
    PR26181: Use explicit @cast() within get_ip_from_client()
ccdb4d
    
ccdb4d
    Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
ccdb4d
    operations work and they no longer default to using the kernel
ccdb4d
    debuginfo for type information.  Need to include kernel as location for
ccdb4d
    this information for the  @cast() rather than just assuming a default.
ccdb4d
    
ccdb4d
    Also, fix the type of server_ip, which historically had been a long,
ccdb4d
    but since systemtap_v >= "4.3", it is a string.
ccdb4d
ea03ca
diff --git a/tapset/linux/nfs_proc.stp b/tapset/linux/nfs_proc.stp
ea03ca
index 8da3f6b..2579074 100644
ea03ca
--- a/tapset/linux/nfs_proc.stp
ea03ca
+++ b/tapset/linux/nfs_proc.stp
ea03ca
@@ -77,11 +77,11 @@ function get_ip_from_client:string(clnt:long)
ea03ca
 	 * inside that buffer. */
ea03ca
 	if (@cast(addr, "sockaddr")->sa_family
ea03ca
 		== @const("AF_INET")) {
ea03ca
-		return format_ipaddr(&@cast(addr, "sockaddr_in")->sin_addr->s_addr, @const("AF_INET"))
ea03ca
+		return format_ipaddr(&@cast(addr, "sockaddr_in", "kernel:sunrpc")->sin_addr->s_addr, @const("AF_INET"))
ea03ca
 	}
ea03ca
 	else if (@cast(addr, "sockaddr")->sa_family 
ea03ca
 		== @const("AF_INET6"))  {
ea03ca
-		return format_ipaddr(&@cast(addr, "sockaddr_in6")->sin6_addr, @const("AF_INET6"))
ea03ca
+		return format_ipaddr(&@cast(addr, "sockaddr_in6", "kernel:sunrpc")->sin6_addr, @const("AF_INET6"))
ea03ca
 	}
ea03ca
 	return ""	
ea03ca
 }
ea03ca
@@ -90,12 +90,12 @@ function get_ip_from_client:long(clnt:long)
ea03ca
 {
ea03ca
 	cl_xprt = @cast(clnt, "rpc_clnt", "kernel:sunrpc")->cl_xprt
ea03ca
         addr = &@cast(cl_xprt, "rpc_xprt", "kernel:sunrpc")->addr
ea03ca
-	if (@cast(addr, "sockaddr_in")->sin_family
ea03ca
+	if (@cast(addr, "sockaddr_in", "kernel:sunrpc")->sin_family
ea03ca
 		!= @const("AF_INET")) {
ea03ca
                /* Now consider ipv4 only */
ea03ca
                return 0
ea03ca
 	}
ea03ca
-	return @cast(addr, "sockaddr_in")->sin_addr->s_addr
ea03ca
+	return @cast(addr, "sockaddr_in", "kernel:sunrpc")->sin_addr->s_addr
ea03ca
 }
ea03ca
 %)
ea03ca
 
ea03ca
@@ -758,7 +758,11 @@ probe _nfs.proc2.missing_read_setup = never
ea03ca
 {
ea03ca
 	inode = 0
ea03ca
 	client = 0
ea03ca
+%( systemtap_v >= "4.3" %?
ea03ca
+	server_ip = "0"
ea03ca
+%:
ea03ca
 	server_ip = 0
ea03ca
+%)
ea03ca
 	prot = 0
ea03ca
 
ea03ca
 	count = 0
ccdb4d
ccdb4d
commit f1a9bb064d11319a7eca4f4233c9edcc4a03af7e
ccdb4d
Author: Martin Cermak <mcermak@redhat.com>
ccdb4d
Date:   Thu Jul 9 09:19:01 2020 +0200
ccdb4d
ccdb4d
    Tapset and testsuite updates against @cast() change 00ee19ff03
ccdb4d
    
ccdb4d
    Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
ccdb4d
    operations work and they no longer default to using the kernel
ccdb4d
    debuginfo for type information.  Need to include kernel as location for
ccdb4d
    this information for the  @cast() rather than just assuming a default.
ccdb4d
    
ccdb4d
    These are respective tapset and testsuite minor updates.
ccdb4d
ccdb4d
diff --git a/tapset/linux/networking.stp b/tapset/linux/networking.stp
ccdb4d
index 69843a7..0b52cbc 100644
ccdb4d
--- a/tapset/linux/networking.stp
ccdb4d
+++ b/tapset/linux/networking.stp
ccdb4d
@@ -69,7 +69,7 @@
ccdb4d
 
ccdb4d
 /* A function that returns the device name given the net_device struct */
ccdb4d
 function get_netdev_name:string (addr:long) {
ccdb4d
-	return kernel_string(@cast(addr, "net_device")->name)
ccdb4d
+	return kernel_string(@cast(addr, "net_device", "kernel")->name)
ccdb4d
 }
ccdb4d
 
ccdb4d
 /**
ea03ca
diff --git a/tapset/linux/scsi.stp b/tapset/linux/scsi.stp
ea03ca
index 3577942..5359fe8 100644
ea03ca
--- a/tapset/linux/scsi.stp
ea03ca
+++ b/tapset/linux/scsi.stp
ea03ca
@@ -179,8 +179,8 @@ probe scsi.iocompleted
ea03ca
 
ea03ca
 function timer_pending:long(timer:long)
ea03ca
 {
ea03ca
-	return (@choose_defined(@cast(timer, "timer_list")->entry->next,
ea03ca
-				@cast(timer, "timer_list")->base) != 0)
ea03ca
+	return (@choose_defined(@cast(timer, "timer_list", "kernel")->entry->next,
ea03ca
+				@cast(timer, "timer_list", "kernel")->base) != 0)
ea03ca
 }
ea03ca
 
ea03ca
 function scsi_timer_pending:long(cmd:long)
ea03ca
diff --git a/testsuite/buildok/pretty.stp b/testsuite/buildok/pretty.stp
ea03ca
index 85c9cd9..a2fc781 100755
ea03ca
--- a/testsuite/buildok/pretty.stp
ea03ca
+++ b/testsuite/buildok/pretty.stp
ea03ca
@@ -6,14 +6,14 @@ global i = 1
ea03ca
 # pretty-printing with @cast
ea03ca
 probe begin {
ea03ca
     t = task_current()
ea03ca
-    log(@cast(t, "task_struct")->fs$)
ea03ca
-    log(@cast(t, "task_struct")->fs$$)
ea03ca
-    log(@cast(t, "task_struct")->comm$)
ea03ca
-    log(@cast(t, "task_struct")->comm$$)
ea03ca
-    log(@cast(t, "task_struct")->comm[0]$)
ea03ca
-    log(@cast(t, "task_struct")->comm[0]$$)
ea03ca
-    log(@cast(t, "task_struct")->comm[i]$)
ea03ca
-    log(@cast(t, "task_struct")->comm[i]$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->fs$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->fs$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[0]$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[0]$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[i]$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[i]$$)
ea03ca
 }
ea03ca
 
ea03ca
 # pretty-printing in dwarf kernel context
ea03ca
diff --git a/testsuite/semok/cast.stp b/testsuite/semok/cast.stp
ea03ca
index d72763c..fe78e36 100755
ea03ca
--- a/testsuite/semok/cast.stp
ea03ca
+++ b/testsuite/semok/cast.stp
ea03ca
@@ -2,7 +2,7 @@
ea03ca
 
ea03ca
 probe begin {
ea03ca
     // basic @cast test, with and without specifying kernel
ea03ca
-    println(@cast(0, "task_struct")->tgid)
ea03ca
+    println(@cast(0, "task_struct", "kernel")->tgid)
ea03ca
     println(@cast(0, "task_struct", "kernel")->tgid)
ea03ca
 
ea03ca
     // check module-search paths
ea03ca
@@ -25,5 +25,5 @@ probe begin {
ea03ca
     @cast(0, "task_struct", "no_such_module")->tgid
ea03ca
 
ea03ca
     // PR11556: we should be able to treat the initial pointer like an array too
ea03ca
-    println(@cast(0, "task_struct")[42]->tgid)
ea03ca
+    println(@cast(0, "task_struct", "kernel")[42]->tgid)
ea03ca
 }
ea03ca
diff --git a/testsuite/semok/pretty.stp b/testsuite/semok/pretty.stp
ea03ca
index 0211d86..25490e7 100755
ea03ca
--- a/testsuite/semok/pretty.stp
ea03ca
+++ b/testsuite/semok/pretty.stp
ea03ca
@@ -12,16 +12,16 @@ global i = 1
ea03ca
 # pretty-printing with @cast
ea03ca
 probe begin {
ea03ca
     t = task_current()
ea03ca
-    log(@cast(t, "task_struct")$)
ea03ca
-    log(@cast(t, "task_struct")$$)
ea03ca
-    log(@cast(t, "task_struct")->fs$)
ea03ca
-    log(@cast(t, "task_struct")->fs$$)
ea03ca
-    log(@cast(t, "task_struct")->comm$)
ea03ca
-    log(@cast(t, "task_struct")->comm$$)
ea03ca
-    log(@cast(t, "task_struct")->comm[0]$)
ea03ca
-    log(@cast(t, "task_struct")->comm[0]$$)
ea03ca
-    log(@cast(t, "task_struct")->comm[i]$)
ea03ca
-    log(@cast(t, "task_struct")->comm[i]$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->fs$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->fs$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[0]$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[0]$$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[i]$)
ea03ca
+    log(@cast(t, "task_struct", "kernel")->comm[i]$$)
ea03ca
 }
ea03ca
 
ea03ca
 # pretty-printing in dwarf kernel context
ea03ca
diff --git a/testsuite/semok/sizeof.stp b/testsuite/semok/sizeof.stp
ea03ca
index 8e35e29..a5a6bbb 100755
ea03ca
--- a/testsuite/semok/sizeof.stp
ea03ca
+++ b/testsuite/semok/sizeof.stp
ea03ca
@@ -1,7 +1,7 @@
ea03ca
 #! stap -p2
ea03ca
 
ea03ca
 probe begin {
ea03ca
-    println("task_struct: ", @cast_sizeof("task_struct"))
ea03ca
+    # println("task_struct: ", @cast_sizeof("task_struct"))
ea03ca
     println("task_struct: ", @cast_module_sizeof("kernel", "task_struct"))
ea03ca
     println("task_struct: ", @cast_module_sizeof("kernel<linux/sched.h>", "task_struct"))
ea03ca
     println("FILE: ", @cast_module_sizeof("<stdio.h>", "FILE"))
ea03ca
diff --git a/testsuite/semok/thirtyeight.stp b/testsuite/semok/thirtyeight.stp
ea03ca
index 15189b7..5018795 100755
ea03ca
--- a/testsuite/semok/thirtyeight.stp
ea03ca
+++ b/testsuite/semok/thirtyeight.stp
ea03ca
@@ -7,4 +7,4 @@
ea03ca
 probe kernel.function("do_sys_open") { println(@defined($mode) ? 1 : $nosuchvar) }
ea03ca
 probe kernel.trace("sched_switch")? { println(@defined($next->pid) ? 1 : $nosuchvar) }
ea03ca
 probe procfs.write { println(@defined($value) ? 1 : $nosuchvar) }
ea03ca
-probe begin { println(@defined(@cast(0, "task_struct")->pid) ? 1 : $nosuchvar) }
ea03ca
+probe begin { println(@defined(@cast(0, "task_struct", "kernel")->pid) ? 1 : $nosuchvar) }
ea03ca
diff --git a/testsuite/semok/thirtysix.stp b/testsuite/semok/thirtysix.stp
ea03ca
index 14f10c1..0adae14 100755
ea03ca
--- a/testsuite/semok/thirtysix.stp
ea03ca
+++ b/testsuite/semok/thirtysix.stp
ea03ca
@@ -17,17 +17,17 @@ probe begin,end,error,never { println(@defined($nosuchvar)?$nosuchvar:0) } # inv
ea03ca
 probe timer.s(1),timer.jiffies(1) { println(@defined($nosuchvar)?$nosuchvar:0) } # invalid
ea03ca
 probe timer.profile { println(@defined($nosuchvar)?$nosuchvar:0) } # invalid
ea03ca
 
ea03ca
-probe begin { println(@defined(@cast(0, "task_struct")->foo)?$nosuchvar:0) } # invalid
ea03ca
-probe begin { println(@defined(@cast(0, "task_struct")->pid)?1:$nosuchvar) } # valid
ea03ca
-probe kernel.function("do_sys_open") { println(@defined(@cast(0, "task_struct")->foo)?$nosuchvar:0) } # invalid
ea03ca
-probe kernel.function("do_sys_open") { println(@defined(@cast(0, "task_struct")->pid)?1:$nosuchvar) } # valid
ea03ca
+probe begin { println(@defined(@cast(0, "task_struct", "kernel")->foo)?$nosuchvar:0) } # invalid
ea03ca
+probe begin { println(@defined(@cast(0, "task_struct", "kernel")->pid)?1:$nosuchvar) } # valid
ea03ca
+probe kernel.function("do_sys_open") { println(@defined(@cast(0, "task_struct", "kernel")->foo)?$nosuchvar:0) } # invalid
ea03ca
+probe kernel.function("do_sys_open") { println(@defined(@cast(0, "task_struct", "kernel")->pid)?1:$nosuchvar) } # valid
ea03ca
 
ea03ca
-function foo1() { println(@defined(@cast(0, "task_struct")->foo)?$nosuchvar:0) } # invalid
ea03ca
-function foo2() { println(@defined(@cast(0, "task_struct")->pid)?1:$nosuchvar) } # valid
ea03ca
+function foo1() { println(@defined(@cast(0, "task_struct", "kernel")->foo)?$nosuchvar:0) } # invalid
ea03ca
+function foo2() { println(@defined(@cast(0, "task_struct", "kernel")->pid)?1:$nosuchvar) } # valid
ea03ca
 probe begin { foo1(); foo2(); }
ea03ca
 
ea03ca
 # PR11598: support @defined(&...)
ea03ca
-probe begin { println(@defined(@cast(0, "task_struct")->rcu)?$nosuchvar:0) } # invalid
ea03ca
-probe begin { println(@defined(&@cast(0, "task_struct")->rcu)?1:$nosuchvar) } # valid
ea03ca
+probe begin { println(@defined(@cast(0, "task_struct", "kernel")->rcu)?$nosuchvar:0) } # invalid
ea03ca
+probe begin { println(@defined(&@cast(0, "task_struct", "kernel")->rcu)?1:$nosuchvar) } # valid
ea03ca
 probe kernel.function("release_task") { println(@defined($p->rcu)?$nosuchvar:0) } # invalid
ea03ca
 probe kernel.function("release_task") { println(@defined(&$p->rcu)?1:$nosuchvar) } # valid
ea03ca
diff --git a/testsuite/systemtap.base/bitfield.stp b/testsuite/systemtap.base/bitfield.stp
ea03ca
index 0208108..b5f7b89 100644
ea03ca
--- a/testsuite/systemtap.base/bitfield.stp
ea03ca
+++ b/testsuite/systemtap.base/bitfield.stp
ea03ca
@@ -11,8 +11,8 @@ function check:long(ack:long, urg:long) {
ea03ca
   ptr = get_ptr()
ea03ca
 
ea03ca
   /* set the bits with cast */
ea03ca
-  @cast(ptr, "tcphdr")->ack = ack
ea03ca
-  @cast(ptr, "tcphdr")->urg = urg
ea03ca
+  @cast(ptr, "tcphdr", "kernel")->ack = ack
ea03ca
+  @cast(ptr, "tcphdr", "kernel")->urg = urg
ea03ca
 
ea03ca
   /* check that reading with embedded-C is ok */
ea03ca
   real_ack = get_ack()
ea03ca
@@ -20,8 +20,8 @@ function check:long(ack:long, urg:long) {
ea03ca
   errors = (ack != real_ack) + (urg != real_urg)
ea03ca
 
ea03ca
   /* check that reading with a cast is ok */
ea03ca
-  cast_ack = @cast(ptr, "tcphdr")->ack
ea03ca
-  cast_urg = @cast(ptr, "tcphdr")->urg
ea03ca
+  cast_ack = @cast(ptr, "tcphdr", "kernel")->ack
ea03ca
+  cast_urg = @cast(ptr, "tcphdr", "kernel")->urg
ea03ca
   errors += (ack != cast_ack) + (urg != cast_urg)
ea03ca
 
ea03ca
   if (errors)
ea03ca
diff --git a/testsuite/systemtap.base/target_set.stp b/testsuite/systemtap.base/target_set.stp
ea03ca
index ad4dca6..7c458cb 100644
ea03ca
--- a/testsuite/systemtap.base/target_set.stp
ea03ca
+++ b/testsuite/systemtap.base/target_set.stp
ea03ca
@@ -19,13 +19,13 @@ probe begin
ea03ca
 probe syscall.nanosleep
ea03ca
 {
ea03ca
     if (target_set_pid(pid())
ea03ca
-	&& user_long(&@cast(req_uaddr, "struct timespec")->tv_sec) == $1)
ea03ca
+	&& user_long(&@cast(req_uaddr, "struct timespec", "kernel")->tv_sec) == $1)
ea03ca
 	target_set_report()
ea03ca
 }
ea03ca
 probe syscall.compat_nanosleep ?
ea03ca
 {
ea03ca
     if (target_set_pid(pid())
ea03ca
-	&& user_long(&@cast(req_uaddr, "struct compat_timespec")->tv_sec) == $1)
ea03ca
+	&& user_long(&@cast(req_uaddr, "struct compat_timespec", "kernel")->tv_sec) == $1)
ea03ca
 	target_set_report()
ea03ca
 }
ea03ca
 
ea03ca
diff --git a/testsuite/systemtap.context/usymbols.exp b/testsuite/systemtap.context/usymbols.exp
ea03ca
index f53c1cd..e12f067 100644
ea03ca
--- a/testsuite/systemtap.context/usymbols.exp
ea03ca
+++ b/testsuite/systemtap.context/usymbols.exp
ea03ca
@@ -20,7 +20,7 @@ set testscript {
ea03ca
     probe syscall.rt_sigaction {
ea03ca
       if (pid() == target() && execname() == "%s") {
ea03ca
 	// Note user address.
ea03ca
-	handler = user_long(&@cast(act_uaddr, "struct sigaction")->sa_handler);
ea03ca
+	handler = user_long(&@cast(act_uaddr, "struct sigaction", "kernel")->sa_handler);
ea03ca
 	try {
ea03ca
 		printf("handler: %%s (%%s)\n", usymname(handler), umodname(handler));
ea03ca
 	} catch {
ea03ca
@@ -31,9 +31,9 @@ set testscript {
ea03ca
     probe syscall.rt_sigaction32 ? {
ea03ca
       if (pid() == target() && execname() == "%s") {
ea03ca
 	// Note user address.
ea03ca
-	handler = user_long(@defined(@cast(0, "compat_sigaction")->sa_handler)
ea03ca
-			    ? &@cast(act_uaddr, "compat_sigaction")->sa_handler
ea03ca
-			    : &@cast(act_uaddr, "sigaction32")->sa_handler);
ea03ca
+	handler = user_long(@defined(@cast(0, "compat_sigaction", "kernel")->sa_handler)
ea03ca
+			    ? &@cast(act_uaddr, "compat_sigaction", "kernel")->sa_handler
ea03ca
+			    : &@cast(act_uaddr, "sigaction32", "kernel")->sa_handler);
ea03ca
 	try {
ea03ca
 		printf("handler: %%s (%%s)\n", usymname(handler), umodname(handler));
ea03ca
 	} catch {
ccdb4d
ccdb4d
commit c6831f14e043f88096b2219828c0124cf2549b77
ccdb4d
Author: Frank Ch. Eigler <fche@redhat.com>
ccdb4d
Date:   Thu Jul 9 21:41:51 2020 -0400
ccdb4d
ccdb4d
    testuite: More @cast() fallout
ccdb4d
    
ccdb4d
    Adjust another test case that uses the deprecated
ccdb4d
    
ccdb4d
       probe begin { @cast(PTR, "type") }
ccdb4d
    
ccdb4d
    construct.  Now "kernel" is formally required to specify context.
ccdb4d
ccdb4d
diff --git a/testsuite/systemtap.base/cast.stp b/testsuite/systemtap.base/cast.stp
ccdb4d
index cc44a36..0e191eb 100644
ccdb4d
--- a/testsuite/systemtap.base/cast.stp
ccdb4d
+++ b/testsuite/systemtap.base/cast.stp
ccdb4d
@@ -4,7 +4,7 @@ probe begin
ccdb4d
 
ccdb4d
     // Compare PIDs
ccdb4d
     pid = pid()
ccdb4d
-    cast_pid = @cast(curr, "task_struct")->tgid
ccdb4d
+    cast_pid = @cast(curr, "task_struct", "kernel")->tgid
ccdb4d
     if (pid == cast_pid)
ccdb4d
         println("PID OK")
ccdb4d
     else
ccdb4d
@@ -18,7 +18,7 @@ probe begin
ccdb4d
         printf("PID2 %d != %d\n", pid, cast_pid)
ccdb4d
 
ccdb4d
     // Compare PIDs with an array access (PR11556)
ccdb4d
-    cast_pid = @cast(curr, "task_struct")[0]->tgid
ccdb4d
+    cast_pid = @cast(curr, "task_struct", "kernel")[0]->tgid
ccdb4d
     if (pid == cast_pid)
ccdb4d
         println("PID3 OK")
ccdb4d
     else
ccdb4d
@@ -26,16 +26,16 @@ probe begin
ccdb4d
 
ccdb4d
     // Compare execnames
ccdb4d
     name = execname()
ccdb4d
-    cast_name = kernel_string(@cast(curr, "task_struct")->comm)
ccdb4d
+    cast_name = kernel_string(@cast(curr, "task_struct", "kernel")->comm)
ccdb4d
     if (name == cast_name)
ccdb4d
         println("execname OK")
ccdb4d
     else
ccdb4d
         printf("execname \"%s\" != \"%s\"\n", name, cast_name)
ccdb4d
 
ccdb4d
     // Compare usage counter values through a struct address
ccdb4d
-    usage = @cast(curr, "task_struct")->usage->counter
ccdb4d
-    pusage = & @cast(curr, "task_struct")->usage
ccdb4d
-    cast_usage = @cast(pusage, "atomic_t")->counter
ccdb4d
+    usage = @cast(curr, "task_struct", "kernel")->usage->counter
ccdb4d
+    pusage = & @cast(curr, "task_struct", "kernel")->usage
ccdb4d
+    cast_usage = @cast(pusage, "atomic_t", "kernel")->counter
ccdb4d
     if (usage == cast_usage)
ccdb4d
         println("usage OK")
ccdb4d
     else