From: Greg Kroah-Hartman Date: Mon, 8 May 2023 08:12:02 +0000 (+0200) Subject: 5.15-stable patches X-Git-Tag: v5.15.111~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14af8b87f4f8ad97e6d758addfa8779daff1ef47;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: debugobject-ensure-pool-refill-again.patch --- diff --git a/queue-5.15/debugobject-ensure-pool-refill-again.patch b/queue-5.15/debugobject-ensure-pool-refill-again.patch new file mode 100644 index 00000000000..8678692b6ed --- /dev/null +++ b/queue-5.15/debugobject-ensure-pool-refill-again.patch @@ -0,0 +1,85 @@ +From 0af462f19e635ad522f28981238334620881badc Mon Sep 17 00:00:00 2001 +From: Thomas Gleixner +Date: Mon, 1 May 2023 17:42:06 +0200 +Subject: debugobject: Ensure pool refill (again) + +From: Thomas Gleixner + +commit 0af462f19e635ad522f28981238334620881badc upstream. + +The recent fix to ensure atomicity of lookup and allocation inadvertently +broke the pool refill mechanism. + +Prior to that change debug_objects_activate() and debug_objecs_assert_init() +invoked debug_objecs_init() to set up the tracking object for statically +initialized objects. That's not longer the case and debug_objecs_init() is +now the only place which does pool refills. + +Depending on the number of statically initialized objects this can be +enough to actually deplete the pool, which was observed by Ido via a +debugobjects OOM warning. + +Restore the old behaviour by adding explicit refill opportunities to +debug_objects_activate() and debug_objecs_assert_init(). + +Fixes: 63a759694eed ("debugobject: Prevent init race with static objects") +Reported-by: Ido Schimmel +Signed-off-by: Thomas Gleixner +Tested-by: Ido Schimmel +Link: https://lore.kernel.org/r/871qk05a9d.ffs@tglx +Signed-off-by: Greg Kroah-Hartman +--- + lib/debugobjects.c | 21 +++++++++++++++------ + 1 file changed, 15 insertions(+), 6 deletions(-) + +--- a/lib/debugobjects.c ++++ b/lib/debugobjects.c +@@ -590,6 +590,16 @@ static struct debug_obj *lookup_object_o + return NULL; + } + ++static void debug_objects_fill_pool(void) ++{ ++ /* ++ * On RT enabled kernels the pool refill must happen in preemptible ++ * context: ++ */ ++ if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) ++ fill_pool(); ++} ++ + static void + __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack) + { +@@ -598,12 +608,7 @@ __debug_object_init(void *addr, const st + struct debug_obj *obj; + unsigned long flags; + +- /* +- * On RT enabled kernels the pool refill must happen in preemptible +- * context: +- */ +- if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible()) +- fill_pool(); ++ debug_objects_fill_pool(); + + db = get_bucket((unsigned long) addr); + +@@ -688,6 +693,8 @@ int debug_object_activate(void *addr, co + if (!debug_objects_enabled) + return 0; + ++ debug_objects_fill_pool(); ++ + db = get_bucket((unsigned long) addr); + + raw_spin_lock_irqsave(&db->lock, flags); +@@ -897,6 +904,8 @@ void debug_object_assert_init(void *addr + if (!debug_objects_enabled) + return; + ++ debug_objects_fill_pool(); ++ + db = get_bucket((unsigned long) addr); + + raw_spin_lock_irqsave(&db->lock, flags); diff --git a/queue-5.15/series b/queue-5.15/series index 2a03b529a0f..dd0d697b398 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -376,3 +376,4 @@ dm-ioctl-fix-nested-locking-in-table_clear-to-remove-deadlock-concern.patch dm-don-t-lock-fs-when-the-map-is-null-in-process-of-resume.patch perf-auxtrace-fix-address-filter-entire-kernel-size.patch perf-intel-pt-fix-cyc-timestamps-after-standalone-cbr.patch +debugobject-ensure-pool-refill-again.patch