linux/tools/lib/lockdep
Ben Hutchings d0e24a66ea tools/lib/lockdep: Reduce MAX_LOCK_DEPTH to avoid overflowing lock_chain/: Depth
commit 98dcea0cfd upstream.

liblockdep has been broken since commit 75dd602a51 ("lockdep: Fix
lock_chain::base size"), as that adds a check that MAX_LOCK_DEPTH is
within the range of lock_chain::depth and in liblockdep it is much
too large.

That should have resulted in a compiler error, but didn't because:

- the check uses ARRAY_SIZE(), which isn't yet defined in liblockdep
  so is assumed to be an (undeclared) function
- putting a function call inside a BUILD_BUG_ON() expression quietly
  turns it into some nonsense involving a variable-length array

It did produce a compiler warning, but I didn't notice because
liblockdep already produces too many warnings if -Wall is enabled
(which I'll fix shortly).

Even before that commit, which reduced lock_chain::depth from 8 bits
to 6, MAX_LOCK_DEPTH was too large.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: a.p.zijlstra@chello.nl
Link: http://lkml.kernel.org/r/20170525130005.5947-3-alexander.levin@verizon.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
History 2017-10-12 15:27:44 +01:00
..
include/liblockdep tools/liblockdep: Account for bitfield changes in lockdeps lock_acquire 2014-07-07 12:20:16 -04:00
tests liblockdep: Add pthread_rwlock_t test suite 2013-11-27 11:55:24 +01:00
uinclude tools/lib/lockdep: Reduce MAX_LOCK_DEPTH to avoid overflowing lock_chain/: Depth 2017-10-12 15:27:44 +01:00
common.c liblockdep: Wrap kernel/locking/lockdep.c to allow usage from userspace 2013-11-27 11:55:21 +01:00
lockdep liblockdep: Add the 'lockdep' user-space utility 2013-11-27 11:56:25 +01:00
lockdep.c liblockdep: Wrap kernel/locking/lockdep.c to allow usage from userspace 2013-11-27 11:55:21 +01:00
lockdep_internals.h liblockdep: Wrap kernel/locking/lockdep.c to allow usage from userspace 2013-11-27 11:55:21 +01:00
lockdep_states.h liblockdep: Wrap kernel/locking/lockdep.c to allow usage from userspace 2013-11-27 11:55:21 +01:00
Makefile Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into next 2014-06-03 13:18:00 -07:00
preload.c tools/liblockdep: Account for bitfield changes in lockdeps lock_acquire 2014-07-07 12:20:16 -04:00
rbtree.c liblockdep: Wrap kernel/locking/lockdep.c to allow usage from userspace 2013-11-27 11:55:21 +01:00
run_tests.sh tools/liblockdep: Mark runtests.sh as executable 2014-02-26 21:21:59 -05:00