commit 0c437c7e2d02772615d73d1be1c3100d4c1de254 Author: William Cohen Date: Tue Jun 4 09:46:41 2024 -0400 Address changes in Linux 6.10 /include/linux/vmalloc.h Upstream linux kernel git commit 88ae5fb755b0d contains a number of changes in /include/linux/vmalloc.h that affect vmalloc, vmalloc_node, and vzalloc_node definitions. These are no longer functions but macros and cannot be found in the list of symbols exported by the kernel. Support for vzalloc, vmalloc_node, and vzalloc_node has been in kernels since Linux 2.6.37. Given that systemtap requires Linux 3.10 or newer there is no longer a need to check for the existence of these functions or provide local versions of them. diff --git a/buildrun.cxx b/buildrun.cxx index 8ee8c391f..a7fcd6297 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -510,9 +510,6 @@ compile_pass (systemtap_session& s) output_autoconf(s, o, cs, "autoconf-kallsyms_6_4.c", "STAPCONF_KALLSYMS_6_4", NULL); output_autoconf(s, o, cs, "autoconf-uidgid.c", "STAPCONF_LINUX_UIDGID_H", NULL); output_exportconf(s, o2, "sigset_from_compat", "STAPCONF_SIGSET_FROM_COMPAT_EXPORTED"); - output_exportconf(s, o2, "vzalloc", "STAPCONF_VZALLOC"); - output_exportconf(s, o2, "vzalloc_node", "STAPCONF_VZALLOC_NODE"); - output_exportconf(s, o2, "vmalloc_node", "STAPCONF_VMALLOC_NODE"); // RHBZ1233912 - s390 temporary workaround for non-atomic udelay() output_exportconf(s, o2, "udelay_simple", "STAPCONF_UDELAY_SIMPLE_EXPORTED"); diff --git a/runtime/linux/alloc.c b/runtime/linux/alloc.c index ab16249e1..add36c30d 100644 --- a/runtime/linux/alloc.c +++ b/runtime/linux/alloc.c @@ -404,16 +404,6 @@ static void *_stp_kzalloc(size_t size) return _stp_kzalloc_gfp(size, STP_ALLOC_FLAGS); } -#ifndef STAPCONF_VZALLOC -static void *vzalloc(unsigned long size) -{ - void *ret = vmalloc(size); - if (ret) - memset(ret, 0, size); - return ret; -} -#endif - static void *_stp_vzalloc(size_t size) { void *ret; @@ -438,24 +428,6 @@ static void *_stp_vzalloc(size_t size) return ret; } - -#ifndef STAPCONF_VMALLOC_NODE -static void *vmalloc_node(unsigned long size, int node __attribute__((unused))) -{ - return vmalloc(size); -} -#endif - -#ifndef STAPCONF_VZALLOC_NODE -static void *vzalloc_node(unsigned long size, int node) -{ - void *ret = vmalloc_node(size, node); - if (ret) - memset(ret, 0, size); - return ret; -} -#endif - static void *_stp_vzalloc_node(size_t size, int node) { void *ret; commit 1fd6fb4d7101e013e21006da3b77b9723be5b446 Author: William Cohen 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 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 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_ */