diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2016-09-05 11:14:17 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-09-05 11:14:17 -0400 |
commit | cbf2f8a99a2337894c3592c9ac2170e8c1f8f73f (patch) | |
tree | c018fb3826ea8492641be62c2f3162fb67f5aa0e /lib | |
parent | fa8410b355251fd30341662a40ac6b22d3e38468 (diff) | |
parent | d64934019f6cc39202e2f78063709f61ca5cb364 (diff) |
Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into efi/urgent
* Make for_each_efi_memory_desc_in_map() safe on Xen and prevent an
infinte loop - Jan Beulich
* Fix boot error on arm64 Qualcomm platforms by refactoring and
improving the ExitBootServices() hack we already for x86 and moving
it to the libstub - Jeffrey Hugo
* Use correct return data type for of_get_flat_dt_subnode_by_name()
so that we correctly handle errors - Andrzej Hajda
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Kconfig.debug | 18 | ||||
-rw-r--r-- | lib/Makefile | 1 | ||||
-rw-r--r-- | lib/rhashtable.c | 7 | ||||
-rw-r--r-- | lib/test_hash.c | 26 | ||||
-rw-r--r-- | lib/usercopy.c | 9 |
5 files changed, 20 insertions, 41 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 2307d7c89dac..2e2cca509231 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -1686,24 +1686,6 @@ config LATENCYTOP | |||
1686 | Enable this option if you want to use the LatencyTOP tool | 1686 | Enable this option if you want to use the LatencyTOP tool |
1687 | to find out which userspace is blocking on what kernel operations. | 1687 | to find out which userspace is blocking on what kernel operations. |
1688 | 1688 | ||
1689 | config ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | ||
1690 | bool | ||
1691 | |||
1692 | config DEBUG_STRICT_USER_COPY_CHECKS | ||
1693 | bool "Strict user copy size checks" | ||
1694 | depends on ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS | ||
1695 | depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING | ||
1696 | help | ||
1697 | Enabling this option turns a certain set of sanity checks for user | ||
1698 | copy operations into compile time failures. | ||
1699 | |||
1700 | The copy_from_user() etc checks are there to help test if there | ||
1701 | are sufficient security checks on the length argument of | ||
1702 | the copy operation, by having gcc prove that the argument is | ||
1703 | within bounds. | ||
1704 | |||
1705 | If unsure, say N. | ||
1706 | |||
1707 | source kernel/trace/Kconfig | 1689 | source kernel/trace/Kconfig |
1708 | 1690 | ||
1709 | menu "Runtime Testing" | 1691 | menu "Runtime Testing" |
diff --git a/lib/Makefile b/lib/Makefile index cfa68eb269e4..5dc77a8ec297 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -24,7 +24,6 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ | |||
24 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ | 24 | is_single_threaded.o plist.o decompress.o kobject_uevent.o \ |
25 | earlycpio.o seq_buf.o nmi_backtrace.o nodemask.o | 25 | earlycpio.o seq_buf.o nmi_backtrace.o nodemask.o |
26 | 26 | ||
27 | obj-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o | ||
28 | lib-$(CONFIG_MMU) += ioremap.o | 27 | lib-$(CONFIG_MMU) += ioremap.o |
29 | lib-$(CONFIG_SMP) += cpumask.o | 28 | lib-$(CONFIG_SMP) += cpumask.o |
30 | lib-$(CONFIG_HAS_DMA) += dma-noop.o | 29 | lib-$(CONFIG_HAS_DMA) += dma-noop.o |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 5ba520b544d7..56054e541a0f 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -77,17 +77,18 @@ static int alloc_bucket_locks(struct rhashtable *ht, struct bucket_table *tbl, | |||
77 | size = min_t(unsigned int, size, tbl->size >> 1); | 77 | size = min_t(unsigned int, size, tbl->size >> 1); |
78 | 78 | ||
79 | if (sizeof(spinlock_t) != 0) { | 79 | if (sizeof(spinlock_t) != 0) { |
80 | tbl->locks = NULL; | ||
80 | #ifdef CONFIG_NUMA | 81 | #ifdef CONFIG_NUMA |
81 | if (size * sizeof(spinlock_t) > PAGE_SIZE && | 82 | if (size * sizeof(spinlock_t) > PAGE_SIZE && |
82 | gfp == GFP_KERNEL) | 83 | gfp == GFP_KERNEL) |
83 | tbl->locks = vmalloc(size * sizeof(spinlock_t)); | 84 | tbl->locks = vmalloc(size * sizeof(spinlock_t)); |
84 | else | ||
85 | #endif | 85 | #endif |
86 | if (gfp != GFP_KERNEL) | 86 | if (gfp != GFP_KERNEL) |
87 | gfp |= __GFP_NOWARN | __GFP_NORETRY; | 87 | gfp |= __GFP_NOWARN | __GFP_NORETRY; |
88 | 88 | ||
89 | tbl->locks = kmalloc_array(size, sizeof(spinlock_t), | 89 | if (!tbl->locks) |
90 | gfp); | 90 | tbl->locks = kmalloc_array(size, sizeof(spinlock_t), |
91 | gfp); | ||
91 | if (!tbl->locks) | 92 | if (!tbl->locks) |
92 | return -ENOMEM; | 93 | return -ENOMEM; |
93 | for (i = 0; i < size; i++) | 94 | for (i = 0; i < size; i++) |
diff --git a/lib/test_hash.c b/lib/test_hash.c index 66c5fc8351e8..cac20c5fb304 100644 --- a/lib/test_hash.c +++ b/lib/test_hash.c | |||
@@ -143,7 +143,7 @@ static int __init | |||
143 | test_hash_init(void) | 143 | test_hash_init(void) |
144 | { | 144 | { |
145 | char buf[SIZE+1]; | 145 | char buf[SIZE+1]; |
146 | u32 string_or = 0, hash_or[2][33] = { 0 }; | 146 | u32 string_or = 0, hash_or[2][33] = { { 0, } }; |
147 | unsigned tests = 0; | 147 | unsigned tests = 0; |
148 | unsigned long long h64 = 0; | 148 | unsigned long long h64 = 0; |
149 | int i, j; | 149 | int i, j; |
@@ -219,21 +219,27 @@ test_hash_init(void) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | /* Issue notices about skipped tests. */ | 221 | /* Issue notices about skipped tests. */ |
222 | #ifndef HAVE_ARCH__HASH_32 | 222 | #ifdef HAVE_ARCH__HASH_32 |
223 | pr_info("__hash_32() has no arch implementation to test."); | 223 | #if HAVE_ARCH__HASH_32 != 1 |
224 | #elif HAVE_ARCH__HASH_32 != 1 | ||
225 | pr_info("__hash_32() is arch-specific; not compared to generic."); | 224 | pr_info("__hash_32() is arch-specific; not compared to generic."); |
226 | #endif | 225 | #endif |
227 | #ifndef HAVE_ARCH_HASH_32 | 226 | #else |
228 | pr_info("hash_32() has no arch implementation to test."); | 227 | pr_info("__hash_32() has no arch implementation to test."); |
229 | #elif HAVE_ARCH_HASH_32 != 1 | 228 | #endif |
229 | #ifdef HAVE_ARCH_HASH_32 | ||
230 | #if HAVE_ARCH_HASH_32 != 1 | ||
230 | pr_info("hash_32() is arch-specific; not compared to generic."); | 231 | pr_info("hash_32() is arch-specific; not compared to generic."); |
231 | #endif | 232 | #endif |
232 | #ifndef HAVE_ARCH_HASH_64 | 233 | #else |
233 | pr_info("hash_64() has no arch implementation to test."); | 234 | pr_info("hash_32() has no arch implementation to test."); |
234 | #elif HAVE_ARCH_HASH_64 != 1 | 235 | #endif |
236 | #ifdef HAVE_ARCH_HASH_64 | ||
237 | #if HAVE_ARCH_HASH_64 != 1 | ||
235 | pr_info("hash_64() is arch-specific; not compared to generic."); | 238 | pr_info("hash_64() is arch-specific; not compared to generic."); |
236 | #endif | 239 | #endif |
240 | #else | ||
241 | pr_info("hash_64() has no arch implementation to test."); | ||
242 | #endif | ||
237 | 243 | ||
238 | pr_notice("%u tests passed.", tests); | 244 | pr_notice("%u tests passed.", tests); |
239 | 245 | ||
diff --git a/lib/usercopy.c b/lib/usercopy.c deleted file mode 100644 index 4f5b1ddbcd25..000000000000 --- a/lib/usercopy.c +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | #include <linux/export.h> | ||
2 | #include <linux/bug.h> | ||
3 | #include <linux/uaccess.h> | ||
4 | |||
5 | void copy_from_user_overflow(void) | ||
6 | { | ||
7 | WARN(1, "Buffer overflow detected!\n"); | ||
8 | } | ||
9 | EXPORT_SYMBOL(copy_from_user_overflow); | ||