Blame SOURCES/rhbz1898288.patch

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