Blame SOURCES/rhbz1898288.patch

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