systemtap/rhbz1985124.patch
2021-08-12 23:09:42 -04:00

855 lines
27 KiB
Diff

commit 7c2751e37f97e95d77898d68b7c08cbf1be7f7d9
Author: Sultan Alsawaf <sultan@openresty.com>
Date: Mon Jul 12 15:31:36 2021 -0500
task_finder_vma: add autoconf check for hlist_add_tail_rcu()
The 3.10 version check for hlist_add_tail_rcu() only works for RHEL
kernels. Kernels older than 4.7 that lack the hlist_add_tail_rcu() backport
won't compile (such as Debian kernels). Add an autoconf stub to know for
certain if hlist_add_tail_rcu() is present.
diff --git a/buildrun.cxx b/buildrun.cxx
index ba3daa0a0..0c244db72 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -520,6 +520,8 @@ compile_pass (systemtap_session& s)
"STAPCONF_ATOMIC_FETCH_ADD_UNLESS", NULL);
output_autoconf(s, o, cs, "autoconf-lockdown-debugfs.c", "STAPCONF_LOCKDOWN_DEBUGFS", NULL);
output_autoconf(s, o, cs, "autoconf-lockdown-kernel.c", "STAPCONF_LOCKDOWN_KERNEL", NULL);
+ output_autoconf(s, o, cs, "autoconf-hlist_add_tail_rcu.c",
+ "STAPCONF_HLIST_ADD_TAIL_RCU", NULL);
// used by runtime/linux/netfilter.c
output_exportconf(s, o2, "nf_register_hook", "STAPCONF_NF_REGISTER_HOOK");
diff --git a/runtime/linux/autoconf-hlist_add_tail_rcu.c b/runtime/linux/autoconf-hlist_add_tail_rcu.c
new file mode 100644
index 000000000..2c4660837
--- /dev/null
+++ b/runtime/linux/autoconf-hlist_add_tail_rcu.c
@@ -0,0 +1,6 @@
+#include <linux/rculist.h>
+
+void foo(struct hlist_node *n, struct hlist_head *h)
+{
+ hlist_add_tail_rcu(n, h);
+}
commit ef5a8b9eda402e4e96c4e3ce01e7ff95d3e10470
Author: Du Zhe <duzhe0211+sourceware@gmail.com>
Date: Tue Jul 13 19:11:55 2021 -0400
runtime: fix unintended compile error with autoconf-x86-uniregs.c
Adding a #include <linux/sched.h> restores this test on the gentoo
linux-5.10.47-gentoo kernel.
diff --git a/runtime/linux/autoconf-x86-uniregs.c b/runtime/linux/autoconf-x86-uniregs.c
index 25729c220..232c18670 100644
--- a/runtime/linux/autoconf-x86-uniregs.c
+++ b/runtime/linux/autoconf-x86-uniregs.c
@@ -1,3 +1,4 @@
+#include <linux/sched.h>
#include <asm/ptrace.h>
#if defined (__i386__) || defined (__x86_64__)
commit 968173f7fb97675de94c8ca47e6b6898b1117a1d
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Tue Jul 13 19:34:50 2021 -0400
runtime: linux 5.14 compat: <linux/panic_notifier.h>
Linux commit f39650de687e3 moved some kernel decls around.
diff --git a/buildrun.cxx b/buildrun.cxx
index 0c244db72..a1332a687 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -383,7 +383,8 @@ compile_pass (systemtap_session& s)
output_exportconf(s, o2, "cpu_khz", "STAPCONF_CPU_KHZ");
output_exportconf(s, o2, "__module_text_address", "STAPCONF_MODULE_TEXT_ADDRESS");
output_exportconf(s, o2, "add_timer_on", "STAPCONF_ADD_TIMER_ON");
-
+ output_autoconf(s, o, cs, "autoconf-514-panic.c", "STAPCONF_514_PANIC", NULL);
+
output_dual_exportconf(s, o2, "probe_kernel_read", "probe_kernel_write", "STAPCONF_PROBE_KERNEL");
output_autoconf(s, o, cs, "autoconf-hw_breakpoint_context.c",
"STAPCONF_HW_BREAKPOINT_CONTEXT", NULL);
diff --git a/runtime/linux/autoconf-514-panic.c b/runtime/linux/autoconf-514-panic.c
new file mode 100644
index 000000000..57b1a0026
--- /dev/null
+++ b/runtime/linux/autoconf-514-panic.c
@@ -0,0 +1,3 @@
+#include <linux/panic_notifier.h>
+
+void* c = & panic_notifier_list;
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index 32ef99da6..9b9d6cbe2 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -24,6 +24,9 @@
#ifdef STAPCONF_LOCKDOWN_DEBUGFS
#include <linux/security.h>
#endif
+#ifdef STAPCONF_514_PANIC
+#include <linux/panic_notifier.h>
+#endif
#include "../uidgid_compatibility.h"
static int _stp_exit_flag = 0;
commit a29f65d5750f6379afeca99c5d641598ff638517
Author: Stan Cox <scox@redhat.com>
Date: Sun Jul 18 21:32:51 2021 -0400
PR28079: Adapt to kernel 5.14 task_struct.__state change
Use signal_wake_up_state for the 5.14 kernel which changed volatile long state to unsigned int __state.
diff --git a/buildrun.cxx b/buildrun.cxx
index a1332a687..ae27ddea4 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -523,6 +523,7 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, cs, "autoconf-lockdown-kernel.c", "STAPCONF_LOCKDOWN_KERNEL", NULL);
output_autoconf(s, o, cs, "autoconf-hlist_add_tail_rcu.c",
"STAPCONF_HLIST_ADD_TAIL_RCU", NULL);
+ output_autoconf(s, o, cs, "autoconf-task-state.c", "STAPCONF_TASK_STATE", NULL);
// used by runtime/linux/netfilter.c
output_exportconf(s, o2, "nf_register_hook", "STAPCONF_NF_REGISTER_HOOK");
diff --git a/runtime/linux/autoconf-task-state.c b/runtime/linux/autoconf-task-state.c
new file mode 100644
index 000000000..27a1d7c13
--- /dev/null
+++ b/runtime/linux/autoconf-task-state.c
@@ -0,0 +1,18 @@
+/*
+ * Is this a kernel prior to the following kernel commit:
+ *
+ * commit 2f064a59a11ff9bc22e52e9678bc601404c7cb34
+ * Author: Peter Zijlstra <peterz@infradead.org>
+ * Date: 2021-06-11 10:28:17 +0200
+ *
+ * sched: Change task_struct::state
+ * Change the type and name of task_struct::state. Drop the volatile and
+ * shrink it to an 'unsigned int'. Rename it in order to find all uses
+ * such that we can use READ_ONCE/WRITE_ONCE as appropriate.
+ */
+
+#include <linux/sched.h>
+
+unsigned int bar (struct task_struct *foo) {
+ return (foo->state = 0);
+}
diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c
index ff8c5549d..d63e6366c 100644
--- a/runtime/stp_utrace.c
+++ b/runtime/stp_utrace.c
@@ -33,9 +33,12 @@
#if defined(__set_task_state)
#define __stp_set_task_state(tsk, state_value) \
__set_task_state((tsk), (state_value))
-#else
+#elif defined(STAPCONF_TASK_STATE)
#define __stp_set_task_state(tsk, state_value) \
do { (tsk)->state = (state_value); } while (0)
+#else
+#define __stp_set_task_state(tsk, state_value) \
+ signal_wake_up_state((tsk), (state_value))
#endif
// For now, disable the task_work_queue on non-RT kernels.
@@ -1263,7 +1266,7 @@ static void utrace_wakeup(struct task_struct *target, struct utrace *utrace)
spin_lock_irq(&target->sighand->siglock);
if (target->signal->flags & SIGNAL_STOP_STOPPED ||
target->signal->group_stop_count)
- target->state = TASK_STOPPED;
+ __stp_set_task_state(target, TASK_STOPPED);
else
stp_wake_up_state(target, __TASK_TRACED);
spin_unlock_irq(&target->sighand->siglock);
commit ffb0a38ea0ded9561233ffcb2d9b52a46ddf70ed
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Thu Jul 22 19:16:12 2021 -0400
runtime: adapt to -Werror=implicit-fallthrough=5
Linux kbuild commit d936eb23874 sets $subject CFLAGS, so to play
catch-up, we also need to use gcc attribute(fallthrough) to label such
spots in switch() statements in our runtime / tapset. Tested on
linux5.14 gcc11 rawhide and linux3.10 gcc4 rhel7.
diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h
index 035f0bd97..e57d10a8a 100644
--- a/runtime/linux/runtime.h
+++ b/runtime/linux/runtime.h
@@ -65,6 +65,22 @@
static void *kallsyms_copy_to_kernel_nofault;
#endif
+
+/* A fallthrough; macro to let the runtime survive -Wimplicit-fallthrough=5 */
+/* from <linux/compiler_attribute.h> */
+#ifndef fallthrough
+#if __GNUC__ < 5
+# define fallthrough do {} while (0) /* fallthrough */
+#else
+#if __has_attribute(__fallthrough__)
+# define fallthrough __attribute__((__fallthrough__))
+#else
+# define fallthrough do {} while (0) /* fallthrough */
+#endif
+#endif
+#endif
+
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23)
#include <linux/user_namespace.h>
#endif
diff --git a/runtime/map-gen.c b/runtime/map-gen.c
index aeeab38bf..47317d61f 100644
--- a/runtime/map-gen.c
+++ b/runtime/map-gen.c
@@ -112,9 +112,9 @@
k1 = 0; \
switch(mylen & 3) { \
case 3: k1 ^= tail[2] << 16; \
- /* fallthrough */ \
+ fallthrough; \
case 2: k1 ^= tail[1] << 8; \
- /* fallthrough */ \
+ fallthrough; \
case 1: k1 ^= tail[0]; \
k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; \
} \
diff --git a/runtime/syscall.h b/runtime/syscall.h
index 6b4b3071a..f5b473b04 100644
--- a/runtime/syscall.h
+++ b/runtime/syscall.h
@@ -351,23 +351,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
case 0:
if (!n--) break;
*args++ = regs->bx;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->cx;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->dx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->si;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->di;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->bp;
@@ -375,23 +375,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
case 0:
if (!n--) break;
*args++ = regs->rbx;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->rcx;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->rdx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->rsi;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->rdi;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->rbp;
@@ -405,23 +405,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
case 0:
if (!n--) break;
*args++ = regs->di;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->si;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->dx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->r10;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->r8;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->r9;
@@ -429,23 +429,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
case 0:
if (!n--) break;
*args++ = regs->rdi;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->rsi;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->rdx;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->r10;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->r8;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->r9;
@@ -575,30 +575,30 @@ static inline void _stp_syscall_get_arguments(struct task_struct *task,
case 6:
if (!n--) break;
*args++ = regs->r13;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->r15;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->r14;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->r10;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->r9;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->r11;
- /* fallthrough */
+ fallthrough;
case 0:
if (!n--) break;
- /* fallthrough */
+ fallthrough;
default:
BUG();
break;
@@ -630,23 +630,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
case 0:
if (!n--) break;
*args++ = regs->orig_gpr2 & mask;
- /* fallthrough */
+ fallthrough;
case 1:
if (!n--) break;
*args++ = regs->gprs[3] & mask;
- /* fallthrough */
+ fallthrough;
case 2:
if (!n--) break;
*args++ = regs->gprs[4] & mask;
- /* fallthrough */
+ fallthrough;
case 3:
if (!n--) break;
*args++ = regs->gprs[5] & mask;
- /* fallthrough */
+ fallthrough;
case 4:
if (!n--) break;
*args++ = regs->gprs[6] & mask;
- /* fallthrough */
+ fallthrough;
case 5:
if (!n--) break;
*args++ = regs->args[0] & mask;
diff --git a/runtime/unwind.c b/runtime/unwind.c
index dba16a724..6916d2e96 100644
--- a/runtime/unwind.c
+++ b/runtime/unwind.c
@@ -527,7 +527,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
REG_STATE.cfa.reg = value;
dbug_unwind(1, "DW_CFA_def_cfa reg=%ld\n", REG_STATE.cfa.reg);
}
- /* fallthrough */
+ fallthrough;
case DW_CFA_def_cfa_offset:
if (REG_STATE.cfa_is_expr != 0) {
_stp_warn("Unexpected DW_CFA_def_cfa_offset\n");
@@ -549,7 +549,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc,
value, DWARF_REG_MAP(value));
REG_STATE.cfa.reg = value;
}
- /* fallthrough */
+ fallthrough;
case DW_CFA_def_cfa_offset_sf:
if (REG_STATE.cfa_is_expr != 0) {
_stp_warn("Unexpected DW_CFA_def_cfa_offset_sf\n");
@@ -922,7 +922,7 @@ static int compute_expr(const u8 *expr, struct unwind_frame_info *frame,
case DW_OP_bra:
if (POP == 0)
break;
- /* Fall through. */
+ fallthrough;
case DW_OP_skip:
NEED(sizeof(u.s16));
memcpy(&u.s16, expr, sizeof(u.s16));
diff --git a/runtime/unwind/unwind.h b/runtime/unwind/unwind.h
index a9586a338..5c68a5f03 100644
--- a/runtime/unwind/unwind.h
+++ b/runtime/unwind/unwind.h
@@ -154,13 +154,13 @@ static unsigned long read_ptr_sect(const u8 **pLoc, const void *end,
value = _stp_get_unaligned(ptr.p32u++);
break;
}
- /* fallthrough */
+ fallthrough;
case DW_EH_PE_data8:
BUILD_BUG_ON(sizeof(u64) != sizeof(value));
#else
BUILD_BUG_ON(sizeof(u32) != sizeof(value));
#endif
- /* fallthrough */
+ fallthrough;
case DW_EH_PE_absptr:
if (compat_task)
{
diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c
index 417d9f7f3..cd31a938b 100644
--- a/runtime/vsprintf.c
+++ b/runtime/vsprintf.c
@@ -641,7 +641,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
case 'X':
flags |= STP_LARGE;
- /* fallthru */
+ fallthrough;
case 'x':
base = 16;
break;
@@ -649,7 +649,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
case 'd':
case 'i':
flags |= STP_SIGN;
- /* fallthru */
+ fallthrough;
case 'u':
break;
@@ -835,7 +835,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
case 'X':
flags |= STP_LARGE;
- /* fallthru */
+ fallthrough;
case 'x':
base = 16;
break;
@@ -843,7 +843,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
case 'd':
case 'i':
flags |= STP_SIGN;
- /* fallthru */
+ fallthrough;
case 'u':
break;
diff --git a/tapset/linux/aux_syscalls.stp b/tapset/linux/aux_syscalls.stp
index ad8a89898..09fb9ff41 100644
--- a/tapset/linux/aux_syscalls.stp
+++ b/tapset/linux/aux_syscalls.stp
@@ -156,11 +156,11 @@ sigset_from_compat(sigset_t *set, compat_sigset_t *compat)
{
switch (_NSIG_WORDS) {
case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 );
- /*fallthrough*/
+ fallthrough;
case 3: set->sig[2] = compat->sig[4] | (((long)compat->sig[5]) << 32 );
- /*fallthrough*/
+ fallthrough;
case 2: set->sig[1] = compat->sig[2] | (((long)compat->sig[3]) << 32 );
- /*fallthrough*/
+ fallthrough;
case 1: set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 );
}
}
@@ -3627,13 +3627,13 @@ function _struct_sigaction32_u:string(uaddr:long)
{
case 4: act.sa_mask.sig[3] = act32.sa_mask.sig[6]
| (((long)act32.sa_mask.sig[7]) << 32);
- /* fallthrough */
+ fallthrough;
case 3: act.sa_mask.sig[2] = act32.sa_mask.sig[4]
| (((long)act32.sa_mask.sig[5]) << 32);
- /* fallthrough */
+ fallthrough;
case 2: act.sa_mask.sig[1] = act32.sa_mask.sig[2]
| (((long)act32.sa_mask.sig[3]) << 32);
- /* fallthrough */
+ fallthrough;
case 1: act.sa_mask.sig[0] = act32.sa_mask.sig[0]
| (((long)act32.sa_mask.sig[1]) << 32);
}
commit ea00c10704bfc64b908ef96e4b9574dadeae2b03
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Sun Jul 25 22:09:18 2021 -0400
PR28140: kernel 5.14-rc adaptation, jump_label_patch
Linux commit ab3257042c2 makes it necessary for us to stop overriding
CONFIG_STACK_VALIDATION= (originally a workaround for a 2016 rawhide
bug). This fixes the tracepoints.stp test case.
diff --git a/buildrun.cxx b/buildrun.cxx
index ae27ddea4..6a6725db6 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -120,7 +120,13 @@ make_any_make_cmd(systemtap_session& s, const string& dir, const string& target)
"CONFIG_DEBUG_INFO_BTF_MODULES=",
// RHBZ1321628: suppress stack validation; expected to be temporary
- "CONFIG_STACK_VALIDATION=",
+ // "CONFIG_STACK_VALIDATION=",
+
+ // PR28140 ... as of kernel 5.14-rc*, this is actively
+ // dangerous, because it skips the full objtool processing
+ // chain, and the resulting tracepoint call sites in the ko are
+ // not properly instrumented. See also Linux commit
+ // ab3257042c2.
};
// PR10280: suppress symbol versioning to restrict to exact kernel version
commit e66f3a83b49b5c0a35074cf0f4b378e51c241a81
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Sun Jul 25 22:35:59 2021 -0400
runtime: adapt to -Werror=implicit-fallthrough=5, dyninst runtime
The runtime/dyninst/runtime.h also needs a fallthrough macro def'n.
diff --git a/runtime/dyninst/runtime.h b/runtime/dyninst/runtime.h
index 9e61ef50b..6f028e27d 100644
--- a/runtime/dyninst/runtime.h
+++ b/runtime/dyninst/runtime.h
@@ -389,4 +389,20 @@ static void stp_dyninst_dtor(void)
_stp_copy_destroy();
}
+
+/* A fallthrough; macro to let the runtime survive -Wimplicit-fallthrough=5 */
+/* from <linux/compiler_attribute.h> */
+#ifndef fallthrough
+#if __GNUC__ < 5
+# define fallthrough do {} while (0) /* fallthrough */
+#else
+#if __has_attribute(__fallthrough__)
+# define fallthrough __attribute__((__fallthrough__))
+#else
+# define fallthrough do {} while (0) /* fallthrough */
+#endif
+#endif
+#endif
+
+
#endif /* _STAPDYN_RUNTIME_H_ */
commit b47d03c20aeab5276b67adbe367889c7762c4a92
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Sun Jul 18 21:32:51 2021 -0400
PR28079: Adapt to kernel 5.14 task_struct.__state change
In tapset, use @choose_defined() for old & new field names.
diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp
index b542b610e..40dc3e2e0 100644
--- a/tapset/linux/task.stp
+++ b/tapset/linux/task.stp
@@ -186,7 +186,7 @@ function task_parent:long(task:long)
*/
function task_state:long (task:long)
{
- return @task(task)->state
+ return @choose_defined(@task(task)->state,@task(task)->__state)
}
/**
commit 559fd51fe90ef096c4389f90604ec808869b58a6
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Fri Aug 6 12:16:21 2021 -0400
testsuite: time-limit auxiliary child processes
The testsuite has been observed to intermittently hang on 5.13+
generation kernels. This is caused by some test binaries (especially
recv*.c) suffering a segv and terminating, but their forked child
process pals still hanging around (indefinitely). This patch adds an
alarm(30) to each such test, so the children will burn twice as
bright, but half as long, or something.
diff --git a/testsuite/systemtap.syscall/connect.c b/testsuite/systemtap.syscall/connect.c
index a9350025d..f2239dd80 100644
--- a/testsuite/systemtap.syscall/connect.c
+++ b/testsuite/systemtap.syscall/connect.c
@@ -73,7 +73,8 @@ start_server(struct sockaddr_in *sin0)
switch (pid = fork()) {
case 0: /* child */
- do_child();
+ alarm(30);
+ do_child();
break;
case -1: /* fall through */
default: /* parent */
diff --git a/testsuite/systemtap.syscall/futex.c b/testsuite/systemtap.syscall/futex.c
index 4740e1c82..fe740a146 100644
--- a/testsuite/systemtap.syscall/futex.c
+++ b/testsuite/systemtap.syscall/futex.c
@@ -38,7 +38,8 @@ int main()
pid = fork();
if (pid == 0) { /* child */
- do_child();
+ alarm(30);
+ do_child();
exit(0);
}
diff --git a/testsuite/systemtap.syscall/process_vm.c b/testsuite/systemtap.syscall/process_vm.c
index 4c4ffe4a9..b776354ac 100644
--- a/testsuite/systemtap.syscall/process_vm.c
+++ b/testsuite/systemtap.syscall/process_vm.c
@@ -31,7 +31,8 @@ int main()
pid = fork();
if (pid == 0) { /* child */
- do_child();
+ alarm(30);
+ do_child();
return 0;
}
diff --git a/testsuite/systemtap.syscall/ptrace.c b/testsuite/systemtap.syscall/ptrace.c
index 533414799..8d8418d34 100644
--- a/testsuite/systemtap.syscall/ptrace.c
+++ b/testsuite/systemtap.syscall/ptrace.c
@@ -93,6 +93,7 @@ int main()
child_pid = fork();
if (child_pid == 0) {
/* Child */
+ alarm(30);
do_child();
exit(0);
}
diff --git a/testsuite/systemtap.syscall/recv.c b/testsuite/systemtap.syscall/recv.c
index 9635b269e..b5ccf08d6 100644
--- a/testsuite/systemtap.syscall/recv.c
+++ b/testsuite/systemtap.syscall/recv.c
@@ -76,6 +76,7 @@ start_server(struct sockaddr_in *sin0)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
diff --git a/testsuite/systemtap.syscall/recvfrom.c b/testsuite/systemtap.syscall/recvfrom.c
index eeb567c78..0b5d20c20 100644
--- a/testsuite/systemtap.syscall/recvfrom.c
+++ b/testsuite/systemtap.syscall/recvfrom.c
@@ -77,6 +77,7 @@ start_server(struct sockaddr_in *sin0)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
diff --git a/testsuite/systemtap.syscall/recvmmsg.c b/testsuite/systemtap.syscall/recvmmsg.c
index 0b925d0d7..edf12e388 100644
--- a/testsuite/systemtap.syscall/recvmmsg.c
+++ b/testsuite/systemtap.syscall/recvmmsg.c
@@ -123,6 +123,7 @@ start_server(struct sockaddr_in *ssin, struct sockaddr_un *ssun)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
diff --git a/testsuite/systemtap.syscall/recvmsg.c b/testsuite/systemtap.syscall/recvmsg.c
index 1d32e7482..7f72ae573 100644
--- a/testsuite/systemtap.syscall/recvmsg.c
+++ b/testsuite/systemtap.syscall/recvmsg.c
@@ -122,6 +122,7 @@ start_server(struct sockaddr_in *ssin, struct sockaddr_un *ssun)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
diff --git a/testsuite/systemtap.syscall/send.c b/testsuite/systemtap.syscall/send.c
index 12bcf12a2..970f9347c 100644
--- a/testsuite/systemtap.syscall/send.c
+++ b/testsuite/systemtap.syscall/send.c
@@ -75,6 +75,7 @@ start_server(struct sockaddr_in *sin0)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
diff --git a/testsuite/systemtap.syscall/sendmmsg.c b/testsuite/systemtap.syscall/sendmmsg.c
index 3b0a74959..95ce65470 100644
--- a/testsuite/systemtap.syscall/sendmmsg.c
+++ b/testsuite/systemtap.syscall/sendmmsg.c
@@ -87,6 +87,7 @@ start_server(struct sockaddr_in *sin0)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
diff --git a/testsuite/systemtap.syscall/sendmsg.c b/testsuite/systemtap.syscall/sendmsg.c
index 6bcb4e358..db07eb7b4 100644
--- a/testsuite/systemtap.syscall/sendmsg.c
+++ b/testsuite/systemtap.syscall/sendmsg.c
@@ -75,6 +75,7 @@ start_server(struct sockaddr_in *sin0)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
diff --git a/testsuite/systemtap.syscall/sendto.c b/testsuite/systemtap.syscall/sendto.c
index 44a8a5c0a..c3441bc22 100644
--- a/testsuite/systemtap.syscall/sendto.c
+++ b/testsuite/systemtap.syscall/sendto.c
@@ -75,6 +75,7 @@ start_server(struct sockaddr_in *sin0)
switch (pid = fork()) {
case 0: /* child */
+ alarm(30);
do_child();
break;
case -1: /* fall through */
commit 0581a6560a4922a92cef70348303012682a8a436
Author: Junlong Li <zhuizhuhaomeng@gmail.com>
Date: Fri Aug 6 14:24:12 2021 -0400
PR28184: Adapt to kernel rename __fcheck_files to files_lookup_fd_raw
The 5.11 kernel renamed __fcheck_files to files_lookup_fd_raw
diff --git a/runtime/linux/autoconf-files_lookup_fd_raw.c b/runtime/linux/autoconf-files_lookup_fd_raw.c
new file mode 100644
index 000000000..9e98aa064
--- /dev/null
+++ b/runtime/linux/autoconf-files_lookup_fd_raw.c
@@ -0,0 +1,9 @@
+#include <linux/fdtable.h>
+#include <linux/file.h>
+
+void
+foo(void)
+{
+ struct file *filp = files_lookup_fd_raw(NULL, 0);
+ (void) filp;
+}
commit f2c1477678ecc2b03b55e21c31747004e2c78717
Author: Junlong Li <zhuizhuhaomeng@gmail.com>
Date: Fri Aug 6 17:41:53 2021 -0400
PR28184: Adapt to kernel rename __fcheck_files to files_lookup_fd_raw
The 5.11 kernel renamed __fcheck_files to files_lookup_fd_raw
diff --git a/buildrun.cxx b/buildrun.cxx
index 6a6725db6..a7090c448 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -529,6 +529,8 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, cs, "autoconf-lockdown-kernel.c", "STAPCONF_LOCKDOWN_KERNEL", NULL);
output_autoconf(s, o, cs, "autoconf-hlist_add_tail_rcu.c",
"STAPCONF_HLIST_ADD_TAIL_RCU", NULL);
+ output_autoconf(s, o, cs, "autoconf-files_lookup_fd_raw.c",
+ "STAPCONF_FILES_LOOKUP_FD_RAW", NULL);
output_autoconf(s, o, cs, "autoconf-task-state.c", "STAPCONF_TASK_STATE", NULL);
// used by runtime/linux/netfilter.c
diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp
index 40dc3e2e0..d47462513 100644
--- a/tapset/linux/task.stp
+++ b/tapset/linux/task.stp
@@ -706,7 +706,11 @@ function task_fd_lookup:long(task:long, fd:long)
(void)kderef_buffer(NULL, files, sizeof(struct files_struct));
spin_lock(&files->file_lock);
+#ifdef STAPCONF_FILES_LOOKUP_FD_RAW
+ file = files_lookup_fd_raw(files, fd);
+#else
file = fcheck_files(files, fd);
+#endif
spin_unlock(&files->file_lock);
}