Re: [PATCH 3/4] locking/lockdep: Reduce space occupied by stack traces

From: Eric Biggers
Date: Wed Jul 24 2019 - 00:56:14 EST


On Mon, Jul 22, 2019 at 11:24:42AM -0700, Bart Van Assche wrote:
> Although commit 669de8bda87b ("kernel/workqueue: Use dynamic lockdep keys
> for workqueues") unregisters dynamic lockdep keys when a workqueue is
> destroyed, a side effect of that commit is that all stack traces
> associated with the lockdep key are leaked when a workqueue is destroyed.
> Fix this by storing each unique stack trace once. Other changes in this
> patch are:
> - Use NULL instead of { .nr_entries = 0 } to represent 'no trace'.
> - Store a pointer to a stack trace in struct lock_class and struct
> lock_list instead of storing 'nr_entries' and 'offset'.
>
> This patch avoids that the following program triggers the "BUG:
> MAX_STACK_TRACE_ENTRIES too low!" complaint:


Does this also fix any of the other bugs listed at
https://lore.kernel.org/lkml/20190710055838.GC2152@xxxxxxxxxxxxxxx/
?

BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!
BUG: MAX_LOCKDEP_CHAINS too low!
BUG: MAX_LOCK_DEPTH too low! (2)
BUG: MAX_LOCKDEP_ENTRIES too low!

>
> #include <fcntl.h>
> #include <unistd.h>
>
> int main()
> {
> for (;;) {
> int fd = open("/dev/infiniband/rdma_cm", O_RDWR);
> close(fd);
> }
> }
>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Will Deacon <will.deacon@xxxxxxx>
> Cc: Yuyang Du <duyuyang@xxxxxxxxx>
> Cc: Waiman Long <longman@xxxxxxxxxx>
> Reported-by: Eric Biggers <ebiggers@xxxxxxxxxx>

Can you please add:

Reported-by: syzbot+6f39a9deb697359fe520@xxxxxxxxxxxxxxxxxxxxxxxxx

Thanks,

- Eric