Resolves: RHEL-42605

This commit is contained in:
Martin Cermak 2024-06-18 09:41:25 +02:00
parent 3d014b677f
commit c87b8351f3
2 changed files with 177 additions and 1 deletions

View File

@ -73,3 +73,176 @@ index ab16249e1..add36c30d 100644
static void *_stp_vzalloc_node(size_t size, int node)
{
void *ret;
commit 1fd6fb4d7101e013e21006da3b77b9723be5b446
Author: William Cohen <wcohen@redhat.com>
Date: Mon Jun 3 15:46:49 2024 -0400
Avoid -Werror=empty-body errors from runtime/linux/uprobes-inode.c
Newer linux kernel compiles are being built with -Werror=empty-body.
For some modules generated runtime/linux/uprobes-inode.c is pulled in
and will get error messages like the following:
In file included from /tmp/stapGIM4O9/stap_ded21c54fce18c6570a8930d823aca3a_10928_src.c:2439:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/uprobes-inode.c: In function 'stapiu_change_semaphore_plus':
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/uprobes-inode.c:795:5: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
795 | ; // already unlocked
| ^
cc1: all warnings being treated as errors
Added "{}" in the appropriate location to indicate to the compiler
that this is intentional.
diff --git a/runtime/linux/uprobes-inode.c b/runtime/linux/uprobes-inode.c
index b07e7b666..103da09dd 100644
--- a/runtime/linux/uprobes-inode.c
+++ b/runtime/linux/uprobes-inode.c
@@ -792,7 +792,7 @@ stapiu_change_semaphore_plus(struct stapiu_consumer* c, struct task_struct *task
if (! any_found)
spin_unlock_irqrestore(&c->process_list_lock, flags);
else
- ; // already unlocked
+ {}; // already unlocked
return rc;
}
commit de8aba9a414b497d98c489173b878058c4031b39
Author: William Cohen <wcohen@redhat.com>
Date: Mon Jun 3 14:40:04 2024 -0400
Avoid -Werror=old-style-declaration for stap_probes array in generated kernel modules
With newer linux kernels additional compilers checks are being done
and will get error messages like the following for the generated
module:
/tmp/stapuundLy/stap_2755fca707746de04395c85872aae4b8_1753_src.c:111:1: error: 'static' is not at beginning of declaration [-Werror=old-style-declaration]
111 | } static stap_probes[];
| ^
cc1: all warnings being treated as errors
Tweaked the code generation in translate.cxx to output the static
stap_probes array in a form that is agreeable to newer kernel builds.
diff --git a/translate.cxx b/translate.cxx
index 19c165a1d..8fb320e66 100644
--- a/translate.cxx
+++ b/translate.cxx
@@ -8748,7 +8748,8 @@ translate_pass (systemtap_session& s)
<< "STAP_PROBE_INIT_NAME(PN) "
<< "STAP_PROBE_INIT_TIMING(L, D) "
<< "}";
- s.op->newline(-1) << "} static stap_probes[];";
+ s.op->newline(-1) << "};";
+ s.op->newline() << "static struct stap_probe stap_probes[];";
s.op->assert_0_indent();
#undef CALCIT
commit da72d04303cfc3ba22b2bb58a26f8dc7868333eb
Author: William Cohen <wcohen@redhat.com>
Date: Mon Jun 3 14:23:08 2024 -0400
Avoid -Werror=empty-body errors from runtime/linux/debug.h macros
When attempting to run the testsuite the sanity.exp test fails
due to the following -Werror=empty-body errors:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/transport/relay_v2.c: In function '__stp_relay_wakeup_timer':
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/debug.h:47:36: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
47 | #define dbug_trans(level, args...) ;
| ^
/home/wcohen/systemtap_write/install/share/systemtap/runtime/transport/relay_v2.c:195:17: note: in expansion of macro 'dbug_trans'
195 | dbug_trans(0, "relay_v2 wakeup timer expiry\n");
| ^~~~~~~~~~
/home/wcohen/systemtap_write/install/share/systemtap/runtime/transport/symbols.c: In function '_stp_set_stext':
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/debug.h:103:34: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
103 | #define dbug_sym(level, args...) ;
| ^
/home/wcohen/systemtap_write/install/share/systemtap/runtime/transport/symbols.c:44:17: note: in expansion of macro 'dbug_sym'
44 | dbug_sym(1, "found kernel _stext load address: 0x%lx\n",
| ^~~~~~~~
Changed the effectively empty macros in runtime/linux/debug.h to use
"do { } while (0)" to eliminate these errors.
diff --git a/runtime/linux/debug.h b/runtime/linux/debug.h
index d2ab9e8db..dfc834dbb 100644
--- a/runtime/linux/debug.h
+++ b/runtime/linux/debug.h
@@ -44,8 +44,8 @@
printk(args); \
} while (0)
#else
-#define dbug_trans(level, args...) ;
-#define dbug_trans2(args...) ;
+#define dbug_trans(level, args...) do { } while (0)
+#define dbug_trans2(args...) do { } while (0)
#endif
#ifdef DEBUG_STP_ON_THE_FLY
@@ -53,7 +53,7 @@
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#else
-#define dbug_otf(args...) ;
+#define dbug_otf(args...) do { } while (0)
#endif
#ifdef DEBUG_UPROBES
@@ -61,7 +61,7 @@
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#else
-#define dbug_uprobes(args...) ;
+#define dbug_uprobes(args...) do { } while (0)
#endif
#ifdef DEBUG_UNWIND /* stack unwinder */
@@ -70,7 +70,7 @@
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#else
-#define dbug_unwind(level, args...) ;
+#define dbug_unwind(level, args...) do { } while (0)
#endif
@@ -80,7 +80,7 @@
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#else
-#define dbug_task(level, args...) ;
+#define dbug_task(level, args...) do { } while (0)
#endif
@@ -90,7 +90,7 @@
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#else
-#define dbug_task_vma(level, args...) ;
+#define dbug_task_vma(level, args...) do { } while (0)
#endif
@@ -100,7 +100,7 @@
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#else
-#define dbug_sym(level, args...) ;
+#define dbug_sym(level, args...) do { } while (0)
#endif
@@ -110,7 +110,7 @@
_stp_dbug(__FUNCTION__, __LINE__, args); \
} while (0)
#else
-#define dbug_tp(level, args...) ;
+#define dbug_tp(level, args...) do { } while (0)
#endif
#endif /* _STP_LINUX_DEBUG_H_ */

View File

@ -121,7 +121,7 @@ m stapdev stapdev
Name: systemtap
# PRERELEASE
Version: 5.1
Release: 4%{?release_override}%{?dist}
Release: 5%{?release_override}%{?dist}
# for version, see also configure.ac
@ -1318,6 +1318,9 @@ exit 0
# PRERELEASE
%changelog
* Tue Jun 18 2024 Martin Cermak <mcermak@redhat.com> - 5.1-5
- RHEL-42605 add upstream commits 1fd6fb4d, de8aba9a, da72d043
* Mon Jun 17 2024 Martin Cermak <mcermak@redhat.com> - 5.1-4
- RHEL-42605