diff options
author | Oleg Drokin <[email protected]> | 2017-08-02 14:45:16 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-08-02 11:45:16 -0700 |
commit | d89616fda88bc030aaff758d37ede7d35e58841a (patch) | |
tree | 6947a3a0b235e62cad3187573f6205e7593e36fe /include | |
parent | eed143dfa6af0e004d0239bd3297b30e45b8c4d3 (diff) |
Remove misguided HAVE_MUTEX_OWNER check
It is just plain unsafe to peek inside in-kernel
mutex structure and make assumptions about what kernel
does with those internal fields like owner.
Kernel is all too happy to stop doing the expected things
like tracing lock owner once you load a tainted module
like spl/zfs that is not GPL.
As such you will get instant assertion failures like this:
VERIFY3(((*(volatile typeof((&((&zo->zo_lock)->m_mutex))->owner) *)&
((&((&zo->zo_lock)->m_mutex))->owner))) ==
((void *)0)) failed (ffff88030be28500 == (null))
PANIC at zfs_onexit.c:104:zfs_onexit_destroy()
Showing stack for process 3626
CPU: 0 PID: 3626 Comm: mkfs.lustre Tainted: P OE ------------ 3.10.0-debug #1
Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
Call Trace:
dump_stack+0x19/0x1b
spl_dumpstack+0x44/0x50 [spl]
spl_panic+0xbf/0xf0 [spl]
zfs_onexit_destroy+0x17c/0x280 [zfs]
zfsdev_release+0x48/0xd0 [zfs]
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Chunwei Chen <[email protected]>
Signed-off-by: Oleg Drokin <[email protected]>
Closes #632
Closes #633
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/mutex.h | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/include/sys/mutex.h b/include/sys/mutex.h index 319235223..d6bd99b4c 100644 --- a/include/sys/mutex.h +++ b/include/sys/mutex.h @@ -40,10 +40,8 @@ typedef enum { typedef struct { struct mutex m_mutex; spinlock_t m_lock; /* used for serializing mutex_exit */ -#ifndef HAVE_MUTEX_OWNER /* only when kernel doesn't have owner */ kthread_t *m_owner; -#endif #ifdef CONFIG_LOCKDEP kmutex_type_t m_type; #endif /* CONFIG_LOCKDEP */ @@ -58,24 +56,16 @@ spl_mutex_set_owner(kmutex_t *mp) * kernel will handle its owner, so we don't need to do anything if it * is defined. */ -#ifndef HAVE_MUTEX_OWNER mp->m_owner = current; -#endif } static inline void spl_mutex_clear_owner(kmutex_t *mp) { -#ifndef HAVE_MUTEX_OWNER mp->m_owner = NULL; -#endif } -#ifdef HAVE_MUTEX_OWNER #define mutex_owner(mp) (ACCESS_ONCE(MUTEX(mp)->owner)) -#else -#define mutex_owner(mp) (ACCESS_ONCE((mp)->m_owner)) -#endif #define mutex_owned(mp) (mutex_owner(mp) == current) #define MUTEX_HELD(mp) mutex_owned(mp) #define MUTEX_NOT_HELD(mp) (!MUTEX_HELD(mp)) |