Merge misc fixes from Andrew Morton: "11 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: MAINTAINERS: add files related to kdump z3fold: fix use-after-free when freeing handles sparc32: use PUD rather than PGD to get PMD in srmmu_nocache_init() MAINTAINERS: update email address for Naoya Horiguchi sh: include linux/time_types.h for sockios kasan: disable branch tracing for core runtime selftests/vm/write_to_hugetlbfs.c: fix unused variable warning selftests/vm/.gitignore: add mremap_dontunmap rapidio: fix an error in get_user_pages_fast() error handling x86: bitops: fix build regression device-dax: don't leak kernel memory to user space after unloading kmem
Unified · Split
| @@ -7829,7 +7829,7 @@ T: git git://linuxtv.org/media_tree.git · 7828 unmodified lines | |||
| 7829 | F: drivers/media/platform/sti/hva | 7829 | F: drivers/media/platform/sti/hva |
| 7830 | 7830 | ||
| 7831 | HWPOISON MEMORY FAILURE HANDLING | 7831 | HWPOISON MEMORY FAILURE HANDLING |
| 7832 | M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> | 7832 | M: Naoya Horiguchi <naoya.horiguchi@nec.com> |
| 7833 | L: linux-mm@kvack.org | 7833 | L: linux-mm@kvack.org |
| 7834 | S: Maintained | 7834 | S: Maintained |
| 7835 | F: mm/hwpoison-inject.c | 7835 | F: mm/hwpoison-inject.c |
| @@ -9185,6 +9185,11 @@ L: kexec@lists.infradead.org · 1349 unmodified lines | |||
| 9185 | S: Maintained | 9185 | S: Maintained |
| 9186 | W: http://lse.sourceforge.net/kdump/ | 9186 | W: http://lse.sourceforge.net/kdump/ |
| 9187 | F: Documentation/admin-guide/kdump/ | 9187 | F: Documentation/admin-guide/kdump/ |
| 9188 | F: fs/proc/vmcore.c | ||
| 9189 | F: include/linux/crash_core.h | ||
| 9190 | F: include/linux/crash_dump.h | ||
| 9191 | F: include/uapi/linux/vmcore.h | ||
| 9192 | F: kernel/crash_*.c | ||
| 9188 | 9193 | ||
| 9189 | KEENE FM RADIO TRANSMITTER DRIVER | 9194 | KEENE FM RADIO TRANSMITTER DRIVER |
| 9190 | M: Hans Verkuil <hverkuil@xs4all.nl> | 9195 | M: Hans Verkuil <hverkuil@xs4all.nl> |
| @@ -2,6 +2,8 @@ · 1 unmodified line | |||
| 2 | #ifndef __ASM_SH_SOCKIOS_H | 2 | #ifndef __ASM_SH_SOCKIOS_H |
| 3 | #define __ASM_SH_SOCKIOS_H | 3 | #define __ASM_SH_SOCKIOS_H |
| 4 | 4 | ||
| 5 | #include <linux/time_types.h> | ||
| 6 | |||
| 5 | /* Socket-level I/O control calls. */ | 7 | /* Socket-level I/O control calls. */ |
| 6 | #define FIOGETOWN _IOR('f', 123, int) | 8 | #define FIOGETOWN _IOR('f', 123, int) |
| 7 | #define FIOSETOWN _IOW('f', 124, int) | 9 | #define FIOSETOWN _IOW('f', 124, int) |
| @@ -333,7 +333,7 @@ static void __init srmmu_nocache_init(void) · 332 unmodified lines | |||
| 333 | pgd = pgd_offset_k(vaddr); | 333 | pgd = pgd_offset_k(vaddr); |
| 334 | p4d = p4d_offset(__nocache_fix(pgd), vaddr); | 334 | p4d = p4d_offset(__nocache_fix(pgd), vaddr); |
| 335 | pud = pud_offset(__nocache_fix(p4d), vaddr); | 335 | pud = pud_offset(__nocache_fix(p4d), vaddr); |
| 336 | pmd = pmd_offset(__nocache_fix(pgd), vaddr); | 336 | pmd = pmd_offset(__nocache_fix(pud), vaddr); |
| 337 | pte = pte_offset_kernel(__nocache_fix(pmd), vaddr); | 337 | pte = pte_offset_kernel(__nocache_fix(pmd), vaddr); |
| 338 | 338 | ||
| 339 | pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV); | 339 | pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV); |
| @@ -52,9 +52,9 @@ static __always_inline void · 51 unmodified lines | |||
| 52 | arch_set_bit(long nr, volatile unsigned long *addr) | 52 | arch_set_bit(long nr, volatile unsigned long *addr) |
| 53 | { | 53 | { |
| 54 | if (__builtin_constant_p(nr)) { | 54 | if (__builtin_constant_p(nr)) { |
| 55 | asm volatile(LOCK_PREFIX "orb %1,%0" | 55 | asm volatile(LOCK_PREFIX "orb %b1,%0" |
| 56 | : CONST_MASK_ADDR(nr, addr) | 56 | : CONST_MASK_ADDR(nr, addr) |
| 57 | : "iq" (CONST_MASK(nr) & 0xff) | 57 | : "iq" (CONST_MASK(nr)) |
| 58 | : "memory"); | 58 | : "memory"); |
| 59 | } else { | 59 | } else { |
| 60 | asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0" | 60 | asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0" |
| @@ -72,9 +72,9 @@ static __always_inline void · 11 unmodified lines | |||
| 72 | arch_clear_bit(long nr, volatile unsigned long *addr) | 72 | arch_clear_bit(long nr, volatile unsigned long *addr) |
| 73 | { | 73 | { |
| 74 | if (__builtin_constant_p(nr)) { | 74 | if (__builtin_constant_p(nr)) { |
| 75 | asm volatile(LOCK_PREFIX "andb %1,%0" | 75 | asm volatile(LOCK_PREFIX "andb %b1,%0" |
| 76 | : CONST_MASK_ADDR(nr, addr) | 76 | : CONST_MASK_ADDR(nr, addr) |
| 77 | : "iq" (CONST_MASK(nr) ^ 0xff)); | 77 | : "iq" (~CONST_MASK(nr))); |
| 78 | } else { | 78 | } else { |
| 79 | asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0" | 79 | asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0" |
| 80 | : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); | 80 | : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); |
| @@ -123,9 +123,9 @@ static __always_inline void · 42 unmodified lines | |||
| 123 | arch_change_bit(long nr, volatile unsigned long *addr) | 123 | arch_change_bit(long nr, volatile unsigned long *addr) |
| 124 | { | 124 | { |
| 125 | if (__builtin_constant_p(nr)) { | 125 | if (__builtin_constant_p(nr)) { |
| 126 | asm volatile(LOCK_PREFIX "xorb %1,%0" | 126 | asm volatile(LOCK_PREFIX "xorb %b1,%0" |
| 127 | : CONST_MASK_ADDR(nr, addr) | 127 | : CONST_MASK_ADDR(nr, addr) |
| 128 | : "iq" ((u8)CONST_MASK(nr))); | 128 | : "iq" (CONST_MASK(nr))); |
| 129 | } else { | 129 | } else { |
| 130 | asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0" | 130 | asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0" |
| 131 | : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); | 131 | : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); |
| @@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev) · 21 unmodified lines | |||
| 22 | resource_size_t kmem_size; | 22 | resource_size_t kmem_size; |
| 23 | resource_size_t kmem_end; | 23 | resource_size_t kmem_end; |
| 24 | struct resource *new_res; | 24 | struct resource *new_res; |
| 25 | const char *new_res_name; | ||
| 25 | int numa_node; | 26 | int numa_node; |
| 26 | int rc; | 27 | int rc; |
| 27 | 28 | ||
| @@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev) · 20 unmodified lines | |||
| 48 | kmem_size &= ~(memory_block_size_bytes() - 1); | 49 | kmem_size &= ~(memory_block_size_bytes() - 1); |
| 49 | kmem_end = kmem_start + kmem_size; | 50 | kmem_end = kmem_start + kmem_size; |
| 50 | 51 | ||
| 51 | /* Region is permanently reserved. Hot-remove not yet implemented. */ | 52 | new_res_name = kstrdup(dev_name(dev), GFP_KERNEL); |
| 52 | new_res = request_mem_region(kmem_start, kmem_size, dev_name(dev)); | 53 | if (!new_res_name) |
| 54 | return -ENOMEM; | ||
| 55 | |||
| 56 | /* Region is permanently reserved if hotremove fails. */ | ||
| 57 | new_res = request_mem_region(kmem_start, kmem_size, new_res_name); | ||
| 53 | if (!new_res) { | 58 | if (!new_res) { |
| 54 | dev_warn(dev, "could not reserve region [%pa-%pa]\n", | 59 | dev_warn(dev, "could not reserve region [%pa-%pa]\n", |
| 55 | &kmem_start, &kmem_end); | 60 | &kmem_start, &kmem_end); |
| 61 | kfree(new_res_name); | ||
| 56 | return -EBUSY; | 62 | return -EBUSY; |
| 57 | } | 63 | } |
| 58 | 64 | ||
| @@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev) · 4 unmodified lines | |||
| 63 | * unknown to us that will break add_memory() below. | 69 | * unknown to us that will break add_memory() below. |
| 64 | */ | 70 | */ |
| 65 | new_res->flags = IORESOURCE_SYSTEM_RAM; | 71 | new_res->flags = IORESOURCE_SYSTEM_RAM; |
| 66 | new_res->name = dev_name(dev); | ||
| 67 | 72 | ||
| 68 | rc = add_memory(numa_node, new_res->start, resource_size(new_res)); | 73 | rc = add_memory(numa_node, new_res->start, resource_size(new_res)); |
| 69 | if (rc) { | 74 | if (rc) { |
| 70 | release_resource(new_res); | 75 | release_resource(new_res); |
| 71 | kfree(new_res); | 76 | kfree(new_res); |
| 77 | kfree(new_res_name); | ||
| 72 | return rc; | 78 | return rc; |
| 73 | } | 79 | } |
| 74 | dev_dax->dax_kmem_res = new_res; | 80 | dev_dax->dax_kmem_res = new_res; |
| @@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev) · 8 unmodified lines | |||
| 83 | struct resource *res = dev_dax->dax_kmem_res; | 89 | struct resource *res = dev_dax->dax_kmem_res; |
| 84 | resource_size_t kmem_start = res->start; | 90 | resource_size_t kmem_start = res->start; |
| 85 | resource_size_t kmem_size = resource_size(res); | 91 | resource_size_t kmem_size = resource_size(res); |
| 92 | const char *res_name = res->name; | ||
| 86 | int rc; | 93 | int rc; |
| 87 | 94 | ||
| 88 | /* | 95 | /* |
| @@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev) · 13 unmodified lines | |||
| 102 | /* Release and free dax resources */ | 109 | /* Release and free dax resources */ |
| 103 | release_resource(res); | 110 | release_resource(res); |
| 104 | kfree(res); | 111 | kfree(res); |
| 112 | kfree(res_name); | ||
| 105 | dev_dax->dax_kmem_res = NULL; | 113 | dev_dax->dax_kmem_res = NULL; |
| 106 | 114 | ||
| 107 | return 0; | 115 | return 0; |
| @@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, · 876 unmodified lines | |||
| 877 | rmcd_error("pinned %ld out of %ld pages", | 877 | rmcd_error("pinned %ld out of %ld pages", |
| 878 | pinned, nr_pages); | 878 | pinned, nr_pages); |
| 879 | ret = -EFAULT; | 879 | ret = -EFAULT; |
| 880 | /* | ||
| 881 | * Set nr_pages up to mean "how many pages to unpin, in | ||
| 882 | * the error handler: | ||
| 883 | */ | ||
| 884 | nr_pages = pinned; | ||
| 880 | goto err_pg; | 885 | goto err_pg; |
| 881 | } | 886 | } |
| 882 | 887 | ||
| @@ -15,14 +15,14 @@ CFLAGS_REMOVE_tags_report.o = $(CC_FLAGS_FTRACE) · 14 unmodified lines | |||
| 15 | 15 | ||
| 16 | # Function splitter causes unnecessary splits in __asan_load1/__asan_store1 | 16 | # Function splitter causes unnecessary splits in __asan_load1/__asan_store1 |
| 17 | # see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533 | 17 | # see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533 |
| 18 | CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 18 | CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 19 | CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 19 | CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 20 | CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 20 | CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 21 | CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 21 | CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 22 | CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 22 | CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 23 | CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 23 | CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 24 | CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 24 | CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 25 | CFLAGS_tags_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | 25 | CFLAGS_tags_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING |
| 26 | 26 | ||
| 27 | obj-$(CONFIG_KASAN) := common.o init.o report.o | 27 | obj-$(CONFIG_KASAN) := common.o init.o report.o |
| 28 | obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o | 28 | obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o |
| @@ -15,7 +15,6 @@ · 14 unmodified lines | |||
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 18 | #define DISABLE_BRANCH_PROFILING | ||
| 19 | 18 | ||
| 20 | #include <linux/export.h> | 19 | #include <linux/export.h> |
| 21 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
| @@ -12,7 +12,6 @@ · 11 unmodified lines | |||
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 15 | #define DISABLE_BRANCH_PROFILING | ||
| 16 | 15 | ||
| 17 | #include <linux/export.h> | 16 | #include <linux/export.h> |
| 18 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
| @@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle) · 317 unmodified lines | |||
| 318 | slots = handle_to_slots(handle); | 318 | slots = handle_to_slots(handle); |
| 319 | write_lock(&slots->lock); | 319 | write_lock(&slots->lock); |
| 320 | *(unsigned long *)handle = 0; | 320 | *(unsigned long *)handle = 0; |
| 321 | write_unlock(&slots->lock); | 321 | if (zhdr->slots == slots) { |
| 322 | if (zhdr->slots == slots) | 322 | write_unlock(&slots->lock); |
| 323 | return; /* simple case, nothing else to do */ | 323 | return; /* simple case, nothing else to do */ |
| 324 | } | ||
| 324 | 325 | ||
| 325 | /* we are freeing a foreign handle if we are here */ | 326 | /* we are freeing a foreign handle if we are here */ |
| 326 | zhdr->foreign_handles--; | 327 | zhdr->foreign_handles--; |
| 327 | is_free = true; | 328 | is_free = true; |
| 328 | read_lock(&slots->lock); | ||
| 329 | if (!test_bit(HANDLES_ORPHANED, &slots->pool)) { | 329 | if (!test_bit(HANDLES_ORPHANED, &slots->pool)) { |
| 330 | read_unlock(&slots->lock); | 330 | write_unlock(&slots->lock); |
| 331 | return; | 331 | return; |
| 332 | } | 332 | } |
| 333 | for (i = 0; i <= BUDDY_MASK; i++) { | 333 | for (i = 0; i <= BUDDY_MASK; i++) { |
| @@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle) · 2 unmodified lines | |||
| 336 | break; | 336 | break; |
| 337 | } | 337 | } |
| 338 | } | 338 | } |
| 339 | read_unlock(&slots->lock); | 339 | write_unlock(&slots->lock); |
| 340 | 340 | ||
| 341 | if (is_free) { | 341 | if (is_free) { |
| 342 | struct z3fold_pool *pool = slots_to_pool(slots); | 342 | struct z3fold_pool *pool = slots_to_pool(slots); |
| @@ -422,6 +422,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless, · 79 unmodified lines | |||
| 422 | zhdr->start_middle = 0; | 422 | zhdr->start_middle = 0; |
| 423 | zhdr->cpu = -1; | 423 | zhdr->cpu = -1; |
| 424 | zhdr->foreign_handles = 0; | 424 | zhdr->foreign_handles = 0; |
| 425 | zhdr->mapped_count = 0; | ||
| 425 | zhdr->slots = slots; | 426 | zhdr->slots = slots; |
| 426 | zhdr->pool = pool; | 427 | zhdr->pool = pool; |
| 427 | INIT_LIST_HEAD(&zhdr->buddy); | 428 | INIT_LIST_HEAD(&zhdr->buddy); |
| @@ -6,6 +6,7 @@ map_populate · 5 unmodified lines | |||
| 6 | thuge-gen | 6 | thuge-gen |
| 7 | compaction_test | 7 | compaction_test |
| 8 | mlock2-tests | 8 | mlock2-tests |
| 9 | mremap_dontunmap | ||
| 9 | on-fault-limit | 10 | on-fault-limit |
| 10 | transhuge-stress | 11 | transhuge-stress |
| 11 | userfaultfd | 12 | userfaultfd |
| @@ -74,8 +74,6 @@ int main(int argc, char **argv) · 73 unmodified lines | |||
| 74 | int write = 0; | 74 | int write = 0; |
| 75 | int reserve = 1; | 75 | int reserve = 1; |
| 76 | 76 | ||
| 77 | unsigned long i; | ||
| 78 | |||
| 79 | if (signal(SIGINT, sig_handler) == SIG_ERR) | 77 | if (signal(SIGINT, sig_handler) == SIG_ERR) |
| 80 | err(1, "\ncan't catch SIGINT\n"); | 78 | err(1, "\ncan't catch SIGINT\n"); |
| 81 | 79 | ||