aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-03 15:14:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-03 15:14:18 -0400
commit892ad5acca0b2ddb514fae63fa4686bf726d2471 (patch)
tree9945b41e6552c0b6b9b1b5b0ffb77f2f15857671
parent162b246eb420d2ca2002a50917c897b10c9aba09 (diff)
parent5d6dec6fba38c3e2d408df108bb92ef4ac201f18 (diff)
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking updates from Ingo Molnar: "The main changes in this cycle were: - Add CONFIG_REFCOUNT_FULL=y to allow the disabling of the 'full' (robustness checked) refcount_t implementation with slightly lower runtime overhead. (Kees Cook) The lighter weight variant is the default. The two variants use the same API. Having this variant was a precondition by some maintainers to merge refcount_t cleanups. - Add lockdep support for rtmutexes (Peter Zijlstra) - liblockdep fixes and improvements (Sasha Levin, Ben Hutchings) - ... misc fixes and improvements" * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits) locking/refcount: Remove the half-implemented refcount_sub() API locking/refcount: Create unchecked atomic_t implementation locking/rtmutex: Don't initialize lockdep when not required locking/selftest: Add RT-mutex support locking/selftest: Remove the bad unlock ordering test rt_mutex: Add lockdep annotations MAINTAINERS: Claim atomic*_t maintainership locking/x86: Remove the unused atomic_inc_short() methd tools/lib/lockdep: Remove private kernel headers tools/lib/lockdep: Hide liblockdep output from test results tools/lib/lockdep: Add dummy current_gfp_context() tools/include: Add IS_ERR_OR_NULL to err.h tools/lib/lockdep: Add empty __is_[module,kernel]_percpu_address tools/lib/lockdep: Include err.h tools/include: Add (mostly) empty include/linux/sched/mm.h tools/lib/lockdep: Use LDFLAGS tools/lib/lockdep: Remove double-quotes from soname tools/lib/lockdep: Fix object file paths used in an out-of-tree build tools/lib/lockdep: Fix compilation for 4.11 tools/lib/lockdep: Don't mix fd-based and stream IO ...
-rw-r--r--MAINTAINERS11
-rw-r--r--arch/Kconfig9
-rw-r--r--arch/tile/lib/atomic_asm_32.S3
-rw-r--r--arch/x86/include/asm/atomic.h13
-rw-r--r--include/linux/refcount.h38
-rw-r--r--include/linux/rtmutex.h25
-rw-r--r--kernel/locking/rtmutex-debug.c6
-rw-r--r--kernel/locking/rtmutex-debug.h2
-rw-r--r--kernel/locking/rtmutex.c37
-rw-r--r--kernel/locking/rtmutex.h2
-rw-r--r--lib/Kconfig.debug3
-rw-r--r--lib/locking-selftest-rtmutex.h11
-rw-r--r--lib/locking-selftest.c133
-rw-r--r--lib/refcount.c3
-rw-r--r--tools/Makefile8
-rw-r--r--tools/include/asm/sections.h4
-rw-r--r--tools/include/linux/bitops.h10
-rw-r--r--tools/include/linux/compiler.h12
-rw-r--r--tools/include/linux/debug_locks.h (renamed from tools/lib/lockdep/uinclude/linux/debug_locks.h)3
-rw-r--r--tools/include/linux/delay.h4
-rw-r--r--tools/include/linux/err.h5
-rw-r--r--tools/include/linux/ftrace.h4
-rw-r--r--tools/include/linux/gfp.h4
-rw-r--r--tools/include/linux/hardirq.h (renamed from tools/lib/lockdep/uinclude/linux/hardirq.h)0
-rw-r--r--tools/include/linux/interrupt.h4
-rw-r--r--tools/include/linux/irqflags.h (renamed from tools/lib/lockdep/uinclude/linux/irqflags.h)8
-rw-r--r--tools/include/linux/jhash.h175
-rw-r--r--tools/include/linux/kallsyms.h (renamed from tools/lib/lockdep/uinclude/linux/kallsyms.h)3
-rw-r--r--tools/include/linux/kern_levels.h (renamed from tools/lib/lockdep/uinclude/linux/kern_levels.h)0
-rw-r--r--tools/include/linux/kernel.h4
-rw-r--r--tools/include/linux/kmemcheck.h (renamed from tools/lib/lockdep/uinclude/linux/kmemcheck.h)0
-rw-r--r--tools/include/linux/linkage.h4
-rw-r--r--tools/include/linux/lockdep.h (renamed from tools/lib/lockdep/uinclude/linux/lockdep.h)34
-rw-r--r--tools/include/linux/module.h (renamed from tools/lib/lockdep/uinclude/linux/module.h)5
-rw-r--r--tools/include/linux/mutex.h4
-rw-r--r--tools/include/linux/proc_fs.h4
-rw-r--r--tools/include/linux/rcu.h (renamed from tools/lib/lockdep/uinclude/linux/rcu.h)3
-rw-r--r--tools/include/linux/sched/clock.h4
-rw-r--r--tools/include/linux/sched/mm.h4
-rw-r--r--tools/include/linux/sched/task.h4
-rw-r--r--tools/include/linux/seq_file.h4
-rw-r--r--tools/include/linux/spinlock.h26
-rw-r--r--tools/include/linux/stacktrace.h (renamed from tools/lib/lockdep/uinclude/linux/stacktrace.h)0
-rw-r--r--tools/include/linux/unaligned/packed_struct.h46
-rw-r--r--tools/include/trace/events/lock.h4
-rw-r--r--tools/lib/lockdep/Makefile9
-rw-r--r--tools/lib/lockdep/lockdep.c19
-rw-r--r--tools/lib/lockdep/preload.c5
-rw-r--r--tools/lib/lockdep/rbtree.c2
-rwxr-xr-xtools/lib/lockdep/run_tests.sh8
-rw-r--r--tools/lib/lockdep/uinclude/asm/hash.h6
-rw-r--r--tools/lib/lockdep/uinclude/asm/hweight.h3
-rw-r--r--tools/lib/lockdep/uinclude/asm/sections.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/bitops.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/compiler.h10
-rw-r--r--tools/lib/lockdep/uinclude/linux/delay.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/ftrace.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/gfp.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/hash.h1
-rw-r--r--tools/lib/lockdep/uinclude/linux/interrupt.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/kernel.h47
-rw-r--r--tools/lib/lockdep/uinclude/linux/linkage.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/list.h1
-rw-r--r--tools/lib/lockdep/uinclude/linux/mutex.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/poison.h1
-rw-r--r--tools/lib/lockdep/uinclude/linux/prefetch.h6
-rw-r--r--tools/lib/lockdep/uinclude/linux/proc_fs.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/rbtree_augmented.h2
-rw-r--r--tools/lib/lockdep/uinclude/linux/seq_file.h3
-rw-r--r--tools/lib/lockdep/uinclude/linux/spinlock.h25
-rw-r--r--tools/lib/lockdep/uinclude/linux/stringify.h7
-rw-r--r--tools/lib/lockdep/uinclude/trace/events/lock.h3
72 files changed, 641 insertions, 234 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 503f80a43bec..d357695ee4fe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2322,6 +2322,15 @@ F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt
2322F: drivers/input/touchscreen/atmel_mxt_ts.c 2322F: drivers/input/touchscreen/atmel_mxt_ts.c
2323F: include/linux/platform_data/atmel_mxt_ts.h 2323F: include/linux/platform_data/atmel_mxt_ts.h
2324 2324
2325ATOMIC INFRASTRUCTURE
2326M: Will Deacon <will.deacon@arm.com>
2327M: Peter Zijlstra <peterz@infradead.org>
2328R: Boqun Feng <boqun.feng@gmail.com>
2329L: linux-kernel@vger.kernel.org
2330S: Maintained
2331F: arch/*/include/asm/atomic*.h
2332F: include/*/atomic*.h
2333
2325ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER 2334ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER
2326M: Bradley Grove <linuxdrivers@attotech.com> 2335M: Bradley Grove <linuxdrivers@attotech.com>
2327L: linux-scsi@vger.kernel.org 2336L: linux-scsi@vger.kernel.org
@@ -7555,7 +7564,7 @@ S: Maintained
7555F: drivers/ata/sata_promise.* 7564F: drivers/ata/sata_promise.*
7556 7565
7557LIBLOCKDEP 7566LIBLOCKDEP
7558M: Sasha Levin <sasha.levin@oracle.com> 7567M: Sasha Levin <alexander.levin@verizon.com>
7559S: Maintained 7568S: Maintained
7560F: tools/lib/lockdep/ 7569F: tools/lib/lockdep/
7561 7570
diff --git a/arch/Kconfig b/arch/Kconfig
index 6c00e5b00f8b..f76b214cf7ad 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -867,4 +867,13 @@ config STRICT_MODULE_RWX
867config ARCH_WANT_RELAX_ORDER 867config ARCH_WANT_RELAX_ORDER
868 bool 868 bool
869 869
870config REFCOUNT_FULL
871 bool "Perform full reference count validation at the expense of speed"
872 help
873 Enabling this switches the refcounting infrastructure from a fast
874 unchecked atomic_t implementation to a fully state checked
875 implementation, which can be (slightly) slower but provides protections
876 against various use-after-free conditions that can be used in
877 security flaw exploits.
878
870source "kernel/gcov/Kconfig" 879source "kernel/gcov/Kconfig"
diff --git a/arch/tile/lib/atomic_asm_32.S b/arch/tile/lib/atomic_asm_32.S
index 1a70e6c0f259..94709ab41ed8 100644
--- a/arch/tile/lib/atomic_asm_32.S
+++ b/arch/tile/lib/atomic_asm_32.S
@@ -24,8 +24,7 @@
24 * has an opportunity to return -EFAULT to the user if needed. 24 * has an opportunity to return -EFAULT to the user if needed.
25 * The 64-bit routines just return a "long long" with the value, 25 * The 64-bit routines just return a "long long" with the value,
26 * since they are only used from kernel space and don't expect to fault. 26 * since they are only used from kernel space and don't expect to fault.
27 * Support for 16-bit ops is included in the framework but we don't provide 27 * Support for 16-bit ops is included in the framework but we don't provide any.
28 * any (x86_64 has an atomic_inc_short(), so we might want to some day).
29 * 28 *
30 * Note that the caller is advised to issue a suitable L1 or L2 29 * Note that the caller is advised to issue a suitable L1 or L2
31 * prefetch on the address being manipulated to avoid extra stalls. 30 * prefetch on the address being manipulated to avoid extra stalls.
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index caa5798c92f4..33380b871463 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -246,19 +246,6 @@ static __always_inline int __atomic_add_unless(atomic_t *v, int a, int u)
246 return c; 246 return c;
247} 247}
248 248
249/**
250 * atomic_inc_short - increment of a short integer
251 * @v: pointer to type int
252 *
253 * Atomically adds 1 to @v
254 * Returns the new value of @u
255 */
256static __always_inline short int atomic_inc_short(short int *v)
257{
258 asm(LOCK_PREFIX "addw $1, %0" : "+m" (*v));
259 return *v;
260}
261
262#ifdef CONFIG_X86_32 249#ifdef CONFIG_X86_32
263# include <asm/atomic64_32.h> 250# include <asm/atomic64_32.h>
264#else