Dominique Leuenberger 2022-03-05 13:42:53 +00:00 committed by Git OBS Bridge
commit a297538fa5
11 changed files with 243 additions and 0 deletions

View File

@ -0,0 +1,44 @@
From: "Frank Ch. Eigler" <fche@redhat.com>
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 <tonyj@suse.de>
---
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 = "<NULL>";
- 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 = "<NULL>";
- len = strnlen(ptr, precision);
+ len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE));
}
else if (precision > 0)
len = precision;

View File

@ -0,0 +1,30 @@
From: "Frank Ch. Eigler" <fche@redhat.com>
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 <tonyj@suse.de>
---
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;

View File

@ -0,0 +1,53 @@
From: Serhei Makarov <serhei@serhei.io>
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 <tonyj@suse.de>
---
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)

View File

@ -0,0 +1,38 @@
From: Jonathan Wakely <jwakely.gcc@gmail.com>
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 <tonyj@suse.de>
---
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<int, int>(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<int, int>(std::isspace))).base(), s.end());
+ [](unsigned char c) { return !std::isspace(c); }).base(), s.end());
}
// trim from both ends (in place)

View File

@ -0,0 +1,33 @@
From: "Frank Ch. Eigler" <fche@redhat.com>
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 <tonyj@suse.de>
---
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;

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Mar 2 19:19:36 UTC 2022 - Tony Jones <tonyj@suse.com>
- 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 <schwab@suse.de>

View File

@ -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

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Mar 2 19:19:36 UTC 2022 - Tony Jones <tonyj@suse.com>
- 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 <schwab@suse.de>

View File

@ -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

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Mar 2 19:19:36 UTC 2022 - Tony Jones <tonyj@suse.com>
- 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 <schwab@suse.de>

View File

@ -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