From 89af0d93f33d0b5e17e2e0995bcf4f3d400dae9d Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Thu, 13 Nov 2025 16:59:24 +0100 Subject: [PATCH] Backport PR33428: imply kernel check by file name Resolves: RHEL-105777 --- 0001-PR33428-imply-kernel-vmlinux-h.patch | 66 +++++++++++++++++++++++ systemtap.spec | 10 +++- 2 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 0001-PR33428-imply-kernel-vmlinux-h.patch diff --git a/0001-PR33428-imply-kernel-vmlinux-h.patch b/0001-PR33428-imply-kernel-vmlinux-h.patch new file mode 100644 index 0000000..c2614ff --- /dev/null +++ b/0001-PR33428-imply-kernel-vmlinux-h.patch @@ -0,0 +1,66 @@ +From 53c48b550255ceca1216616fe1948618be166189 Mon Sep 17 00:00:00 2001 +From: "Frank Ch. Eigler" +Date: Wed, 12 Nov 2025 18:51:26 -0500 +Subject: [PATCH] PR33428: imply kernel, check by file name, cont'd + +Linux 5.7+ includes a vmlinux.h file ... but previous code looked for +version 6.7+ by mistake. Might as well just look for the vmlinux.h +file directly in the build tree, and leave a little diagnostic note. +--- + tapsets.cxx | 33 +++++++++++++++++++++------------ + 1 file changed, 21 insertions(+), 12 deletions(-) + +diff --git a/tapsets.cxx b/tapsets.cxx +index d267b6506..ae201ab26 100644 +--- a/tapsets.cxx ++++ b/tapsets.cxx +@@ -4867,8 +4867,12 @@ dwarf_var_expanding_visitor::visit_cast_op (cast_op *e) + if (is_user_module (q.dw.module_name)) + e->module = q.dw.module_name; + else if ((strverscmp(sess.compatible.c_str(), "5.4") >= 0) && // default on new enough systemtap +- (strverscmp(sess.kernel_base_release.c_str(), "6.7") >= 0)) // for new enough kernel to have a vmlinux.h +- e->module = string(TOK_KERNEL_VMLINUX_H) + string(":") + q.dw.module_name; // PR33428: prefix ++ access(string(sess.kernel_build_tree+"/vmlinux.h").c_str(), R_OK) == 0) // file exists; not just kernel 6.7+ ++ { ++ if (sess.verbose > 3) ++ clog << _("added implicit kernel for @cast context") << " " << q.dw.module_name << endl; ++ e->module = string(TOK_KERNEL_VMLINUX_H) + string(":") + q.dw.module_name; // PR33428: prefix ++ } + else + e->module = q.dw.module_name; + } +@@ -5166,16 +5170,21 @@ void dwarf_cast_expanding_visitor::visit_cast_op (cast_op* e) + // PR33428: prepend "kernel" to the list if there is any + // "kernel" or "kernel" component. + if ((strverscmp(sess.compatible.c_str(), "5.4") >= 0) && // default on new enough systemtap +- (strverscmp(sess.kernel_base_release.c_str(), "6.7") >= 0) && // for new enough kernel to have a vmlinux.h +- (e->module.find(TOK_KERNEL_VMLINUX_H) == string::npos)) // don't prepend again; might already be here from implicit "" expansion +- { +- if (e->module.starts_with("kernel")) // right at the front? +- e->module = string(TOK_KERNEL_VMLINUX_H) + string(":") + e->module; +- else { +- string::size_type p = e->module.find(":kernel"); // in the middle? +- if (p != string::npos) +- e->module.insert(p, TOK_KERNEL_VMLINUX_H + string (":")); +- } ++ access(string(sess.kernel_build_tree+"/vmlinux.h").c_str(), R_OK) == 0) // file exists; not just kernel 6.7+ ++ { ++ if (sess.verbose > 3) ++ clog << _("added implicit kernel for @cast expanding") << " " << e->module << endl; ++ ++ if (e->module.find(TOK_KERNEL_VMLINUX_H) == string::npos) // don't prepend again; might already be here from implicit "" expansion ++ { ++ if (e->module.starts_with("kernel")) // right at the front? ++ e->module = string(TOK_KERNEL_VMLINUX_H) + string(":") + e->module; ++ else { ++ string::size_type p = e->module.find(":kernel"); // in the middle? ++ if (p != string::npos) ++ e->module.insert(p, TOK_KERNEL_VMLINUX_H + string (":")); ++ } ++ } + } + + tokenize(e->module, modules, ":"); +-- +2.51.0 + diff --git a/systemtap.spec b/systemtap.spec index 5a284be..9bfdc09 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -131,7 +131,7 @@ f /var/log/stap-server/log 0644 stap-server stap-server - Name: systemtap # PRERELEASE Version: 5.4 -Release: 1%{?release_override}%{?dist} +Release: 2%{?release_override}%{?dist} # for version, see also configure.ac @@ -169,6 +169,8 @@ License: GPL-2.0-or-later URL: https://sourceware.org/systemtap/ Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz +Patch1: 0001-PR33428-imply-kernel-vmlinux-h.patch + # Build* BuildRequires: make BuildRequires: gcc-c++ @@ -612,7 +614,7 @@ or within a container. # ------------------------------------------------------------------------ %prep -%setup -q +%autosetup -p1 %build @@ -1363,6 +1365,10 @@ exit 0 # PRERELEASE %changelog +* Thu Nov 13 2025 Martin Cermak - 5.4-2 +- Backport upstream patch 53c48b550 imply kernel + check by file name. + * Fri Oct 31 2025 Frank Ch. Eigler - 5.4-1 - Upstream release, see wiki page below for detailed notes. https://sourceware.org/systemtap/wiki/SystemTapReleases