Blame SOURCES/rhbz1898288.patch

958cb3
commit 34e62f15da5adf06361ac66489936d0ffa1cc430
958cb3
Author: Frank Ch. Eigler <fche@redhat.com>
958cb3
Date:   Tue Nov 10 22:13:53 2020 -0500
958cb3
958cb3
    RHBZ1892179: handle exhausted stp_task_work structs
958cb3
    
958cb3
    In utrace_report_syscall_entry and _exit, there is a possibility of
958cb3
    dereferencing a NULL pointer, in case __stp_utrace_alloc_task_work
958cb3
    exhausts UTRACE_TASK_WORK_POOL_SIZE live elements.  While OOM is
958cb3
    still a possibility, this patch handles it more gracefully.
958cb3
958cb3
diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c
958cb3
index 47355de..e2880f1 100644
958cb3
--- a/runtime/stp_utrace.c
958cb3
+++ b/runtime/stp_utrace.c
958cb3
@@ -2337,11 +2337,11 @@ static void utrace_report_syscall_entry(void *cb_data __attribute__ ((unused)),
958cb3
 
958cb3
 	/* Defer the report_syscall_entry work so it doesn't happen in atomic context: */
958cb3
 	work = __stp_utrace_alloc_task_work(utrace, NULL);
958cb3
-	__stp_utrace_save_regs(work, regs);
958cb3
 	if (work == NULL) {
958cb3
 		_stp_error("Unable to allocate space for task_work");
958cb3
 		return;
958cb3
 	}
958cb3
+	__stp_utrace_save_regs(work, regs);
958cb3
 	stp_init_task_work(work, &utrace_syscall_entry_work);
958cb3
 	rc = stp_task_work_add(task, work);
958cb3
 	// stp_task_work_add() returns -ESRCH if the task has already
958cb3
@@ -2444,11 +2444,11 @@ static void utrace_report_syscall_exit(void *cb_data __attribute__ ((unused)),
958cb3
 
958cb3
 	/* Defer the report_syscall_exit work so it doesn't happen in atomic context: */
958cb3
 	work = __stp_utrace_alloc_task_work(utrace, NULL);
958cb3
-	__stp_utrace_save_regs(work, regs);
958cb3
 	if (work == NULL) {
958cb3
 		_stp_error("Unable to allocate space for task_work");
958cb3
 		return;
958cb3
 	}
958cb3
+	__stp_utrace_save_regs(work, regs);
958cb3
 	stp_init_task_work(work, &utrace_syscall_exit_work);
958cb3
 	rc = stp_task_work_add(task, work);
958cb3
 	// stp_task_work_add() returns -ESRCH if the task has already
958cb3
958cb3
commit 83cb271b390a1b36abd4c3aa69f89c466e99e253
958cb3
Author: Frank Ch. Eigler <fche@redhat.com>
958cb3
Date:   Fri Nov 13 12:36:07 2020 -0500
958cb3
958cb3
    RHBZ1892179: double default UTRACE_TASK_WORKPOOL
958cb3
    
958cb3
    Some workloads were observed to exhaust the previous limit of 288.
958cb3
958cb3
diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c
958cb3
index 46ba489..6022267 100644
958cb3
--- a/runtime/stp_utrace.c
958cb3
+++ b/runtime/stp_utrace.c
958cb3
@@ -141,7 +141,7 @@ struct __stp_utrace_task_work { /* NB: about 216 bytes, 18 per page: */
958cb3
    TODO: UTRACE_TASK_WORK_POOL_SIZE can be specified on the Systemtap
958cb3
    command line. Experiment to find the best default value. */
958cb3
 #ifndef UTRACE_TASK_WORK_POOL_SIZE
958cb3
-#define UTRACE_TASK_WORK_POOL_SIZE 288
958cb3
+#define UTRACE_TASK_WORK_POOL_SIZE 576
958cb3
 #endif
958cb3
 static DECLARE_BITMAP(__stp_utrace_task_work_pool_bitmap, UTRACE_TASK_WORK_POOL_SIZE);
958cb3
 static struct __stp_utrace_task_work __stp_utrace_task_work_pool[UTRACE_TASK_WORK_POOL_SIZE];