Compare commits

...

13 Commits
master ... f28

Author SHA1 Message Date
Mark Wielaard 9cae14be56 3.2-11 spec update. 2018-04-19 00:56:03 +02:00
Mark Wielaard f4d16bbfd4 3.2-11
- Add rhbz1549063.patch (/bin/env -> /usr/bin/env)
- Add rhbz1566745.patch (4.15 kernel tapset updates)
- Enable accidentially disabled Suggests: kernel-devel again.
2018-04-19 00:53:27 +02:00
Mark Wielaard b091a8808e 3.2-10
- Add unwind-fallback.patch
- rhbz1566422.patch
2018-04-18 16:57:44 +02:00
Mark Wielaard ac1f9cc510 3.2-9 - Add unwind-fallback.patch. 2018-04-17 17:13:18 +02:00
Björn Esser 2500eea295
Rebuilt for libjson-c.so.4 (json-c v0.13.1) on fc28 2018-03-27 10:34:50 +02:00
Frank Ch. Eigler 0384025141 Merge remote-tracking branch 'origin/f27' into f28
* origin/f27:
  Backport fix for removed timers in kernel 4.15 (#1546563)
2018-02-22 10:39:08 -05:00
Stan Cox d65c8777af Fixes for gcc 8.0.1 2018-02-14 11:25:36 -05:00
Stan Cox f70df36055 Fixes for gcc 8.0.1 2018-02-14 11:12:36 -05:00
Igor Gnatenko 75c387b28c
Remove %clean section
None of currently supported distributions need that.
Last one was EL5 which is EOL for a while.

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-14 09:07:51 +01:00
Igor Gnatenko 2c11815ddb Remove BuildRoot definition
None of currently supported distributions need that.
It was needed last for EL5 which is EOL now

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-14 00:42:22 +01:00
Igor Gnatenko 9be34952bf
Escape macros in %changelog
Reference: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/Y2ZUKK2B7T2IKXPMODNF6HB2O5T5TS6H/
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-09 09:06:23 +01:00
Igor Gnatenko ac3f11bfc6
Fix very old Requires
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-02-07 17:44:25 +01:00
Björn Esser 64e8afca44
Rebuilt for libjson-c.so.3 2017-12-10 20:50:43 +01:00
7 changed files with 756 additions and 12 deletions

208
rhbz1544711.patch Normal file
View File

@ -0,0 +1,208 @@
commit a8e317b60 (HEAD -> master, origin/master, origin/HEAD)
Author: Stan Cox <scox@redhat.com>
Date: Tue Feb 13 22:38:03 2018 -0500
Fixes for gcc 8
* includes/sys/sdt.h (__SDT_COND_SIGNED): Add CT, cast type argument
Author: Will Cohen <wcohen.redhat.com>
* stap-serverd.cxx (generate_mok, handleRequest, handle_connection):
Catch format overflow
* translate.cxx (translate_pass): Use ref in catch.
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
index 940f74483..c0c5a492c 100644
--- a/includes/sys/sdt.h
+++ b/includes/sys/sdt.h
@@ -119,8 +119,8 @@ struct __sdt_type
#define __SDT_ALWAYS_SIGNED(T) \
template<> struct __sdt_type<T> { static const bool __sdt_signed = true; };
-#define __SDT_COND_SIGNED(T) \
-template<> struct __sdt_type<T> { static const bool __sdt_signed = ((T)(-1) < 1); };
+#define __SDT_COND_SIGNED(T,CT) \
+template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); };
__SDT_ALWAYS_SIGNED(signed char)
__SDT_ALWAYS_SIGNED(short)
__SDT_ALWAYS_SIGNED(int)
@@ -141,14 +141,14 @@ __SDT_ALWAYS_SIGNED(const volatile short)
__SDT_ALWAYS_SIGNED(const volatile int)
__SDT_ALWAYS_SIGNED(const volatile long)
__SDT_ALWAYS_SIGNED(const volatile long long)
-__SDT_COND_SIGNED(char)
-__SDT_COND_SIGNED(wchar_t)
-__SDT_COND_SIGNED(volatile char)
-__SDT_COND_SIGNED(volatile wchar_t)
-__SDT_COND_SIGNED(const char)
-__SDT_COND_SIGNED(const wchar_t)
-__SDT_COND_SIGNED(const volatile char)
-__SDT_COND_SIGNED(const volatile wchar_t)
+__SDT_COND_SIGNED(char, char)
+__SDT_COND_SIGNED(wchar_t, wchar_t)
+__SDT_COND_SIGNED(volatile char, char)
+__SDT_COND_SIGNED(volatile wchar_t, wchar_t)
+__SDT_COND_SIGNED(const char, char)
+__SDT_COND_SIGNED(const wchar_t, wchar_t)
+__SDT_COND_SIGNED(const volatile char, char)
+__SDT_COND_SIGNED(const volatile wchar_t, wchar_t)
#if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
/* __SDT_COND_SIGNED(char16_t) */
/* __SDT_COND_SIGNED(char32_t) */
diff --git a/stap-serverd.cxx b/stap-serverd.cxx
index b8f70114c..063c3c587 100644
--- a/stap-serverd.cxx
+++ b/stap-serverd.cxx
@@ -1607,6 +1607,7 @@ generate_mok(string &mok_fingerprint)
char tmpdir[PATH_MAX] = { '\0' };
string public_cert_path, private_cert_path, destdir;
mode_t old_umask;
+ int retlen;
mok_fingerprint.clear ();
@@ -1631,7 +1632,14 @@ generate_mok(string &mok_fingerprint)
}
// Make a temporary directory to store results in.
- snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ());
+ retlen = snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ());
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Could not create %s name", "temporary directory"));
+ tmpdir[0] = '\0';
+ goto cleanup;
+ }
+
if (mkdtemp (tmpdir) == NULL)
{
server_error (_F("Could not create temporary directory %s: %s", tmpdir,
@@ -1704,6 +1712,7 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
unsigned u;
unsigned i;
FILE* f;
+ int retlen;
// Save the server version. Do this early, so the client knows what version of the server
// it is dealing with, even if the request is not fully completed.
@@ -1782,7 +1791,12 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
struct stat st;
char *arg;
- snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i);
+ retlen = snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "path"));
+ return;
+ }
rc = stat(stapargfile, & st);
if (rc) break;
@@ -1888,7 +1902,15 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
{
glob_t globber;
char pattern[PATH_MAX];
- snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str());
+ int retlen;
+
+ retlen = snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str());
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "pattern"));
+ return;
+ }
+
rc = glob (pattern, GLOB_ERR, NULL, &globber);
if (rc)
server_error (_F("Unable to find a module in %s", new_staptmpdir.c_str()));
@@ -2164,6 +2186,7 @@ handle_connection (void *arg)
copy for each connection.*/
vector<string> argv;
PRInt32 bytesRead;
+ int retlen;
/* Detatch to avoid a memory leak */
if(max_threads > 0)
@@ -2213,7 +2236,13 @@ handle_connection (void *arg)
#endif
secStatus = SECFailure;
- snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp");
+ retlen = snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp");
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "temporary directory"));
+ tmpdir[0]=0; /* prevent /bin/rm */
+ goto cleanup;
+ }
rc1 = mkdtemp(tmpdir);
if (! rc1)
{
@@ -2223,9 +2252,20 @@ handle_connection (void *arg)
}
/* Create a temporary files names and directories. */
- snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir);
+ retlen = snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "request.zip path"));
+ goto cleanup;
+ }
+
+ retlen = snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "request directory path"));
+ goto cleanup;
+ }
- snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir);
rc = mkdir(requestDirName, 0700);
if (rc)
{
@@ -2233,7 +2273,13 @@ handle_connection (void *arg)
goto cleanup;
}
- snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir);
+ retlen = snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "response directory path"));
+ goto cleanup;
+ }
+
rc = mkdir(responseDirName, 0700);
if (rc)
{
@@ -2243,7 +2289,12 @@ handle_connection (void *arg)
// Set this early, since it gets used for errors to be returned to the client.
stapstderr = string(responseDirName) + "/stderr";
- snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir);
+ retlen = snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir);
+ if (retlen < 0 || retlen >= PATH_MAX)
+ {
+ server_error (_F("Error creating %s name", "response.zip path"));
+ goto cleanup;
+ }
/* Read data from the socket.
* If the user is requesting/requiring authentication, authenticate
diff --git a/translate.cxx b/translate.cxx
index 1240a80ec..4ade06fdd 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -7860,7 +7860,7 @@ translate_pass (systemtap_session& s)
if (versions.size() >= 3 && s.verbose > 1)
clog << _F("ignoring extra parts of compat version: %s", s.compatible.c_str()) << endl;
}
- catch (const runtime_error)
+ catch (const runtime_error&)
{
throw SEMANTIC_ERROR(_F("parse error in compatibility version: %s", s.compatible.c_str()));
}

32
rhbz1549063.patch Normal file
View File

@ -0,0 +1,32 @@
commit d6492e78bd50e923963e3c7aa235100a208f4775
Author: Mark Wielaard <mark@klomp.org>
Date: Mon Feb 26 11:31:44 2018 +0100
testsuite: Use /usr/bin/env everywhere.
bz5274.stp and bz5274.a.stp where still using /bin/env instead of
/usr/bin/env like every other testsuite file.
The latest coreutils in rawhide dropped old /bin/* provides.
https://bugzilla.redhat.com/show_bug.cgi?id=1549063
diff --git a/testsuite/systemtap.base/bz5274.a.stp b/testsuite/systemtap.base/bz5274.a.stp
index 1d3aefc..e6365e4 100755
--- a/testsuite/systemtap.base/bz5274.a.stp
+++ b/testsuite/systemtap.base/bz5274.a.stp
@@ -1,4 +1,4 @@
-#! /bin/env stap
+#! /usr/bin/env stap
probe process("./bz5274").function("funcb").call,
process("./bz5274").function("funcc").call,
process("./bz5274").function("funcd").call
diff --git a/testsuite/systemtap.base/bz5274.stp b/testsuite/systemtap.base/bz5274.stp
index b3e26d8..2f62cbc 100755
--- a/testsuite/systemtap.base/bz5274.stp
+++ b/testsuite/systemtap.base/bz5274.stp
@@ -1,4 +1,4 @@
-#! /bin/env stap
+#! /usr/bin/env stap
probe process("./bz5274").function("*").call {
printf("%s Entering %s\n", pp(), thread_indent(1))
}

46
rhbz1566422.patch Normal file
View File

@ -0,0 +1,46 @@
commit db9c9d6e30c6cfd7b85475b5c79ee2cc51201934
Author: Serhei Makarov <smakarov@redhat.com>
Date: Tue Apr 17 11:35:00 2018 -0400
RHBZ1566422 - fix spurious Build-id mismatch when probing reinserted kernel module
Code for newer kernels did not clear the address of the notes-section
when a probed module was unloaded. This caused spurious Build-id mismatch
when the module was reinserted as new addresses are not computed for
dynamically loaded modules (see also: PR23068) and the Build-id check
was trying to read the notes section at the no-longer-valid old address.
* runtime/sym.c (_stp_module_notifier): clear addresses on
MODULE_STATE_GOING in newer kernels (>=3.10) too.
* runtime/transport/symbols.c (_stp_kmodule_update_address): fix logic
error and clear notes section addr when reloc=NULL (aka. 'all').
diff --git a/runtime/sym.c b/runtime/sym.c
index c11a35a..b6e0fd6 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -1045,7 +1045,7 @@ static void _stp_kmodule_update_address(const char* module,
if (strcmp (_stp_modules[mi]->name, module))
continue;
- if (reloc && !strcmp (note_sectname, reloc)) {
+ if (!reloc || !strcmp (note_sectname, reloc)) {
dbug_sym(1, "module %s special section %s address %#lx\n",
_stp_modules[mi]->name,
note_sectname,
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 64c2aeb..076c562 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -167,6 +167,11 @@ static int _stp_module_notifier (struct notifier_block * nb,
/* Verify build-id. */
_stp_kmodule_check (mod->name);
}
+ else if (val == MODULE_STATE_GOING) {
+ /* Unregister all sections. */
+ dbug_sym(2, "unregister sections\n");
+ _stp_kmodule_update_address(mod->name, NULL, 0);
+ }
else if (val != MODULE_STATE_GOING) {
return NOTIFY_DONE;
}

125
rhbz1566745.patch Normal file
View File

@ -0,0 +1,125 @@
commit 0f8139eb4bd06a19714608b5f246fc24fcafde6e
Author: David Smith <dsmith@redhat.com>
Date: Thu Dec 7 16:07:39 2017 -0600
Updated several tapsets for the 4.15 kernel.
* tapset/linux/linuxmib.stp: Update the 'DelayedACKs' probes to handle
a missing '$data' parameter.
* tapset/linux/memory.stp: Handle missing '__GFP_COLD' flag.
* tapset/linux/nfsd.stp: Update the 'nfsd.proc4.rename' probe to handle
upstream changes.
* tapset/linux/signal.stp: Update the 'signal.pending' probe to handle a
missing '$sigsestsize' parameter.
diff --git a/tapset/linux/linuxmib.stp b/tapset/linux/linuxmib.stp
index ef09929..63ec248 100644
--- a/tapset/linux/linuxmib.stp
+++ b/tapset/linux/linuxmib.stp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2009 IBM Corp.
- * Copyright (C) 2010 Red Hat Inc.
+ * Copyright (C) 2010-2017 Red Hat Inc.
*
* This file is part of systemtap, and is free software. You can
* redistribute it and/or modify it under the terms of the GNU General
@@ -39,14 +39,18 @@ probe _linuxmib.DelayedACKs.A = kernel.function("tcp_send_ack")
probe _linuxmib.DelayedACKs.B = kernel.function("tcp_delack_timer")
{
- sk=$data
+ sk=@choose_defined($data,
+ &@container_of($t, "inet_connection_sock",
+ icsk_delack_timer)->icsk_inet->sk)
indelack_timer[sk]=1
op=0
}
probe _linuxmib.DelayedACKs.C = kernel.function("tcp_delack_timer").return
{
- sk=@entry($data)
+ sk=@entry(@choose_defined($data,
+ &@container_of($t, "inet_connection_sock",
+ icsk_delack_timer)->icsk_inet->sk))
indelack_timer[sk]=0;
op=0
}
diff --git a/tapset/linux/memory.stp b/tapset/linux/memory.stp
index b968fe3..169d0f1 100644
--- a/tapset/linux/memory.stp
+++ b/tapset/linux/memory.stp
@@ -1,7 +1,7 @@
// memory/vm related tapset
// Copyright (C) 2005, 2006 IBM Corp.
// Copyright (C) 2006 Intel Corporation.
-// Copyright (C) 2014 Red Hat Inc.
+// Copyright (C) 2014-2017 Red Hat Inc.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
@@ -368,7 +368,9 @@ probe vm.oom_kill = kernel.function("oom_kill_process") !,
__GFP_BITMASKS(__GFP_HIGH)
__GFP_BITMASKS(__GFP_IO)
__GFP_BITMASKS(__GFP_FS)
+#ifdef __GFP_COLD
__GFP_BITMASKS(__GFP_COLD)
+#endif
__GFP_BITMASKS(__GFP_NOWARN)
#ifdef __GFP_RETRY_MAYFAIL
__GFP_BITMASKS(__GFP_RETRY_MAYFAIL)
diff --git a/tapset/linux/nfsd.stp b/tapset/linux/nfsd.stp
index 3df1600..5a70e84 100644
--- a/tapset/linux/nfsd.stp
+++ b/tapset/linux/nfsd.stp
@@ -1262,18 +1262,26 @@ probe nfsd.proc4.rename = kernel.function("nfsd4_rename").call !,
fh = & @nfsd4_compound_state($cstate)->save_fh
tfh = & @nfsd4_compound_state($cstate)->current_fh
- filelen = $rename->rn_snamelen
- filename = kernel_string_n($rename->rn_sname, $rename->rn_snamelen)
- tlen = $rename->rn_tnamelen
- tname = kernel_string_n($rename->rn_tname, $rename->rn_tnamelen)
+ if (@defined($rename)) {
+ filelen = $rename->rn_snamelen
+ filename = kernel_string_n($rename->rn_sname,
+ $rename->rn_snamelen)
+ tlen = $rename->rn_tnamelen
+ tname = kernel_string_n($rename->rn_tname, $rename->rn_tnamelen)
+ } else {
+ filelen = $u->rename->rn_snamelen
+ filename = kernel_string_n($u->rename->rn_sname,
+ $u->rename->rn_snamelen)
+ tlen = $u->rename->rn_tnamelen
+ tname = kernel_string_n($u->rename->rn_tname,
+ $u->rename->rn_tnamelen)
+ }
uid = __rqstp_uid($rqstp)
gid = __rqstp_gid($rqstp)
name = "nfsd.proc4.rename"
- argstr = sprintf("%s to %s",
- kernel_string_n($rename->rn_sname, $rename->rn_snamelen),
- kernel_string_n($rename->rn_tname, $rename->rn_tnamelen))
+ argstr = sprintf("%s to %s", filename, tname)
}
probe nfsd.proc4.rename.return =
diff --git a/tapset/linux/signal.stp b/tapset/linux/signal.stp
index 9a94bad..4f9f9f9 100644
--- a/tapset/linux/signal.stp
+++ b/tapset/linux/signal.stp
@@ -613,7 +613,11 @@ probe signal.pending = kernel.function("do_sigpending").call !,
{
name = "pending"
sigset_add=@choose_defined($set, $uset)
- sigset_size=$sigsetsize
+
+ # Note that this isn't 100% correct if $sigsetsize doesn't
+ # exist (in the case of newer do_sigpending() calls). Instead,
+ # we're returning the default size of a sigset_t.
+ sigset_size=@choose_defined($sigsetsize, @cast_sizeof("sigset_t"))
}
/**

View File

@ -72,16 +72,42 @@
%define dracutbindir %{_bindir}
%endif
# To avoid testsuite/*/*.stp has shebang which doesn't start with '/'
%undefine __brp_mangle_shebangs
Name: systemtap
Version: 3.2
Release: 3%{?dist}
Release: 11%{?dist}
# for version, see also configure.ac
Patch10: rhbz1504009.patch
Patch11: rhbz1544711.patch
# redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1546563
# upstream: https://sourceware.org/bugzilla/show_bug.cgi?id=22551
Patch11: rhbz1546563.patch
Patch12: rhbz1546563.patch
# Add a new kernel fallback unwinder.
# upstream: commit 553b6df07c9b7ab30ed468a6a4374cbdf73d1c0d
Patch13: unwind-fallback.patch
# And make the kernel DWARF unwinder work with ksalr.
# upstream: commit 17ee540dd61113fe4f557f191db3480db875cca1
Patch14: unwind-ksalr.patch
# Build-id mismatch with (re)inserted/removed kernel module probe
# redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1566422
# upstream: db9c9d6e30c6cfd7b85475b5c79ee2cc51201934
Patch15: rhbz1566422.patch
# systemtap depends on removed /bin/env
# redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1549063
# upstream: commit d6492e78bd50e923963e3c7aa235100a208f4775
Patch16: rhbz1549063.patch
# 4.15 kernel updates (__GFP_COLD undeclared)
# redhat: https://bugzilla.redhat.com/show_bug.cgi?id=1549063
# upstream: commit 0f8139eb4bd06a19714608b5f246fc24fcafde6e
Patch17: rhbz1566745.patch
# Packaging abstract:
#
@ -117,7 +143,6 @@ URL: http://sourceware.org/systemtap/
Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz
# Build*
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gcc-c++
BuildRequires: gettext-devel
BuildRequires: pkgconfig(nss)
@ -216,10 +241,7 @@ Group: Development/System
License: GPLv2+
URL: http://sourceware.org/systemtap/
Requires: systemtap-devel = %{version}-%{release}
# On RHEL[45], /bin/mktemp comes from the 'mktemp' package. On newer
# distributions, /bin/mktemp comes from the 'coreutils' package. To
# avoid a specific RHEL[45] Requires, we'll do a file-based require.
Requires: nss /bin/mktemp
Requires: nss coreutils
Requires: zip unzip
Requires(pre): shadow-utils
Requires(post): chkconfig
@ -486,6 +508,12 @@ cd ..
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%build
@ -710,9 +738,6 @@ done
touch $RPM_BUILD_ROOT%{dracutstap}/params.conf
%endif
%clean
rm -rf ${RPM_BUILD_ROOT}
%pre runtime
getent group stapusr >/dev/null || groupadd -g 156 -r stapusr 2>/dev/null || groupadd -r stapusr
getent group stapsys >/dev/null || groupadd -g 157 -r stapsys 2>/dev/null || groupadd -r stapsys
@ -1166,9 +1191,36 @@ done
# PRERELEASE
%changelog
* Thu Feb 22 2018 Sergey Avseyev <sergey.avseyev@gmail.com> - 3.2-3
* Thu Apr 19 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.2-11
- Add rhbz1549063.patch (/bin/env -> /usr/bin/env)
- Add rhbz1566745.patch (4.15 kernel tapset updates)
- Enable accidentially disabled Suggests: kernel-devel again.
* Wed Apr 18 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.2-10
- Add unwind-fallback.patch
- rhbz1566422.patch
* Tue Apr 17 2018 Mark Wielaard <mjw@fedoraproject.org> - 3.2-9
- Add unwind-fallback.patch.
* Tue Mar 27 2018 Björn Esser <besser82@fedoraproject.org> - 3.2-8
- Rebuilt for libjson-c.so.4 (json-c v0.13.1) on fc28
* Thu Feb 22 2018 Sergey Avseyev <sergey.avseyev@gmail.com> - 3.2-7
- rhbz1546563 (backport fix for removed timers in kernel 4.15)
* Tue Feb 13 2018 Stan Cox <scox@redhat.com> - 3.2-6
- rebuilt
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.2-5
- Escape macros in %%changelog
* Wed Feb 07 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.2-4
- Fix very old Requires
* Sun Dec 10 2017 Björn Esser <besser82@fedoraproject.org> - 3.2-3
- Rebuilt for libjson-c.so.3
* Fri Oct 20 2017 Frank Ch. Eigler <fche@redhat.com> - 3.2-2
- rhbz1504009 (dtrace -G -o /dev/null)
@ -1194,7 +1246,7 @@ done
- Upstream release.
* Mon Jul 07 2014 Josh Stone <jistone@redhat.com>
- Flip with_dyninst to an %ifarch whitelist.
- Flip with_dyninst to an %%ifarch whitelist.
* Wed Apr 30 2014 Jonathan Lebon <jlebon@redhat.com> - 2.5-1
- Upstream release.

249
unwind-fallback.patch Normal file
View File

@ -0,0 +1,249 @@
From 553b6df07c9b7ab30ed468a6a4374cbdf73d1c0d Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Tue, 17 Apr 2018 14:36:13 +0200
Subject: [PATCH] linux runtime: Add support for new kernel unwind fallback.
In newer kernels dump_trace got replaced by a new unwind infrastructure.
Add a new autoconf-unwind-stack-trace.c to detect whether we can use it.
Extend the runtime/stack.c _stp_stack_print_fallback with a new pt_regs*
argument. Update all callers and add dbug_unwind output to show which
fallback unwinder we are selecting (or if we are just giving up).
Rename the struct unwind_state in unwind.c and unwind.h to uw_state
because the old name now conflicts with the one used in the kernel.
---
buildrun.cxx | 2 ++
runtime/linux/autoconf-unwind-stack-trace.c | 16 +++++++++
runtime/stack.c | 50 ++++++++++++++++++++++++++---
runtime/unwind.c | 14 ++++----
runtime/unwind/unwind.h | 4 +--
5 files changed, 72 insertions(+), 14 deletions(-)
create mode 100644 runtime/linux/autoconf-unwind-stack-trace.c
diff --git a/buildrun.cxx b/buildrun.cxx
index 403fa71..59b9e88 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -365,6 +365,8 @@ compile_pass (systemtap_session& s)
"STAPCONF_KERNEL_STACKTRACE", NULL);
output_autoconf(s, o, "autoconf-save-stack-trace-no-bp.c",
"STAPCONF_KERNEL_STACKTRACE_NO_BP", NULL);
+ output_autoconf(s, o, "autoconf-unwind-stack-trace.c",
+ "STAPCONF_KERNEL_UNWIND_STACK", NULL);
output_autoconf(s, o, "autoconf-asm-syscall.c",
"STAPCONF_ASM_SYSCALL_H", NULL);
output_autoconf(s, o, "autoconf-ring_buffer-flags.c", "STAPCONF_RING_BUFFER_FLAGS", NULL);
diff --git a/runtime/linux/autoconf-unwind-stack-trace.c b/runtime/linux/autoconf-unwind-stack-trace.c
new file mode 100644
index 0000000..2ec399e
--- /dev/null
+++ b/runtime/linux/autoconf-unwind-stack-trace.c
@@ -0,0 +1,16 @@
+#include <linux/sched.h>
+#include <asm/unwind.h>
+
+void unwind_stack_trace (void)
+{
+ struct unwind_state state;
+ unwind_start (&state, current, 0, 0);
+ while (! unwind_done (&state))
+ {
+ unsigned long addr = unwind_get_return_address (&state);
+ if (addr == 0)
+ break;
+ unwind_next_frame (&state);
+ }
+}
+
diff --git a/runtime/stack.c b/runtime/stack.c
index c9d2c0c..43f98ef 100644
--- a/runtime/stack.c
+++ b/runtime/stack.c
@@ -43,7 +43,11 @@
#include <asm/stacktrace.h>
#endif
-static void _stp_stack_print_fallback(unsigned long, int, int, int);
+#if defined(STAPCONF_KERNEL_UNWIND_STACK)
+#include <asm/unwind.h>
+#endif
+
+static void _stp_stack_print_fallback(unsigned long, struct pt_regs*, int, int, int);
#ifdef STP_USE_DWARF_UNWINDER
#ifdef STAPCONF_LINUX_UACCESS_H
@@ -128,7 +132,7 @@ static const struct stacktrace_ops print_stack_ops = {
};
/* Used for kernel backtrace printing when other mechanisms fail. */
-static void _stp_stack_print_fallback(unsigned long stack,
+static void _stp_stack_print_fallback(unsigned long stack, struct pt_regs *regs,
int sym_flags, int levels, int skip)
{
struct print_stack_data print_data;
@@ -136,20 +140,55 @@ static void _stp_stack_print_fallback(unsigned long stack,
print_data.levels = levels;
print_data.skip = skip;
#if defined(STAPCONF_KERNEL_STACKTRACE)
+ dbug_unwind(1, "fallback kernel stacktrace\n");
dump_trace(current, NULL, (long *)stack, 0, &print_stack_ops,
&print_data);
#else
/* STAPCONF_KERNEL_STACKTRACE_NO_BP */
+ dbug_unwind(1, "fallback kernel stacktrace (no bp)\n");
dump_trace(current, NULL, (long *)stack, &print_stack_ops,
&print_data);
#endif
}
#else
-static void _stp_stack_print_fallback(unsigned long s, int v, int l, int k) {
+#if defined(STAPCONF_KERNEL_UNWIND_STACK)
+static void _stp_stack_print_fallback(unsigned long sp, struct pt_regs *regs,
+ int sym_flags,
+ int levels, int skip) {
+ struct unwind_state state;
+ unwind_start (&state, current, regs, (unsigned long *) sp);
+ dbug_unwind(1, "fallback kernel stacktrace (unwind)\n");
+ while (levels > 0 && ! unwind_done (&state))
+ {
+ if (skip == 0)
+ {
+ unsigned long addr = unwind_get_return_address (&state);
+ /* When we have frame pointers, the unwind addresses can be
+ (mostly) trusted, otherwise it is all guesswork. */
+#ifdef CONFIG_FRAME_POINTER
+ _stp_print_addr(addr, sym_flags, NULL);
+#else
+ _stp_print_addr(addr, sym_flags | _STP_SYM_INEXACT, NULL);
+#endif
+ if (addr == 0)
+ break;
+ levels--;
+ }
+ else
+ {
+ dbug_unwind(1, "skipping frame\n");
+ skip--;
+ }
+ unwind_next_frame(&state);
+ }
+}
+#else /* no new unwind */
+static void _stp_stack_print_fallback(unsigned long s, struct pt_regs *r, int v, int l, int k) {
/* Don't guess, just give up. */
+ dbug_unwind(1, "no fallback kernel stacktrace (giving up)\n");
_stp_print_addr(0, v | _STP_SYM_INEXACT, NULL);
}
-
+#endif /* new unwind */
#endif /* defined(STAPCONF_KERNEL_STACKTRACE) || defined(STAPCONF_KERNEL_STACKTRACE_NO_BP) */
@@ -382,6 +421,7 @@ static void _stp_stack_kernel_print(struct context *c, int sym_flags)
if (l == 0) {
remaining = MAXBACKTRACE - n;
_stp_stack_print_fallback(UNW_SP(&c->uwcontext_kernel.info),
+ &c->uwcontext_kernel.info.regs,
sym_flags, remaining, 0);
break;
} else {
@@ -408,7 +448,7 @@ static void _stp_stack_kernel_print(struct context *c, int sym_flags)
sp = 0;
skip = 5; /* yes, that many framework frames. */
#endif
- _stp_stack_print_fallback(sp, sym_flags,
+ _stp_stack_print_fallback(sp, NULL, sym_flags,
MAXBACKTRACE, skip);
#else
if (sym_flags & _STP_SYM_SYMBOL)
diff --git a/runtime/unwind.c b/runtime/unwind.c
index ec7cd58..3a2d991 100644
--- a/runtime/unwind.c
+++ b/runtime/unwind.c
@@ -235,7 +235,7 @@ static int parse_fde_cie(const u32 *fde, const u32 *cie,
#define REG_STATE state->reg[state->stackDepth]
-static int advance_loc(unsigned long delta, struct unwind_state *state)
+static int advance_loc(unsigned long delta, struct uw_state *state)
{
state->loc += delta * state->codeAlign;
dbug_unwind(1, "state->loc=%lx\n", state->loc);
@@ -244,7 +244,7 @@ static int advance_loc(unsigned long delta, struct unwind_state *state)
/* Set Same or Nowhere rule for register. */
static void set_no_state_rule(uleb128_t reg, enum item_location where,
- struct unwind_state *state)
+ struct uw_state *state)
{
dbug_unwind(1, "reg=%lx, where=%d\n", reg, where);
if (reg < ARRAY_SIZE(REG_STATE.regs)) {
@@ -254,7 +254,7 @@ static void set_no_state_rule(uleb128_t reg, enum item_location where,
/* Memory or Value rule */
static void set_offset_rule(uleb128_t reg, enum item_location where,
- sleb128_t svalue, struct unwind_state *state)
+ sleb128_t svalue, struct uw_state *state)
{
dbug_unwind(1, "reg=%lx, where=%d, svalue=%lx\n", reg, where, svalue);
if (reg < ARRAY_SIZE(REG_STATE.regs)) {
@@ -265,7 +265,7 @@ static void set_offset_rule(uleb128_t reg, enum item_location where,
/* Register rule. */
static void set_register_rule(uleb128_t reg, uleb128_t value,
- struct unwind_state *state)
+ struct uw_state *state)
{
dbug_unwind(1, "reg=%lx, value=%lx\n", reg, value);
if (reg < ARRAY_SIZE(REG_STATE.regs)) {
@@ -277,7 +277,7 @@ static void set_register_rule(uleb128_t reg, uleb128_t value,
/* Expr or ValExpr rule. */
static void set_expr_rule(uleb128_t reg, enum item_location where,
const u8 **expr, const u8 *end,
- struct unwind_state *state)
+ struct uw_state *state)
{
const u8 *const start = *expr;
uleb128_t len = get_uleb128(expr, end);
@@ -296,7 +296,7 @@ static void set_expr_rule(uleb128_t reg, enum item_location where,
#define MAX_CFI 512
static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
- signed ptrType, int user, struct unwind_state *state, int compat_task)
+ signed ptrType, int user, struct uw_state *state, int compat_task)
{
union {
const u8 *p8;
@@ -1169,7 +1169,7 @@ static int unwind_frame(struct unwind_context *context,
unsigned i;
signed ptrType = -1, call_frame = 1;
uleb128_t retAddrReg = 0;
- struct unwind_state *state = &context->state;
+ struct uw_state *state = &context->state;
unsigned long addr;
if (unlikely(table_len == 0)) {
diff --git a/runtime/unwind/unwind.h b/runtime/unwind/unwind.h
index 9d66732..b3ff786 100644
--- a/runtime/unwind/unwind.h
+++ b/runtime/unwind/unwind.h
@@ -492,7 +492,7 @@ struct unwind_reg_state {
unsigned cfa_is_expr:1;
};
-struct unwind_state {
+struct uw_state {
uleb128_t loc;
uleb128_t codeAlign;
sleb128_t dataAlign;
@@ -503,7 +503,7 @@ struct unwind_state {
struct unwind_context {
struct unwind_frame_info info;
- struct unwind_state state;
+ struct uw_state state;
};
static const struct cfa badCFA = { ARRAY_SIZE(reg_info), 1 };
--
1.8.3.1

32
unwind-ksalr.patch Normal file
View File

@ -0,0 +1,32 @@
commit 17ee540dd61113fe4f557f191db3480db875cca1
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Apr 18 15:00:24 2018 +0200
Make kernel DWARF unwinder work with ksalr.
The .debug_frame loaded from disk is already relocated against the
expected load offset of the kernel, but the actual static (load)
address might be different (with kaslr). So adjust the startLoc
for that difference when reading any address from the unwind table.
diff --git a/runtime/unwind.c b/runtime/unwind.c
index 3a2d991..4c360d2 100644
--- a/runtime/unwind.c
+++ b/runtime/unwind.c
@@ -724,10 +724,15 @@ adjustStartLoc (unsigned long startLoc,
dbug_unwind(2, "adjustStartLoc=%lx, ptrType=%s, m=%s, s=%s eh=%d\n",
startLoc, _stp_eh_enc_name(ptrType), m->path, s->name, is_ehframe);
if (startLoc == 0
- || strcmp (m->name, "kernel") == 0
|| (strcmp (s->name, ".absolute") == 0 && !is_ehframe))
return startLoc;
+ /* The .debug_frame loaded from disk is already relocated against the
+ expected load offset of the kernel, but the actual static (load)
+ address might be different (with kaslr). */
+ if (strcmp (m->name, "kernel") == 0)
+ return startLoc - s->sec_load_offset + s->static_addr;
+
/* eh_frame data has been loaded in the kernel, so readjust offset. */
if (is_ehframe) {
dbug_unwind(2, "eh_frame=%lx, eh_frame_addr=%lx\n", (unsigned long) m->eh_frame, m->eh_frame_addr);