Re: WARNING: ODEBUG bug in get_signal

From: Oleg Nesterov
Date: Thu Aug 27 2020 - 11:20:53 EST


On 08/27, syzbot wrote:
>
> __debug_check_no_obj_freed lib/debugobjects.c:967 [inline]
> debug_check_no_obj_freed+0x301/0x41c lib/debugobjects.c:998
> kmem_cache_free.part.0+0x16d/0x1f0 mm/slab.c:3692
> task_work_run+0xdd/0x190 kernel/task_work.c:141

I don't understand this trace, work->func(work) can call kmem_cache_free()
but task_work_run() doesn't do this.

In theory the patch below makes sense anyway, but I have no idea if it can
explain the problem.

Oleg.

--- x/kernel/task_work.c
+++ x/kernel/task_work.c
@@ -137,7 +137,7 @@ void task_work_run(void)
raw_spin_unlock_irq(&task->pi_lock);

do {
- next = work->next;
+ next = READ_ONCE(work->next);
work->func(work);
work = next;
cond_resched();