diff --git a/PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch b/PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch new file mode 100644 index 0000000..1341ea9 --- /dev/null +++ b/PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch @@ -0,0 +1,44 @@ +From: "Frank Ch. Eigler" +Date: Thu, 13 Jan 2022 18:33:15 -0500 +Subject: PR28778: gcc warning tweak for sprintf precision parameter +Git-repo: git://sourceware.org/git/systemtap.git +Git-commit: b0422e9e5a539164af75cddcaeb01bceca56bf12 +References: bsc#1196583 + +A precision=-1 sentinel value got interpreted as UINT_MAX in a +context, leading to diagnostics like: + +/usr/share/systemtap/runtime/vsprintf.c:341:23: error: 'strnlen' specified bound 4294967295 may exceed maximum object size 2147483647 [-Werror=stringop-overread] + +Adding a clamp_t() around the parameter field to keep it limited to +STP_BUFFER_SIZE (8K by default), which is apprx. the limit for a +single printf. + +Signed-off-by: Tony Jones +--- + runtime/vsprintf.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c +index cd31a938b..606f685e8 100644 +--- a/runtime/vsprintf.c ++++ b/runtime/vsprintf.c +@@ -338,7 +338,7 @@ _stp_vsprint_memory(char * str, char * end, const char * ptr, + if (format == 's') { + if ((unsigned long)ptr < PAGE_SIZE) + ptr = ""; +- len = strnlen(ptr, precision); ++ len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE)); + } + else if (precision > 0) + len = precision; +@@ -410,7 +410,7 @@ _stp_vsprint_memory_size(const char * ptr, int width, int precision, + if (format == 's') { + if ((unsigned long)ptr < PAGE_SIZE) + ptr = ""; +- len = strnlen(ptr, precision); ++ len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE)); + } + else if (precision > 0) + len = precision; + diff --git a/buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch b/buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch new file mode 100644 index 0000000..5f42028 --- /dev/null +++ b/buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch @@ -0,0 +1,30 @@ +From: "Frank Ch. Eigler" +Date: Mon, 7 Feb 2022 13:59:54 -0500 +Subject: buildrun: for LKM backend, add -Wno-infinite-recursion +Git-repo: git://sourceware.org/git/systemtap.git +Git-commit: 9295f6046518dc15678032ac54abb8a4e2916f33 +References: bsc#1196583 + +On GCC12 / fedora rawhide, this diagnostic is currently generating +false positives w.r.t. a few memcpy type functions. + +Signed-off-by: Tony Jones +--- + buildrun.cxx | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/buildrun.cxx b/buildrun.cxx +index 2a18fe3b7..ecaeedaac 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -601,6 +601,9 @@ compile_pass (systemtap_session& s) + // Accept extra diagnostic-suppression pragmas etc. + o << "EXTRA_CFLAGS += -Wno-pragmas" << endl; + ++ // Suppress gcc12 diagnostic bug in kernel-devel for 5.16ish ++ o << "EXTRA_CFLAGS += -Wno-infinite-recursion" << endl; ++ + // PR25845: Recent gcc (seen on 9.3.1) warns fairly common 32-bit pointer-conversions: + o << "EXTRA_CFLAGS += $(call cc-option,-Wno-pointer-to-int-cast)" << endl; + o << "EXTRA_CFLAGS += $(call cc-option,-Wno-int-to-pointer-cast)" << endl; + diff --git a/gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch b/gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch new file mode 100644 index 0000000..78a235d --- /dev/null +++ b/gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch @@ -0,0 +1,53 @@ +From: Serhei Makarov +Date: Fri, 21 Jan 2022 18:21:46 -0500 +Subject: gcc12 c++ compatibility re-tweak for rhel6: use function pointer + instead of lambdas instead of ptr_fun<> +Git-repo: git://sourceware.org/git/systemtap.git +Git-commit: f199d1982ef8a6c6d5c06c082d057b8793bcc6aa +References: bsc#1196583 + +Saving 2 lines in ltrim/rtrim is probably not a good reason to drop +compatibility with the RHEL6 system compiler. Actually declaring a +named function and passing the function pointer is compatible with +everything. + +Signed-off-by: Tony Jones +--- + util.cxx | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/util.cxx b/util.cxx +index e9286eca3..ad36259c9 100644 +--- a/util.cxx ++++ b/util.cxx +@@ -1757,21 +1757,24 @@ flush_to_stream (const string &fname, ostream &o) + return 1; // Failure + } + ++int ++not_isspace(unsigned char c) ++{ ++ return !std::isspace(c); ++} ++ + // trim from start (in place) + void + ltrim(std::string &s) + { +- s.erase(s.begin(), +- std::find_if(s.begin(), s.end(), +- [](unsigned char c) { return !std::isspace(c); })); ++ s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_isspace)); + } + + // trim from end (in place) + void + rtrim(std::string &s) + { +- s.erase(std::find_if(s.rbegin(), s.rend(), +- [](unsigned char c) { return !std::isspace(c); }).base(), s.end()); ++ s.erase(std::find_if(s.rbegin(), s.rend(), not_isspace).base(), s.end()); + } + + // trim from both ends (in place) + diff --git a/gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch b/gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch new file mode 100644 index 0000000..845c472 --- /dev/null +++ b/gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch @@ -0,0 +1,38 @@ +From: Jonathan Wakely +Date: Tue, 18 Jan 2022 15:52:18 -0500 +Subject: gcc12 c++ compatibility tweak: use lambdas instead of ptr_fun<> +Git-repo: git://sourceware.org/git/systemtap.git +Git-commit: 56c498d95c4749f15980da73b4933e7443b3f26c +References: bsc#1196583 + +Even while stap is a c++11 code base, such cleanups make code +nicer to look at. + +Signed-off-by: Tony Jones +--- + util.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/util.cxx b/util.cxx +index c20f76003..e9286eca3 100644 +--- a/util.cxx ++++ b/util.cxx +@@ -1763,7 +1763,7 @@ ltrim(std::string &s) + { + s.erase(s.begin(), + std::find_if(s.begin(), s.end(), +- std::not1(std::ptr_fun(std::isspace)))); ++ [](unsigned char c) { return !std::isspace(c); })); + } + + // trim from end (in place) +@@ -1771,7 +1771,7 @@ void + rtrim(std::string &s) + { + s.erase(std::find_if(s.rbegin(), s.rend(), +- std::not1(std::ptr_fun(std::isspace))).base(), s.end()); ++ [](unsigned char c) { return !std::isspace(c); }).base(), s.end()); + } + + // trim from both ends (in place) + diff --git a/gcc12-warning-suppression.patch b/gcc12-warning-suppression.patch new file mode 100644 index 0000000..7eabce9 --- /dev/null +++ b/gcc12-warning-suppression.patch @@ -0,0 +1,33 @@ +From: "Frank Ch. Eigler" +Date: Thu, 24 Feb 2022 20:05:41 -0500 +Subject: gcc12 warning suppression +Git-repo: git://sourceware.org/git/systemtap.git +Git-commit: 1549784e9c71e5bf80860d314e15e6019f899de4 +References: bsc#1196583 + +The translator emits a pair of type declarations that alternate +between a char[] and a char*, depending on the size of strings +involved. The polymorphic client code includes pointer null-checking, +which -Waddress code rejects for the char[] case. The simplest +workaround is just to disable that particular diagnostic. + +Signed-off-by: Tony Jones +--- + buildrun.cxx | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/buildrun.cxx b/buildrun.cxx +index 70ccfc30e..492f6bc47 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -604,6 +604,9 @@ compile_pass (systemtap_session& s) + + // Suppress gcc12 diagnostic bug in kernel-devel for 5.16ish + o << "EXTRA_CFLAGS += -Wno-infinite-recursion" << endl; ++ ++ // Suppress gcc12 diagnostic about STAP_KPROBE_PROBE_STR_* null checks ++ o << "EXTRA_CFLAGS += -Wno-address" << endl; + + // PR25845: Recent gcc (seen on 9.3.1) warns fairly common 32-bit pointer-conversions: + o << "EXTRA_CFLAGS += $(call cc-option,-Wno-pointer-to-int-cast)" << endl; + diff --git a/systemtap-dtrace.changes b/systemtap-dtrace.changes index d887273..b4aec93 100644 --- a/systemtap-dtrace.changes +++ b/systemtap-dtrace.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Mar 2 19:19:36 UTC 2022 - Tony Jones + +- Add gcc12 support (bsc#1196583) + New patch: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch + New patch: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch + New patch: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch + New patch: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch + New patch: gcc12-warning-suppression.patch + ------------------------------------------------------------------- Mon Feb 21 10:56:37 UTC 2022 - Andreas Schwab diff --git a/systemtap-dtrace.spec b/systemtap-dtrace.spec index 9af3dee..76a714a 100644 --- a/systemtap-dtrace.spec +++ b/systemtap-dtrace.spec @@ -36,6 +36,11 @@ Patch2: sys-sdt.h-fp-constraints-arm32.patch Patch3: sys-sdt.h-fp-constraints-x86_64.patch Patch4: sys-sdt.h-fp-constraints-aarch64-s390.patch Patch5: Handle-user-supplied-sdt-probe-argument-template.patch +Patch6: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch +Patch7: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch +Patch8: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch +Patch9: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch +Patch10: gcc12-warning-suppression.patch BuildArch: noarch diff --git a/systemtap-headers.changes b/systemtap-headers.changes index 91c4b8e..45df255 100644 --- a/systemtap-headers.changes +++ b/systemtap-headers.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Mar 2 19:19:36 UTC 2022 - Tony Jones + +- Add gcc12 support (bsc#1196583) + New patch: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch + New patch: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch + New patch: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch + New patch: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch + New patch: gcc12-warning-suppression.patch + ------------------------------------------------------------------- Mon Feb 21 10:56:37 UTC 2022 - Andreas Schwab diff --git a/systemtap-headers.spec b/systemtap-headers.spec index d35ce07..144b995 100644 --- a/systemtap-headers.spec +++ b/systemtap-headers.spec @@ -41,6 +41,11 @@ Patch2: sys-sdt.h-fp-constraints-arm32.patch Patch3: sys-sdt.h-fp-constraints-x86_64.patch Patch4: sys-sdt.h-fp-constraints-aarch64-s390.patch Patch5: Handle-user-supplied-sdt-probe-argument-template.patch +Patch6: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch +Patch7: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch +Patch8: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch +Patch9: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch +Patch10: gcc12-warning-suppression.patch # sdt-devel provides the same header files as us, so we # must conflict diff --git a/systemtap.changes b/systemtap.changes index 3bf7544..b72bf4c 100644 --- a/systemtap.changes +++ b/systemtap.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Wed Mar 2 19:19:36 UTC 2022 - Tony Jones + +- Add gcc12 support (bsc#1196583) + New patch: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch + New patch: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch + New patch: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch + New patch: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch + New patch: gcc12-warning-suppression.patch + ------------------------------------------------------------------- Mon Feb 21 10:56:37 UTC 2022 - Andreas Schwab diff --git a/systemtap.spec b/systemtap.spec index 6800851..0860df9 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -37,6 +37,11 @@ Patch2: sys-sdt.h-fp-constraints-arm32.patch Patch3: sys-sdt.h-fp-constraints-x86_64.patch Patch4: sys-sdt.h-fp-constraints-aarch64-s390.patch Patch5: Handle-user-supplied-sdt-probe-argument-template.patch +Patch6: PR28778-gcc-warning-tweak-for-sprintf-precision-parameter.patch +Patch7: gcc12-c-compatibility-tweak-use-lambdas-instead-of-ptr_fun.patch +Patch8: gcc12-c-compatibility-re-tweak-for-rhel6-use-function-pointer-instead-of-lambdas-instead-of-ptr_fun.patch +Patch9: buildrun-for-LKM-backend-add-Wno-infinite-recursion.patch +Patch10: gcc12-warning-suppression.patch BuildRequires: autoconf BuildRequires: automake