Compare commits

...

7 Commits

Author SHA1 Message Date
eabdullin 2b832edeae import UBI systemtap-4.9-3.el8 2023-11-15 03:37:00 +00:00
CentOS Sources c7ff69c7ad import systemtap-4.8-2.el8 2023-05-16 06:51:36 +00:00
CentOS Sources 3d77a87b64 import systemtap-4.7-1.el8 2022-11-08 06:32:12 +00:00
CentOS Sources 4a3d447181 import systemtap-4.6-4.el8 2022-05-10 07:11:15 +00:00
CentOS Sources 152aad4738 import systemtap-4.5-3.el8 2021-12-04 06:58:40 +00:00
CentOS Sources cc1030d5d1 import systemtap-4.4-11.el8_4 2021-09-10 05:04:36 +00:00
CentOS Sources 6e6dafb7c9 import systemtap-4.4-10.el8 2021-09-10 05:04:33 +00:00
10 changed files with 2285 additions and 2608 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/systemtap-4.3.tar.gz
SOURCES/systemtap-4.9.tar.gz

View File

@ -1 +1 @@
14769266f6591b85895a5f40e516f8228e83476e SOURCES/systemtap-4.3.tar.gz
7ba2ad579a5ba66ccfd36ad6df0896c9e136f9e9 SOURCES/systemtap-4.9.tar.gz

1845
SOURCES/pr29108.patch Normal file

File diff suppressed because it is too large Load Diff

99
SOURCES/pr30749.patch Normal file
View File

@ -0,0 +1,99 @@
commit 9839db5514a29cf4f58b3de8cc6155088be6d061
gpg: Signature made Sat 12 Aug 2023 02:49:26 PM EDT
gpg: using RSA key 5D38116FA4D3A7CC77E378D37E83610126DCC2E8
gpg: Good signature from "Frank Ch. Eigler <fche@elastic.org>" [full]
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Sat Aug 12 14:28:44 2023 -0400
PR30749: correct stap --sign-module timing
Previous code signed the temp directory copy, after it had already
been copied into the cache -- so the signature never made it to a
permanent artifact.
If the module was being fetched from the cache from a previous build
run, a sign (re)attempt will still be done. This may not be
necessary, but shouldn't be harmful.
Reported-By: Renaud Métrich <rmetrich@redhat.com>
diff --git a/main.cxx b/main.cxx
index 06adb66ad..9f695cbd8 100644
--- a/main.cxx
+++ b/main.cxx
@@ -1190,8 +1190,10 @@ passes_0_4 (systemtap_session &s)
s.mok_fingerprints.clear();
s.mok_fingerprints.push_back(mok_fingerprint);
}
- rc =
- sign_module (s.tmpdir, s.module_filename(), s.mok_fingerprints, mok_path, s.kernel_build_tree);
+ if (s.verbose)
+ clog << _F("Signing %s with mok key %s", s.module_filename().c_str(), mok_path.c_str())
+ << endl;
+ rc = sign_module (s.tmpdir, s.module_filename(), s.mok_fingerprints, mok_path, s.kernel_build_tree);
}
#endif
@@ -1310,8 +1312,30 @@ passes_0_4 (systemtap_session &s)
if (! s.use_script_cache && s.last_pass <= 4)
s.save_module = true;
+#if HAVE_NSS
+ // PR30749
+ if (!rc && s.module_sign_given)
+ {
+ // when run on client as --sign-module, mok fingerprints are result of mokutil -l
+ // when run from server as --sign-module=PATH, mok fingerprint is given by PATH
+ string mok_path;
+ if (!s.module_sign_mok_path.empty())
+ {
+ string mok_fingerprint;
+ split_path (s.module_sign_mok_path, mok_path, mok_fingerprint);
+ s.mok_fingerprints.clear();
+ s.mok_fingerprints.push_back(mok_fingerprint);
+ }
+
+ if (s.verbose)
+ clog << _F("Signing %s with mok key %s", s.module_filename().c_str(), mok_path.c_str())
+ << endl;
+ rc = sign_module (s.tmpdir, s.module_filename(), s.mok_fingerprints, mok_path, s.kernel_build_tree);
+ }
+#endif
+
// Copy module to the current directory.
- if (s.save_module && !pending_interrupts)
+ if (!rc && s.save_module && !pending_interrupts)
{
string module_src_path = s.tmpdir + "/" + s.module_filename();
string module_dest_path = s.module_filename();
@@ -1327,29 +1351,11 @@ passes_0_4 (systemtap_session &s)
}
}
-#if HAVE_NSS
- if (s.module_sign_given)
- {
- // when run on client as --sign-module, mok fingerprints are result of mokutil -l
- // when run from server as --sign-module=PATH, mok fingerprint is given by PATH
- string mok_path;
- if (!s.module_sign_mok_path.empty())
- {
- string mok_fingerprint;
- split_path (s.module_sign_mok_path, mok_path, mok_fingerprint);
- s.mok_fingerprints.clear();
- s.mok_fingerprints.push_back(mok_fingerprint);
- }
-
- rc = sign_module (s.tmpdir, s.module_filename(), s.mok_fingerprints, mok_path, s.kernel_build_tree);
- }
-#endif
-
PROBE1(stap, pass4__end, &s);
return rc;
}
-
+
int
pass_5 (systemtap_session &s, vector<remote*> targets)
{

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -1,237 +0,0 @@
diff --git a/java/HelperSDT.c b/java/HelperSDT.c
index ea08b8d..4b3271d 100644
--- a/java/HelperSDT.c
+++ b/java/HelperSDT.c
@@ -47,7 +47,7 @@ static int64_t determine_java_type(JNIEnv *env, jobject _arg, _Bool *need_free)
{
if ((*env)->IsSameObject(env, _arg, NULL)) {
*need_free = 1;
- return (int64_t) strdup("(null)"); /* need a real string to avoid user_string_warn getting upset */
+ return (int64_t) (uintptr_t) strdup("(null)"); /* need a real string to avoid user_string_warn getting upset */
}
jclass class_arg = (*env)->GetObjectClass(env, _arg);
@@ -87,7 +87,7 @@ static int64_t determine_java_type(JNIEnv *env, jobject _arg, _Bool *need_free)
(*env)->ExceptionClear(env);
/* Not a simple numeric scalar. Caller must free(). */
*need_free = true;
- return (int64_t) get_java_tostring(env, _arg);
+ return (int64_t) (uintptr_t) get_java_tostring(env, _arg);
}
static char *alloc_sargs(int64_t *sargs, _Bool *sfree, JNIEnv *env,
@@ -106,7 +106,7 @@ static void free_sargs(char *rulename, int64_t *sargs, _Bool *sfree, int num)
int i;
for (i = 0;i < num; i++)
if (sfree[i])
- free((void *) sargs[i]);
+ free((void *) (uintptr_t) sargs[i]);
free(rulename);
}
diff --git a/tapset/linux/conversions.stp b/tapset/linux/conversions.stp
index cfea83c..82f535f 100644
--- a/tapset/linux/conversions.stp
+++ b/tapset/linux/conversions.stp
@@ -26,7 +26,8 @@ deref_fault: /* branched to from deref_string() */
* really odd in the following error message. Setting a format
* width of '1' fixes this. */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -67,7 +68,8 @@ function kernel_string_quoted:string (addr:long)
(char *)(uintptr_t)STAP_ARG_addr,
MAXSTRINGLEN, MAXSTRINGLEN, 1, 0, 0);
if (STAP_ARG_addr == 0 || rc < 0)
- snprintf(STAP_RETVALUE, MAXSTRINGLEN, "%p", (void *)(uintptr_t)STAP_ARG_addr);
+ snprintf(STAP_RETVALUE, MAXSTRINGLEN, "0x%lx",
+ (unsigned long)(uintptr_t)STAP_ARG_addr);
%}
/**
@@ -86,7 +88,8 @@ function kernel_string_n:string (addr:long, n:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -110,7 +113,8 @@ function kernel_string_utf32:string (addr:long) %{ /* pure */
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-32 character U+%X at 0x%p", c32, source);
+ "invalid UTF-32 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -123,7 +127,8 @@ function kernel_string_utf32:string (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", source);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -189,7 +194,8 @@ function kernel_string_utf16:string (addr:long) %{ /* pure */
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-16 character U+%X at 0x%p", c32, source);
+ "invalid UTF-16 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -202,7 +208,8 @@ function kernel_string_utf16:string (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel string copy fault at 0x%p [man error::fault]", source);
+ "kernel string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -249,7 +256,8 @@ function kernel_long:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel long copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel long copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -267,7 +275,8 @@ function kernel_int:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel int copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel int copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -285,7 +294,8 @@ function kernel_short:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel short copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel short copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -303,7 +313,8 @@ function kernel_char:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel char copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel char copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -322,7 +333,8 @@ function kernel_pointer:long (addr:long) %{ /* pure */
if (0) {
deref_fault: /* branched to from kread() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "kernel pointer copy fault at 0x%p [man error::fault]", (void *) (uintptr_t) STAP_ARG_addr);
+ "kernel pointer copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
diff --git a/tapset/uconversions.stp b/tapset/uconversions.stp
index 1b2b52e..83790e9 100644
--- a/tapset/uconversions.stp
+++ b/tapset/uconversions.stp
@@ -126,7 +126,7 @@ function user_string_n:string (addr:long, n:long)
strlcpy(STAP_RETVALUE, "<unknown>", MAXSTRINGLEN);
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
"user string copy fault %ld at 0x%lx [man error::fault]", rc,
- (uintptr_t) STAP_ARG_addr);
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
CONTEXT->last_error = CONTEXT->error_buffer;
} else
STAP_RETVALUE[len - 1] = '\0';
@@ -228,8 +228,8 @@ function user_string_n_warn:string (addr:long, n:long, warn_msg:string)
// NB: using error_buffer to get local space for the warning, but we're
// not aborting, so leave last_error alone.
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault 0x%ld at %lx [man error::fault]", rc,
- (void *) (uintptr_t) STAP_ARG_addr);
+ "user string copy fault %ld at 0x%lx [man error::fault]", rc,
+ (unsigned long) (uintptr_t) STAP_ARG_addr);
_stp_warn(CONTEXT->error_buffer);
strlcpy (STAP_RETVALUE, STAP_ARG_warn_msg, MAXSTRINGLEN);
} else
@@ -335,7 +335,7 @@ function user_string_n_quoted:string (addr:long, inlen:long, outlen:long)
else
#endif
snprintf(STAP_RETVALUE, MAXSTRINGLEN, "0x%lx",
- (uintptr_t)STAP_ARG_addr);
+ (unsigned long) (uintptr_t)STAP_ARG_addr);
#endif
}
}
@@ -366,7 +366,8 @@ function user_string_utf32:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-32 character U+%X at 0x%lx", c32, (uintptr_t) source);
+ "invalid UTF-32 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -379,7 +380,8 @@ function user_string_utf32:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault at 0x%lx [man error::fault]", (uintptr_t) source);
+ "user string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -447,7 +449,8 @@ function user_string_utf16:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if ((rc = _stp_convert_utf32(destination, len, c32)) <= 0) {
if (rc < 0) {
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "invalid UTF-16 character U+%X at 0x%lx", c32, source);
+ "invalid UTF-16 character U+%X at 0x%lx", c32,
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
break;
@@ -460,7 +463,8 @@ function user_string_utf16:string (addr:long) %{ /* pure */ /* myproc-unprivileg
if (0) {
deref_fault: /* branched to from deref_string() */
snprintf (CONTEXT->error_buffer, sizeof(CONTEXT->error_buffer),
- "user string copy fault at 0x%lx [man error::fault]", (uintptr_t) source);
+ "user string copy fault at 0x%lx [man error::fault]",
+ (unsigned long) (uintptr_t) source);
CONTEXT->last_error = CONTEXT->error_buffer;
}
%}
@@ -532,7 +536,7 @@ function user_char_warn:long (addr:long) {
try {
return user_char_error(addr)
} catch {
- warn(sprintf("user char copy fault %p [man error::fault]",
+ warn(sprintf("user char copy fault at %p [man error::fault]",
addr))
return 0
}

24
SOURCES/rhbz2223733.patch Normal file
View File

@ -0,0 +1,24 @@
commit ead30c04c7157fec194c0f6d81e5c51c99bf25cf
gpg: Signature made Wed 24 May 2023 10:23:54 AM EDT
gpg: using RSA key 5D38116FA4D3A7CC77E378D37E83610126DCC2E8
gpg: Good signature from "Frank Ch. Eigler <fche@elastic.org>" [full]
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Wed May 24 10:22:08 2023 -0400
PR30484: stap-report: scrape less of /sys /proc
Mainly: avoid process/busy parts like /proc/$pid.
diff --git a/stap-report b/stap-report
index 217ddf840..3b3a1a258 100755
--- a/stap-report
+++ b/stap-report
@@ -105,7 +105,7 @@ elif [ -f /var/log/packages ]; then
run "cat /var/log/packages | egrep 'systemtap|elfutils|kernel|gcc|dyninst|java|byteman|avahi|nss|nspr|dejagnu' | sort -k9"
fi
run "egrep 'PROBE|RANDOMIZE|RELOC|TRACE|MARKER|KALLSYM|_DEBUG_|LOCKDEP|LOCKING|MODULE|FENTRY|_SIG|BPF' /lib/modules/`uname -r`/build/.config | grep -v not.set | sort | fmt -w 80"
-run "find /debugfs /proc /sys /dev /sys/kernel/debug -type f -path '*kprobe*' -o -path '*yama*' 2>/dev/null | xargs grep -H ."
+run "find /debugfs /proc/sys /sys/kernel /dev -type f -path '*kprobe*' -o -path '*yama*' 2>/dev/null | xargs grep -H ."
run "lsmod"
run "avahi-browse -r -t _stap._tcp"
run "ifconfig -a"

64
SOURCES/rhbz2223735.patch Normal file
View File

@ -0,0 +1,64 @@
commit ab0c5c25509600b7c9cecc9e10baebc984082b50
gpg: Signature made Fri 12 May 2023 11:18:18 AM EDT
gpg: using RSA key 5D38116FA4D3A7CC77E378D37E83610126DCC2E8
gpg: Good signature from "Frank Ch. Eigler <fche@elastic.org>" [full]
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Fri May 12 11:13:45 2023 -0400
PR30442: failing optional statement probes should not trigger pass2 exceptions
In tapsets.cxx, query_cu() and query_module() aggressively caught &
sess-print_error'd semantic_errors from subsidiary call sites. They
are unaware of whether the probe in question is being resolved within
an optional (? or !) context. Instead of this, they now simply let
the exceptions propagate out to derive_probes() or similar, which does
know whether exceptions are errors in that context. That means
exceptions can propagate through elfutils iteration machinery too,
perhaps risking C level memory leaks, but so be it.
This fix goes well beyond statement probes per se, but hand-testing
and the testsuite appear not to show regressions related to this.
Added semok/badstmt.exp to test.
diff --git a/tapsets.cxx b/tapsets.cxx
index 859160bc5..7b7107371 100644
--- a/tapsets.cxx
+++ b/tapsets.cxx
@@ -2453,8 +2453,9 @@ query_cu (Dwarf_Die * cudie, dwarf_query * q)
}
catch (const semantic_error& e)
{
- q->sess.print_error (e);
- return DWARF_CB_ABORT;
+ // q->sess.print_error (e);
+ throw;
+ // return DWARF_CB_ABORT;
}
}
@@ -2696,8 +2697,9 @@ query_module (Dwfl_Module *mod,
}
catch (const semantic_error& e)
{
- q->sess.print_error (e);
- return DWARF_CB_ABORT;
+ // q->sess.print_error (e);
+ // return DWARF_CB_ABORT;
+ throw;
}
}
diff --git a/testsuite/semok/stmtbad.stp b/testsuite/semok/stmtbad.stp
new file mode 100755
index 000000000..06780790a
--- /dev/null
+++ b/testsuite/semok/stmtbad.stp
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+exec stap -v -p2 -e 'probe oneshot {log("nothing") }
+ probe process.statement("main@*:1")? { log("yo") }' -c stap
+
+# The optional misaddressed statement probe should let stap still
+# succeed with the oneshot probe.

View File

@ -4,14 +4,13 @@
%{!?with_htmldocs: %global with_htmldocs 0}
%{!?with_monitor: %global with_monitor 1}
# crash is not available
%ifarch ppc ppc64 %{sparc} %{mips}
%ifarch ppc ppc64 %{sparc} %{mips} %{riscv}
%{!?with_crash: %global with_crash 0}
%else
%{!?with_crash: %global with_crash 1}
%endif
%{!?with_rpm: %global with_rpm 1}
%{!?elfutils_version: %global elfutils_version 0.142}
%{!?pie_supported: %global pie_supported 1}
%{!?elfutils_version: %global elfutils_version 0.179}
%{!?with_boost: %global with_boost 0}
%ifarch %{ix86} x86_64 ppc ppc64 ppc64le aarch64
%{!?with_dyninst: %global with_dyninst 0%{?fedora} >= 18 || 0%{?rhel} >= 7}
@ -21,7 +20,12 @@
%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 8}
%{!?with_systemd: %global with_systemd 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%{!?with_emacsvim: %global with_emacsvim 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%ifarch %{ix86}
%{!?with_java: %global with_java 0}
%else
%{!?with_java: %global with_java 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%endif
%{!?with_debuginfod: %global with_debuginfod 0%{?fedora} >= 25 || 0%{?rhel} >= 7}
%{!?with_virthost: %global with_virthost 0%{?fedora} >= 19 || 0%{?rhel} >= 7}
%{!?with_virtguest: %global with_virtguest 1}
%{!?with_dracut: %global with_dracut 0%{?fedora} >= 19 || 0%{?rhel} >= 6}
@ -38,6 +42,7 @@
%{!?with_python3_probes: %global with_python3_probes (0%{?fedora} >= 23 || 0%{?rhel} > 7)}
%{!?with_httpd: %global with_httpd 0}
%{!?with_specific_python: %global with_specific_python 0%{?fedora} >= 31}
%{!?with_sysusers: %global with_sysusers 0%{?fedora} >= 32 || 0%{?rhel} >= 9}
# Virt is supported on these arches, even on el7, but it's not in core EL7
%if 0%{?rhel} <= 7
@ -48,7 +53,8 @@
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 6
%define initdir %{_initddir}
%else # RHEL5 doesn't know _initddir
%else
# RHEL5 doesn't know _initddir
%define initdir %{_initrddir}
%endif
@ -58,7 +64,8 @@
%else
%if 0%{?rhel} >= 6
%define udevrulesdir /lib/udev/rules.d
%else # RHEL5
%else
# RHEL5
%define udevrulesdir /etc/udev/rules.d
%endif
%endif
@ -85,9 +92,38 @@
# To avoid testsuite/*/*.stp has shebang which doesn't start with '/'
%define __brp_mangle_shebangs_exclude_from .stp$
%define _systemtap_runtime_preinstall \
# See systemd-sysusers(8) sysusers.d(5)\
\
g stapusr 156\
g stapsys 157\
g stapdev 158
%define _systemtap_server_preinstall \
# See systemd-sysusers(8) sysusers.d(5)\
\
g stap-server -\
u stap-server - "systemtap compiler server" /var/lib/stap-server /sbin/nologin\
m stap-server stap-server
%define _systemtap_testsuite_preinstall \
# See systemd-sysusers(8) sysusers.d(5)\
\
u stapusr - "systemtap testsuite user" / /sbin/nologin\
u stapsys - "systemtap testsuite user" / /sbin/nologin\
u stapdev - "systemtap testsuite user" / /sbin/nologin\
m stapusr stapusr\
m stapsys stapusr\
m stapsys stapsys\
m stapdev stapusr\
m stapdev stapdev
Name: systemtap
Version: 4.3
Release: 4%{?release_override}%{?dist}
# PRERELEASE
Version: 4.9
Release: 3%{?release_override}%{?dist}
# for version, see also configure.ac
@ -106,6 +142,7 @@ Release: 4%{?release_override}%{?dist}
# systemtap-runtime-virtguest udev rules, init scripts/systemd service, req:-runtime
# systemtap-runtime-python2 HelperSDT python2 module, req:-runtime
# systemtap-runtime-python3 HelperSDT python3 module, req:-runtime
# systemtap-jupyter /usr/bin/stap-jupyter-* interactive-notebook req:systemtap
#
# Typical scenarios:
#
@ -123,16 +160,22 @@ License: GPLv2+
URL: http://sourceware.org/systemtap/
Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz
Patch1: rhbz1847676,1857749.patch
Patch2: rhbz1855264.patch
Patch3: rhbz1868095.patch
Patch1: rhbz2223733.patch
Patch2: rhbz2223735.patch
Patch3: pr29108.patch
Patch4: pr30749.patch
# Build*
BuildRequires: make
BuildRequires: gcc-c++
BuildRequires: cpio
BuildRequires: gettext-devel
BuildRequires: pkgconfig(nss)
BuildRequires: pkgconfig(avahi-client)
%if %{with_debuginfod}
BuildRequires: pkgconfig(libdebuginfod)
%endif
%if %{with_dyninst}
BuildRequires: dyninst-devel >= 10.0
BuildRequires: pkgconfig(libselinux)
@ -163,9 +206,6 @@ BuildRequires: /usr/bin/latex /usr/bin/dvips /usr/bin/ps2pdf
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
BuildRequires: tex(fullpage.sty) tex(fancybox.sty) tex(bchr7t.tfm) tex(graphicx.sty)
%endif
# For the html.sty mentioned in the .tex files, even though latex2html is
# not run during the build, only during manual scripts/update-docs runs:
BuildRequires: latex2html
%if %{with_htmldocs}
# On F10, xmlto's pdf support was broken off into a sub-package,
# called 'xmlto-tex'. To avoid a specific F10 BuildReq, we'll do a
@ -174,10 +214,11 @@ BuildRequires: xmlto /usr/share/xmlto/format/fo/pdf
%endif
%endif
%if %{with_emacsvim}
# for _emacs_sitelispdir macros etc.
BuildRequires: emacs
%endif
%if %{with_java}
BuildRequires: jpackage-utils java-devel
BuildRequires: java-devel
%endif
%if %{with_virthost}
# BuildRequires: libvirt-devel >= 1.0.2
@ -196,18 +237,22 @@ BuildRequires: python2-setuptools
BuildRequires: python-setuptools
%endif
%endif
%if %{with_python3}
BuildRequires: python3
%endif
%if %{with_python3_probes}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
%endif
%if %{with_specific_python}
BuildRequires: /usr/bin/pathfix.py
%endif
%if %{with_httpd}
BuildRequires: libmicrohttpd-devel
BuildRequires: libuuid-devel
%endif
%if %{with_sysusers}
BuildRequires: systemd-rpm-macros
%endif
# Install requirements
Requires: systemtap-client = %{version}-%{release}
@ -264,6 +309,9 @@ Requires: kernel-devel-uname-r
%endif
Requires: gcc make
# for compiling --runtime=dyninst sripts, need elfutils headers, bz1930973
Requires: elfutils-devel >= %{elfutils_version}
Conflicts: systemtap-client < %{version}-%{release}
Conflicts: systemtap-server < %{version}-%{release}
Conflicts: systemtap-runtime < %{version}-%{release}
@ -367,6 +415,16 @@ Requires: systemtap = %{version}-%{release}
Requires: systemtap-sdt-devel = %{version}-%{release}
Requires: systemtap-server = %{version}-%{release}
Requires: dejagnu which elfutils grep nc
%if %{with_debuginfod}
Requires: elfutils-debuginfod
%endif
# work around fedora ci gating kvetching about i686<->x86-64 conflicts
%ifarch x86_64
Conflicts: systemtap-testsuite = %{version}-%{release}.i686
%endif
%ifarch i686
Conflicts: systemtap-testsuite = %{version}-%{release}.x86_64
%endif
Requires: gcc gcc-c++ make glibc-devel
# testsuite/systemtap.base/ptrace.exp needs strace
Requires: strace
@ -397,7 +455,12 @@ Requires: systemtap-runtime-python2 = %{version}-%{release}
Requires: systemtap-runtime-python3 = %{version}-%{release}
%endif
%ifarch x86_64
%if 0%{?rhel} >= 8 || 0%{?fedora} >= 20
# fweimer, personal correspondence
Recommends: glibc-devel(x86-32)
%else
Requires: /usr/lib/libc.so
%endif
# ... and /usr/lib/libgcc_s.so.*
# ... and /usr/lib/libstdc++.so.*
%endif
@ -421,6 +484,13 @@ Summary: Systemtap Java Runtime Support
License: GPLv2+
URL: http://sourceware.org/systemtap/
Requires: systemtap-runtime = %{version}-%{release}
# work around fedora ci gating kvetching about i686<->x86-64 conflicts
%ifarch x86_64
Conflicts: systemtap-runtime = %{version}-%{release}.i686
%endif
%ifarch i686
Conflicts: systemtap-runtime = %{version}-%{release}.x86_64
%endif
Requires: byteman > 2.0
Requires: iproute
Requires: java-devel
@ -459,7 +529,7 @@ This package includes support files needed to run systemtap scripts
that probe python 3 processes.
%endif
%if %{with_python3}
%if %{with_python3_probes}
%package exporter
Summary: Systemtap-prometheus interoperation mechanism
License: GPLv2+
@ -477,7 +547,8 @@ to remote requesters on demand.
Summary: Systemtap Cross-VM Instrumentation - host
License: GPLv2+
URL: http://sourceware.org/systemtap/
Requires: libvirt >= 1.0.2
# only require libvirt-libs really
#Requires: libvirt >= 1.0.2
Requires: libxml2
%description runtime-virthost
@ -507,13 +578,26 @@ This package installs the services necessary on a virtual machine for a
systemtap-runtime-virthost machine to execute systemtap scripts.
%endif
%if %{with_python3} && %{with_monitor}
%package jupyter
Summary: ISystemtap jupyter kernel and examples
License: GPLv2+
URL: http://sourceware.org/systemtap/
Requires: systemtap = %{version}-%{release}
%description jupyter
This package includes files needed to build and run
the interactive systemtap Jupyter kernel, either locally
or within a container.
%endif
# ------------------------------------------------------------------------
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch -P1 -p1
%patch -P2 -p1
%patch -P3 -p1
%patch -P4 -p1
%build
@ -531,6 +615,13 @@ systemtap-runtime-virthost machine to execute systemtap scripts.
%global sqlite_config --disable-sqlite
%endif
%if %{with_debuginfod}
%global debuginfod_config --with-debuginfod
%else
%global debuginfod_config --without-debuginfod
%endif
# Enable/disable the crash extension
%if %{with_crash}
%global crash_config --enable-crash
@ -555,14 +646,6 @@ systemtap-runtime-virthost machine to execute systemtap scripts.
%global docs_config --enable-docs=prebuilt
%endif
# Enable pie as configure defaults to disabling it
%if %{pie_supported}
%global pie_config --enable-pie
%else
%global pie_config --disable-pie
%endif
%if %{with_java}
%global java_config --with-java=%{_jvmdir}/java
%else
@ -612,12 +695,17 @@ systemtap-runtime-virthost machine to execute systemtap scripts.
# We don't ship compileworthy python code, just oddball samples
%global py_auto_byte_compile 0
%configure %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}"
make %{?_smp_mflags}
%configure %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} %{debuginfod_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}"
make %{?_smp_mflags} V=1
%install
make DESTDIR=$RPM_BUILD_ROOT install
%if ! (%{with_python3})
rm -v $RPM_BUILD_ROOT%{_bindir}/stap-profile-annotate
%endif
%find_lang %{name}
for dir in $(ls -1d $RPM_BUILD_ROOT%{_mandir}/{??,??_??}) ; do
dir=$(echo $dir | sed -e "s|^$RPM_BUILD_ROOT||")
@ -625,6 +713,14 @@ for dir in $(ls -1d $RPM_BUILD_ROOT%{_mandir}/{??,??_??}) ; do
echo "%%lang($lang) $dir/man*/*" >> %{name}.lang
done
%if %{with_sysusers}
mkdir -p %{buildroot}%{_sysusersdir}
echo '%_systemtap_runtime_preinstall' > %{buildroot}%{_sysusersdir}/systemtap-runtime.conf
echo '%_systemtap_server_preinstall' > %{buildroot}%{_sysusersdir}/systemtap-server.conf
echo '%_systemtap_testsuite_preinstall' > %{buildroot}%{_sysusersdir}/systemtap-testsuite.conf
%endif
ln -s %{_datadir}/systemtap/examples
# Fix paths in the example scripts.
@ -674,6 +770,9 @@ install -m 644 initscript/logrotate.stap-server $RPM_BUILD_ROOT%{_sysconfdir}/lo
%if %{with_systemd}
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
touch $RPM_BUILD_ROOT%{_unitdir}/systemtap.service
# RHBZ2070857
mkdir -p $RPM_BUILD_ROOT%{_presetdir}
echo 'enable systemtap.service' > $RPM_BUILD_ROOT%{_presetdir}/42-systemtap.preset
install -m 644 initscript/systemtap.service $RPM_BUILD_ROOT%{_unitdir}/systemtap.service
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
install -m 755 initscript/systemtap $RPM_BUILD_ROOT%{_sbindir}/systemtap-service
@ -744,28 +843,41 @@ done
%if %{with_specific_python}
# Some files got ambiguous python shebangs, we fix them after everything else is done
pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/*
%py3_shebang_fix %{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/*
%endif
%pre runtime
%if %{with_sysusers}
echo '%_systemtap_runtime_preinstall' | systemd-sysusers --replace=%{_sysusersdir}/systemtap-runtime.conf -
%else
getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr
getent group stapsys >/dev/null || groupadd -f -g 157 -r stapsys
getent group stapdev >/dev/null || groupadd -f -g 158 -r stapdev
%endif
exit 0
%pre server
%if %{with_sysusers}
echo '%_systemtap_server_preinstall' | systemd-sysusers --replace=%{_sysusersdir}/systemtap-server.conf -
%else
getent group stap-server >/dev/null || groupadd -f -g 155 -r stap-server
getent passwd stap-server >/dev/null || \
useradd -c "Systemtap Compile Server" -u 155 -g stap-server -d %{_localstatedir}/lib/stap-server -r -s /sbin/nologin stap-server 2>/dev/null || \
useradd -c "Systemtap Compile Server" -g stap-server -d %{_localstatedir}/lib/stap-server -r -s /sbin/nologin stap-server
%endif
exit 0
%pre testsuite
%if %{with_sysusers}
echo '%_systemtap_testsuite_preinstall' | systemd-sysusers --replace=%{_sysusersdir}/systemtap-testsuite.conf -
%else
getent passwd stapusr >/dev/null || \
useradd -c "Systemtap 'stapusr' User" -g stapusr -r -s /sbin/nologin stapusr
getent passwd stapsys >/dev/null || \
useradd -c "Systemtap 'stapsys' User" -g stapsys -G stapusr -r -s /sbin/nologin stapsys
getent passwd stapdev >/dev/null || \
useradd -c "Systemtap 'stapdev' User" -g stapdev -G stapusr -r -s /sbin/nologin stapdev
%endif
exit 0
%post server
@ -786,7 +898,8 @@ if [ ! -f ~stap-server/.systemtap/rc ]; then
numcpu=`/usr/bin/getconf _NPROCESSORS_ONLN`
if [ -z "$numcpu" -o "$numcpu" -lt 1 ]; then numcpu=1; fi
nproc=`expr $numcpu \* 30`
echo "--rlimit-as=614400000 --rlimit-cpu=60 --rlimit-nproc=$nproc --rlimit-stack=1024000 --rlimit-fsize=51200000" > ~stap-server/.systemtap/rc
# PR29661 -> 4G
echo "--rlimit-as=4294967296 --rlimit-cpu=60 --rlimit-nproc=$nproc --rlimit-stack=1024000 --rlimit-fsize=51200000" > ~stap-server/.systemtap/rc
chown stap-server:stap-server ~stap-server/.systemtap/rc
fi
@ -842,7 +955,8 @@ exit 0
%post initscript
%if %{with_systemd}
/bin/systemctl enable systemtap.service >/dev/null 2>&1 || :
# RHBZ2070857 - use systemd presets instead
# /bin/systemctl enable systemtap.service >/dev/null 2>&1 || :
%else
/sbin/chkconfig --add systemtap
%endif
@ -922,7 +1036,7 @@ if [ "$1" -ge "1" ]; then
fi
exit 0
%if %{with_python3}
%if %{with_python3_probes}
%if %{with_systemd}
%preun exporter
if [ $1 = 0 ] ; then
@ -952,60 +1066,8 @@ exit 0
# ------------------------------------------------------------------------
%if %{with_java}
%triggerin runtime-java -- java-1.8.0-openjdk, java-1.7.0-openjdk, java-1.6.0-openjdk
for f in %{_libexecdir}/systemtap/libHelperSDT_*.so; do
%ifarch %{ix86}
arch=i386
%else
arch=`basename $f | cut -f2 -d_ | cut -f1 -d.`
%endif
for archdir in %{_jvmdir}/*openjdk*/jre/lib/${arch}; do
if [ -d ${archdir} ]; then
ln -sf %{_libexecdir}/systemtap/libHelperSDT_${arch}.so ${archdir}/libHelperSDT_${arch}.so
ln -sf %{_libexecdir}/systemtap/HelperSDT.jar ${archdir}/../ext/HelperSDT.jar
fi
done
done
%triggerun runtime-java -- java-1.8.0-openjdk, java-1.7.0-openjdk, java-1.6.0-openjdk
for f in %{_libexecdir}/systemtap/libHelperSDT_*.so; do
%ifarch %{ix86}
arch=i386
%else
arch=`basename $f | cut -f2 -d_ | cut -f1 -d.`
%endif
for archdir in %{_jvmdir}/*openjdk*/jre/lib/${arch}; do
rm -f ${archdir}/libHelperSDT_${arch}.so
rm -f ${archdir}/../ext/HelperSDT.jar
done
done
%triggerpostun runtime-java -- java-1.8.0-openjdk, java-1.7.0-openjdk, java-1.6.0-openjdk
# Restore links for any JDKs remaining after a package removal:
for f in %{_libexecdir}/systemtap/libHelperSDT_*.so; do
%ifarch %{ix86}
arch=i386
%else
arch=`basename $f | cut -f2 -d_ | cut -f1 -d.`
%endif
for archdir in %{_jvmdir}/*openjdk*/jre/lib/${arch}; do
if [ -d ${archdir} ]; then
ln -sf %{_libexecdir}/systemtap/libHelperSDT_${arch}.so ${archdir}/libHelperSDT_${arch}.so
ln -sf %{_libexecdir}/systemtap/HelperSDT.jar ${archdir}/../ext/HelperSDT.jar
fi
done
done
# XXX: analogous support for other types of JRE/JDK??
%endif
# ------------------------------------------------------------------------
%files
# The master "systemtap" rpm doesn't include any files.
# The main "systemtap" rpm doesn't include any files.
%files server -f systemtap.lang
%{_bindir}/stap-server
@ -1039,11 +1101,17 @@ done
%doc README README.unprivileged AUTHORS NEWS
%{!?_licensedir:%global license %%doc}
%license COPYING
%if %{with_sysusers}
%{_sysusersdir}/systemtap-server.conf
%endif
%files devel -f systemtap.lang
%{_bindir}/stap
%{_bindir}/stap-prep
%if %{with_python3}
%{_bindir}/stap-profile-annotate
%endif
%{_bindir}/stap-report
%dir %{_datadir}/systemtap
%{_datadir}/systemtap/runtime
@ -1059,7 +1127,7 @@ done
%license COPYING
%if %{with_java}
%dir %{_libexecdir}/systemtap
%{_libexecdir}/systemtap/libHelperSDT_*.so
%{_libexecdir}/systemtap/libHelperSDT.so
%endif
%if %{with_emacsvim}
%{_emacs_sitelispdir}/*.el*
@ -1108,6 +1176,9 @@ done
%doc README README.security AUTHORS NEWS
%{!?_licensedir:%global license %%doc}
%license COPYING
%if %{with_sysusers}
%{_sysusersdir}/systemtap-runtime.conf
%endif
%files client -f systemtap.lang
@ -1141,6 +1212,7 @@ done
%files initscript
%if %{with_systemd}
%{_presetdir}/42-systemtap.preset
%{_unitdir}/systemtap.service
%{_sbindir}/systemtap-service
%else
@ -1174,12 +1246,15 @@ done
%files testsuite
%dir %{_datadir}/systemtap
%{_datadir}/systemtap/testsuite
%if %{with_sysusers}
%{_sysusersdir}/systemtap-testsuite.conf
%endif
%if %{with_java}
%files runtime-java
%dir %{_libexecdir}/systemtap
%{_libexecdir}/systemtap/libHelperSDT_*.so
%{_libexecdir}/systemtap/libHelperSDT.so
%{_libexecdir}/systemtap/HelperSDT.jar
%{_libexecdir}/systemtap/stapbm
%endif
@ -1215,7 +1290,7 @@ done
%endif
%endif
%if %{with_python3}
%if %{with_python3_probes}
%files exporter
%{_sysconfdir}/stap-exporter
%{_sysconfdir}/sysconfig/stap-exporter
@ -1224,6 +1299,15 @@ done
%{_sbindir}/stap-exporter
%endif
%if %{with_python3} && %{with_monitor}
%files jupyter
%{_bindir}/stap-jupyter-container
%{_bindir}/stap-jupyter-install
%{_mandir}/man1/stap-jupyter.1*
%dir %{_datadir}/systemtap
%{_datadir}/systemtap/interactive-notebook
%endif
# ------------------------------------------------------------------------
# Future new-release entries should be of the form
@ -1233,6 +1317,81 @@ done
# PRERELEASE
%changelog
* Mon Aug 14 2023 Frank Ch. Eigler <fche@redhat.com> - 4.9-3
- rhbz2231619
- rhbz2095359
* Tue Jul 18 2023 Frank Ch. Eigler <fche@redhat.com> - 4.9-2
- rhbz2223733 = rhbz2211288
- rhbz2223735 = rhbz2223739
* Fri Apr 28 2023 Frank Ch. Eigler <fche@redhat.com> - 4.9-1
- Upstream release, see wiki page below for detailed notes.
https://sourceware.org/systemtap/wiki/SystemTapReleases
* Fri Dec 23 2022 Frank Ch. Eigler <fche@redhat.com> - 4.8-2
- rhbz2156092 = rhbz1997192
- rhbz2145241 = rhbz2145242
- rhbz2156093 = rhbz2149223
- rhbz2156095 = rhbz2149666
- rhbz2156094 = rhbz2154430
* Thu Nov 03 2022 Frank Ch. Eigler <fche@redhat.com> - 4.8-1
- Upstream release.
* Mon May 02 2022 Stan Cox <scox@redhat.com> - 4.7-1
- Upstream release, see wiki page below for detailed notes.
https://sourceware.org/systemtap/wiki/SystemTapReleases
* Tue Dec 07 2021 Stan Cox <scox@redhat.com> - 4.6.4
- sys/sdt.h remove aarch64 and s390 float constraints
* Mon Dec 06 2021 Stan Cox <scox@redhat.com> - 4.6.3
- sys/sdt.h remove float constraints that may cause gcc reload issues.
* Thu Dec 02 2021 Frank Ch. Eigler <fche@redhat.com> - 4.6.2
- sys/sdt.h fixes for glibc ftbfs
* Mon Nov 15 2021 Frank Ch. Eigler <fche@redhat.com> - 4.6-1
- Upstream release.
* Thu Aug 12 2021 Frank Ch. Eigler <fche@redhat.com> - 4.5-3
- rhbz1991631 iommu tracepoints break ppc64le
* Tue Jul 27 2021 Frank Ch. Eigler <fche@redhat.com> - 4.5-2
- rhbz1986543 rebuild against dyninst 11
* Fri May 07 2021 Frank Ch. Eigler <fche@redhat.com> - 4.5-1
- Upstream release.
* Tue Jan 26 2021 Frank Ch. Eigler <fche@redhat.com> - 4.4-9
- rhbz1927497 enable debuginfod client for buildid probing
* Tue Jan 26 2021 Frank Ch. Eigler <fche@redhat.com> - 4.4-8
- rhbz1902696 fix invocation as stapusr with procfs/lockdown
* Wed Jan 20 2021 Martin Cermak <mcermak@redhat.com> - 4.4-7
- rhbz1650594 fix boot time probing feature
* Mon Jan 04 2021 Frank Ch. Eigler <fche@redhat.com> - 4.4-6
- rhbz1906662 backport transport/utrace/locking patches
* Thu Dec 17 2020 Frank Ch. Eigler <fche@redhat.com> - 4.4-5
- rhbz1908904 fix lock-pushdown codegen for conditional probes
* Tue Dec 15 2020 Frank Ch. Eigler <fche@redhat.com> - 4.4-4
- rhbz1902696 fix invocation as stapusr vs. root
* Tue Nov 17 2020 Frank Ch. Eigler <fche@redhat.com> - 4.4-3
- rhbz1873492 related: rhel8 kernel_is_locked_down detection
* Mon Nov 16 2020 Frank Ch. Eigler <fche@redhat.com> - 4.4-2
- rhbz1898288: stability for exhausted UTRACE_TASK_WORK_POOL
- rhbz1873492 related: mokutil parser robustness for RH keys
* Mon Nov 09 2020 Frank Ch. Eigler <fche@redhat.com> - 4.4-1
- Upstream release.
* Wed Aug 12 2020 Martin Cermak <mcermak@redhat.com> - 4.3-4
- rhbz1868095: Refix including PR26379.