diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-23 08:08:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-23 08:08:53 -0400 |
| commit | 0200fbdd431519d730b5d399a12840ec832b27cc (patch) | |
| tree | 2b58f9e24b61b00e0550f106c95bfabc3b52cfdd /drivers/misc/lkdtm | |
| parent | de3fbb2aa802a267dee2213ae7d5a1e19eb4294a (diff) | |
| parent | 01a14bda11add9dcd4a59200f13834d634559935 (diff) | |
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking and misc x86 updates from Ingo Molnar:
"Lots of changes in this cycle - in part because locking/core attracted
a number of related x86 low level work which was easier to handle in a
single tree:
- Linux Kernel Memory Consistency Model updates (Alan Stern, Paul E.
McKenney, Andrea Parri)
- lockdep scalability improvements and micro-optimizations (Waiman
Long)
- rwsem improvements (Waiman Long)
- spinlock micro-optimization (Matthew Wilcox)
- qspinlocks: Provide a liveness guarantee (more fairness) on x86.
(Peter Zijlstra)
- Add support for relative references in jump tables on arm64, x86
and s390 to optimize jump labels (Ard Biesheuvel, Heiko Carstens)
- Be a lot less permissive on weird (kernel address) uaccess faults
on x86: BUG() when uaccess helpers fault on kernel addresses (Jann
Horn)
- macrofy x86 asm statements to un-confuse the GCC inliner. (Nadav
Amit)
- ... and a handful of other smaller changes as well"
* 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (57 commits)
locking/lockdep: Make global debug_locks* variables read-mostly
locking/lockdep: Fix debug_locks off performance problem
locking/pvqspinlock: Extend node size when pvqspinlock is configured
locking/qspinlock_stat: Count instances of nested lock slowpaths
locking/qspinlock, x86: Provide liveness guarantee
x86/asm: 'Simplify' GEN_*_RMWcc() macros
locking/qspinlock: Rework some comments
locking/qspinlock: Re-order code
locking/lockdep: Remove duplicated 'lock_class_ops' percpu array
x86/defconfig: Enable CONFIG_USB_XHCI_HCD=y
futex: Replace spin_is_locked() with lockdep
locking/lockdep: Make class->ops a percpu counter and move it under CONFIG_DEBUG_LOCKDEP=y
x86/jump-labels: Macrofy inline assembly code to work around GCC inlining bugs
x86/cpufeature: Macrofy inline assembly code to work around GCC inlining bugs
x86/extable: Macrofy inline assembly code to work around GCC inlining bugs
x86/paravirt: Work around GCC inlining bugs when compiling paravirt ops
x86/bug: Macrofy the BUG table section handling, to work around GCC inlining bugs
x86/alternatives: Macrofy lock prefixes to work around GCC inlining bugs
x86/refcount: Work around GCC inlining bug
x86/objtool: Use asm macros to work around GCC inlining bugs
...
Diffstat (limited to 'drivers/misc/lkdtm')
| -rw-r--r-- | drivers/misc/lkdtm/core.c | 1 | ||||
| -rw-r--r-- | drivers/misc/lkdtm/lkdtm.h | 1 | ||||
| -rw-r--r-- | drivers/misc/lkdtm/usercopy.c | 13 |
3 files changed, 15 insertions, 0 deletions
diff --git a/drivers/misc/lkdtm/core.c b/drivers/misc/lkdtm/core.c index 2154d1bfd18b..5a755590d3dc 100644 --- a/drivers/misc/lkdtm/core.c +++ b/drivers/misc/lkdtm/core.c | |||
| @@ -183,6 +183,7 @@ static const struct crashtype crashtypes[] = { | |||
| 183 | CRASHTYPE(USERCOPY_STACK_FRAME_FROM), | 183 | CRASHTYPE(USERCOPY_STACK_FRAME_FROM), |
| 184 | CRASHTYPE(USERCOPY_STACK_BEYOND), | 184 | CRASHTYPE(USERCOPY_STACK_BEYOND), |
| 185 | CRASHTYPE(USERCOPY_KERNEL), | 185 | CRASHTYPE(USERCOPY_KERNEL), |
| 186 | CRASHTYPE(USERCOPY_KERNEL_DS), | ||
| 186 | }; | 187 | }; |
| 187 | 188 | ||
| 188 | 189 | ||
diff --git a/drivers/misc/lkdtm/lkdtm.h b/drivers/misc/lkdtm/lkdtm.h index 9e513dcfd809..07db641d71d0 100644 --- a/drivers/misc/lkdtm/lkdtm.h +++ b/drivers/misc/lkdtm/lkdtm.h | |||
| @@ -82,5 +82,6 @@ void lkdtm_USERCOPY_STACK_FRAME_TO(void); | |||
| 82 | void lkdtm_USERCOPY_STACK_FRAME_FROM(void); | 82 | void lkdtm_USERCOPY_STACK_FRAME_FROM(void); |
| 83 | void lkdtm_USERCOPY_STACK_BEYOND(void); | 83 | void lkdtm_USERCOPY_STACK_BEYOND(void); |
| 84 | void lkdtm_USERCOPY_KERNEL(void); | 84 | void lkdtm_USERCOPY_KERNEL(void); |
| 85 | void lkdtm_USERCOPY_KERNEL_DS(void); | ||
| 85 | 86 | ||
| 86 | #endif | 87 | #endif |
diff --git a/drivers/misc/lkdtm/usercopy.c b/drivers/misc/lkdtm/usercopy.c index 9725aed305bb..389475b25bb7 100644 --- a/drivers/misc/lkdtm/usercopy.c +++ b/drivers/misc/lkdtm/usercopy.c | |||
| @@ -322,6 +322,19 @@ free_user: | |||
| 322 | vm_munmap(user_addr, PAGE_SIZE); | 322 | vm_munmap(user_addr, PAGE_SIZE); |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | void lkdtm_USERCOPY_KERNEL_DS(void) | ||
| 326 | { | ||
| 327 | char __user *user_ptr = (char __user *)ERR_PTR(-EINVAL); | ||
| 328 | mm_segment_t old_fs = get_fs(); | ||
| 329 | char buf[10] = {0}; | ||
| 330 | |||
| 331 | pr_info("attempting copy_to_user on unmapped kernel address\n"); | ||
| 332 | set_fs(KERNEL_DS); | ||
| 333 | if (copy_to_user(user_ptr, buf, sizeof(buf))) | ||
| 334 | pr_info("copy_to_user un unmapped kernel address failed\n"); | ||
| 335 | set_fs(old_fs); | ||
| 336 | } | ||
| 337 | |||
| 325 | void __init lkdtm_usercopy_init(void) | 338 | void __init lkdtm_usercopy_init(void) |
| 326 | { | 339 | { |
| 327 | /* Prepare cache that lacks SLAB_USERCOPY flag. */ | 340 | /* Prepare cache that lacks SLAB_USERCOPY flag. */ |
