On Wed, Apr 03, 2019 at 04:35:52PM -0700, Bart Van Assche wrote:
> Commit a0b0fd53e1e6 ("locking/lockdep: Free lock classes that are no longer
> in use") changed the behavior of lockdep_free_key_range() from
> unconditionally zapping lock classes into only zapping lock classes if
> debug_lock == true. Not zapping lock classes if debug_lock == false leaves
> dangling pointers in several lockdep datastructures, e.g. lock_class::name
> in the all_lock_classes list. The shell command "cat /proc/lockdep" causes
> the kernel to iterate the all_lock_classes list. Hence the "unable to
> handle kernel paging request" issue that Shenghui encountered by running
> cat /proc/lockdep. Since the new behavior can cause cat /proc/lockdep to
> crash, restore the pre-v5.1 behavior.
> 
> This patch avoids that cat /proc/lockdep triggers the following crash
> with debug_lock == false:
> 
> BUG: unable to handle kernel paging request at fffffbfff40ca448
> PGD 13bfde067 P4D 13bfde067 PUD 13bf7a067 PMD 1167d3067 PTE 0
> Oops: 0000 [#1] PREEMPT SMP KASAN
> CPU: 4 PID: 4529 Comm: cat Tainted: G    B   W  O      5.1.0-rc1-dbg+ #4
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 
> 04/01/2014
> RIP: 0010:__asan_load1+0x28/0x50
> Call Trace:
>  string+0xac/0x180
>  vsnprintf+0x23e/0x820
>  seq_vprintf+0x82/0xc0
>  seq_printf+0x92/0xb0
>  print_name+0x34/0xb0
>  l_show+0x184/0x200
>  seq_read+0x59e/0x6c0
>  proc_reg_read+0x11f/0x170
>  __vfs_read+0x4d/0x90
>  vfs_read+0xc5/0x1f0
>  ksys_read+0xab/0x130
>  __x64_sys_read+0x43/0x50
>  do_syscall_64+0x71/0x210
>  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> 
> Cc: Thomas Gleixner <[email protected]>
> Cc: Will Deacon <[email protected]>
> Cc: Waiman Long <[email protected]>
> Cc: shenghui <[email protected]>
> Reported-by: shenghui <[email protected]>
> Fixes: a0b0fd53e1e6 ("locking/lockdep: Free lock classes that are no longer 
> in use") # v5.1-rc1.
> Signed-off-by: Bart Van Assche <[email protected]>

Thanks!

Reply via email to