Message ID | 20230830110402.386898-2-joel@joelfernandes.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] mm/vmalloc: Add a safer version of find_vm_area() for debug | expand |
On Wed, 30 Aug 2023 11:04:00 +0000 "Joel Fernandes (Google)" <joel@joelfernandes.org> wrote: > Currently, for double invoke call_rcu(), will dump rcu_head objects > memory info, if the objects is not allocated from the slab allocator, > the vmalloc_dump_obj() will be invoke and the vmap_area_lock spinlock > need to be held, since the call_rcu() can be invoked in interrupt context, > therefore, there is a possibility of spinlock deadlock scenarios. > > And in Preempt-RT kernel, the rcutorture test also trigger the following > lockdep warning: "possibility of deadlock" sounds like something -stable kernels would like to have fixed. Did you consider the desirability of a -stable backport? If so, are we able to identify a suitable Fixes: target?
On Sat, Sep 2, 2023 at 9:28 PM Andrew Morton <akpm@linux-foundation.org> wrote: > > On Wed, 30 Aug 2023 11:04:00 +0000 "Joel Fernandes (Google)" <joel@joelfernandes.org> wrote: > > > Currently, for double invoke call_rcu(), will dump rcu_head objects > > memory info, if the objects is not allocated from the slab allocator, > > the vmalloc_dump_obj() will be invoke and the vmap_area_lock spinlock > > need to be held, since the call_rcu() can be invoked in interrupt context, > > therefore, there is a possibility of spinlock deadlock scenarios. > > > > And in Preempt-RT kernel, the rcutorture test also trigger the following > > lockdep warning: > > "possibility of deadlock" sounds like something -stable kernels would > like to have fixed. > > Did you consider the desirability of a -stable backport? > > If so, are we able to identify a suitable Fixes: target? Good point, it should be: Fixes: 98f180837a89 ("mm: Make mem_dump_obj() handle vmalloc() memory") I am currently reworking the patch as Vlad was also concerned about (the existing) issue of accessing vm_struct fields without holding the lock [1]. I will add this fixes tag to both patches for the v3 on the respin. Thanks! - Joel
On Sat, Sep 2, 2023 at 10:03 PM Joel Fernandes <joel@joelfernandes.org> wrote: > > On Sat, Sep 2, 2023 at 9:28 PM Andrew Morton <akpm@linux-foundation.org> wrote: > > > > On Wed, 30 Aug 2023 11:04:00 +0000 "Joel Fernandes (Google)" <joel@joelfernandes.org> wrote: > > > > > Currently, for double invoke call_rcu(), will dump rcu_head objects > > > memory info, if the objects is not allocated from the slab allocator, > > > the vmalloc_dump_obj() will be invoke and the vmap_area_lock spinlock > > > need to be held, since the call_rcu() can be invoked in interrupt context, > > > therefore, there is a possibility of spinlock deadlock scenarios. > > > > > > And in Preempt-RT kernel, the rcutorture test also trigger the following > > > lockdep warning: > > > > "possibility of deadlock" sounds like something -stable kernels would > > like to have fixed. > > > > Did you consider the desirability of a -stable backport? > > > > If so, are we able to identify a suitable Fixes: target? > > Good point, it should be: > Fixes: 98f180837a89 ("mm: Make mem_dump_obj() handle vmalloc() memory") > > I am currently reworking the patch as Vlad was also concerned about > (the existing) issue of accessing vm_struct fields without holding the > lock [1]. > > I will add this fixes tag to both patches for the v3 on the respin. > Sigh, I missed sharing the link to [1]: [1] https://lore.kernel.org/all/20230901003321.GA3389909@google.com/ thanks, - Joel
diff --git a/mm/util.c b/mm/util.c index dd12b9531ac4..406634f26918 100644 --- a/mm/util.c +++ b/mm/util.c @@ -1071,7 +1071,9 @@ void mem_dump_obj(void *object) if (vmalloc_dump_obj(object)) return; - if (virt_addr_valid(object)) + if (is_vmalloc_addr(object)) + type = "vmalloc memory"; + else if (virt_addr_valid(object)) type = "non-slab/vmalloc memory"; else if (object == NULL) type = "NULL pointer";