locking fixes
Linus,
Please pull the latest locking-urgent-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking-urgent-for-linus
# HEAD: 39e7234f00bc93613c086ae42d852d5f4147120a locking/rwsem: Fix kernel crash when spinning on RWSEM_OWNER_UNKNOWN
Three fixes:
- Fix an rwsem spin-on-owner crash, introduced in v5.4
- Fix a lockdep bug when running out of stack_trace entries, introduced in v5.4
- Docbook fix
Thanks,
Ingo
------------------>
Randy Dunlap (1):
futex: Fix kernel-doc notation warning
Waiman Long (2):
locking/lockdep: Fix buffer overrun problem in stack_trace[] locking/rwsem: Fix kernel crash when spinning on RWSEM_OWNER_UNKNOWN
kernel/futex.c | 1 + kernel/locking/lockdep.c | 7 +++---- kernel/locking/rwsem.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
kernel/futex.c +1 -0
@@ -1178,6 +1178,7 @@ static int attach_to_pi_state(u32 __user *uaddr, u32 uval,/** * wait_for_owner_exiting - Block until the owner has exited +* @ret: owner's current futex lock status * @exiting: Pointer to the exiting task * * Caller must hold a refcount on @exiting.
kernel/locking/lockdep.c +3 -4
@@ -482,7 +482,7 @@ static struct lock_trace *save_trace(void)struct lock_trace *trace, *t2;struct hlist_head *hash_head;u32 hash; -unsigned int max_entries; +int max_entries;BUILD_BUG_ON_NOT_POWER_OF_2 (STACK_TRACE_HASH_SIZE );BUILD_BUG_ON (LOCK_TRACE_SIZE_IN_LONGS >=MAX_STACK_TRACE_ENTRIES );
@@ -490,10 +490,8 @@ static struct lock_trace *save_trace(void) trace = (struct lock_trace *)(stack_trace + nr_stack_trace_entries); max_entries =MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries -LOCK_TRACE_SIZE_IN_LONGS ; - trace->nr_entries =stack_trace_save (trace->entries, max_entries,3 ); -if (nr_stack_trace_entries >=MAX_STACK_TRACE_ENTRIES - -LOCK_TRACE_SIZE_IN_LONGS -1 ) { +if (max_entries <=0 ) {if (!debug_locks_off_graph_unlock ())return NULL ;
@@ -502,6 +500,7 @@ static struct lock_trace *save_trace(void)return NULL ; } + trace->nr_entries =stack_trace_save (trace->entries, max_entries,3 ); hash =jhash (trace->entries, trace->nr_entries *sizeof (trace->entries[0 ]),0 );
kernel/locking/rwsem.c +2 -2
@@ -1226,8 +1226,8 @@ rwsem_down_write_slowpath(struct rw_semaphore *sem, int state)* In this case, we attempt to acquire the lock again * without sleeping. */ -if ((wstate ==WRITER_HANDOFF ) && - (rwsem_spin_on_owner (sem,0 ) ==OWNER_NULL )) +if (wstate ==WRITER_HANDOFF && +rwsem_spin_on_owner (sem,RWSEM_NONSPINNABLE ) ==OWNER_NULL ) goto trylock_again;/* Block until there are no active lockers. */
The pull request you sent on Sat, 18 Jan 2020 18:53:09 +0100:
The pull request you sent on Sat, 18 Jan 2020 18:53:09 +0100:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.gitlocking-urgent-for-linus
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/124b5547ec1e1c935c5cc3dfe9f3c04669ecb5e4
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker