History

Merge tag 'core-debugobjects-2023-05-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull debugobjects fix from Thomas Gleixner: "A single fix for debugobjects: The recent fix to ensure atomicity of lookup and allocation inadvertently broke the pool refill mechanism, so that debugobject OOMs now in certain situations. The reason is that the functions which got updated no longer invoke debug_objecs_init(), which is now the only place to care about refilling the tracking object pool. Restore the original behaviour by adding explicit refill opportunities to those places" * tag 'core-debugobjects-2023-05-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: debugobject: Ensure pool refill (again)

Linus Torvalds committed 3 years ago

Commit 17784de2 parents 6f69c98 0af462f1 file · +15 −6Browse files

Showing the changes to lib (1 of 1 file). Show all

Unified · Split

lib/debugobjects.c+15−6
@@ -587,6 +587,16 @@ static struct debug_obj *lookup_object_or_alloc(void *addr, struct debug_bucket · 586 unmodified lines
587587 return NULL;
588588 }
589589
590+static void debug_objects_fill_pool(void)
591+{
592+ /*
593+ * On RT enabled kernels the pool refill must happen in preemptible
594+ * context:
595+ */
596+ if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
597+ fill_pool();
598+}
599+
590600 static void
591601 __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack)
592602 {
@@ -595,12 +605,7 @@ __debug_object_init(void *addr, const struct debug_obj_descr *descr, int onstack · 2 unmodified lines
595605 struct debug_obj *obj;
596606 unsigned long flags;
597607
598− /*
599− * On RT enabled kernels the pool refill must happen in preemptible
600− * context:
601− */
602− if (!IS_ENABLED(CONFIG_PREEMPT_RT) || preemptible())
603− fill_pool();
608+ debug_objects_fill_pool();
604609
605610 db = get_bucket((unsigned long) addr);
606611
@@ -685,6 +690,8 @@ int debug_object_activate(void *addr, const struct debug_obj_descr *descr) · 78 unmodified lines
685690 if (!debug_objects_enabled)
686691 return 0;
687692
693+ debug_objects_fill_pool();
694+
688695 db = get_bucket((unsigned long) addr);
689696
690697 raw_spin_lock_irqsave(&db->lock, flags);
@@ -894,6 +901,8 @@ void debug_object_assert_init(void *addr, const struct debug_obj_descr *descr) · 203 unmodified lines
894901 if (!debug_objects_enabled)
895902 return;
896903
904+ debug_objects_fill_pool();
905+
897906 db = get_bucket((unsigned long) addr);
898907
899908 raw_spin_lock_irqsave(&db->lock, flags);