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 | 7829 | F: drivers/media/platform/sti/hva |
| 7830 | 7830 | |
| 7831 | 7831 | HWPOISON MEMORY FAILURE HANDLING |
| 7832 | −M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> | |
| 7832 | +M: Naoya Horiguchi <naoya.horiguchi@nec.com> | |
| 7833 | 7833 | L: linux-mm@kvack.org |
| 7834 | 7834 | S: Maintained |
| 7835 | 7835 | F: mm/hwpoison-inject.c |
| @@ -9185,6 +9185,11 @@ L: kexec@lists.infradead.org · 1349 unmodified lines | ||
| 9185 | 9185 | S: Maintained |
| 9186 | 9186 | W: http://lse.sourceforge.net/kdump/ |
| 9187 | 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 | 9194 | KEENE FM RADIO TRANSMITTER DRIVER |
| 9190 | 9195 | M: Hans Verkuil <hverkuil@xs4all.nl> |
| @@ -2,6 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | #ifndef __ASM_SH_SOCKIOS_H |
| 3 | 3 | #define __ASM_SH_SOCKIOS_H |
| 4 | 4 | |
| 5 | +#include <linux/time_types.h> | |
| 6 | + | |
| 5 | 7 | /* Socket-level I/O control calls. */ |
| 6 | 8 | #define FIOGETOWN _IOR('f', 123, int) |
| 7 | 9 | #define FIOSETOWN _IOW('f', 124, int) |
| @@ -333,7 +333,7 @@ static void __init srmmu_nocache_init(void) · 332 unmodified lines | ||
| 333 | 333 | pgd = pgd_offset_k(vaddr); |
| 334 | 334 | p4d = p4d_offset(__nocache_fix(pgd), vaddr); |
| 335 | 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 | 337 | pte = pte_offset_kernel(__nocache_fix(pmd), vaddr); |
| 338 | 338 | |
| 339 | 339 | pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV); |
| @@ -52,9 +52,9 @@ static __always_inline void · 51 unmodified lines | ||
| 52 | 52 | arch_set_bit(long nr, volatile unsigned long *addr) |
| 53 | 53 | { |
| 54 | 54 | if (__builtin_constant_p(nr)) { |
| 55 | − asm volatile(LOCK_PREFIX "orb %1,%0" | |
| 55 | + asm volatile(LOCK_PREFIX "orb %b1,%0" | |
| 56 | 56 | : CONST_MASK_ADDR(nr, addr) |
| 57 | − : "iq" (CONST_MASK(nr) & 0xff) | |
| 57 | + : "iq" (CONST_MASK(nr)) | |
| 58 | 58 | : "memory"); |
| 59 | 59 | } else { |
| 60 | 60 | asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0" |
| @@ -72,9 +72,9 @@ static __always_inline void · 11 unmodified lines | ||
| 72 | 72 | arch_clear_bit(long nr, volatile unsigned long *addr) |
| 73 | 73 | { |
| 74 | 74 | if (__builtin_constant_p(nr)) { |
| 75 | − asm volatile(LOCK_PREFIX "andb %1,%0" | |
| 75 | + asm volatile(LOCK_PREFIX "andb %b1,%0" | |
| 76 | 76 | : CONST_MASK_ADDR(nr, addr) |
| 77 | − : "iq" (CONST_MASK(nr) ^ 0xff)); | |
| 77 | + : "iq" (~CONST_MASK(nr))); | |
| 78 | 78 | } else { |
| 79 | 79 | asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0" |
| 80 | 80 | : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); |
| @@ -123,9 +123,9 @@ static __always_inline void · 42 unmodified lines | ||
| 123 | 123 | arch_change_bit(long nr, volatile unsigned long *addr) |
| 124 | 124 | { |
| 125 | 125 | if (__builtin_constant_p(nr)) { |
| 126 | − asm volatile(LOCK_PREFIX "xorb %1,%0" | |
| 126 | + asm volatile(LOCK_PREFIX "xorb %b1,%0" | |
| 127 | 127 | : CONST_MASK_ADDR(nr, addr) |
| 128 | − : "iq" ((u8)CONST_MASK(nr))); | |
| 128 | + : "iq" (CONST_MASK(nr))); | |
| 129 | 129 | } else { |
| 130 | 130 | asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0" |
| 131 | 131 | : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); |
| @@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev) · 21 unmodified lines | ||
| 22 | 22 | resource_size_t kmem_size; |
| 23 | 23 | resource_size_t kmem_end; |
| 24 | 24 | struct resource *new_res; |
| 25 | + const char *new_res_name; | |
| 25 | 26 | int numa_node; |
| 26 | 27 | int rc; |
| 27 | 28 | |
| @@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev) · 20 unmodified lines | ||
| 48 | 49 | kmem_size &= ~(memory_block_size_bytes() - 1); |
| 49 | 50 | kmem_end = kmem_start + kmem_size; |
| 50 | 51 | |
| 51 | − /* Region is permanently reserved. Hot-remove not yet implemented. */ | |
| 52 | − new_res = request_mem_region(kmem_start, kmem_size, dev_name(dev)); | |
| 52 | + new_res_name = kstrdup(dev_name(dev), GFP_KERNEL); | |
| 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 | 58 | if (!new_res) { |
| 54 | 59 | dev_warn(dev, "could not reserve region [%pa-%pa]\n", |
| 55 | 60 | &kmem_start, &kmem_end); |
| 61 | + kfree(new_res_name); | |
| 56 | 62 | return -EBUSY; |
| 57 | 63 | } |
| 58 | 64 | |
| @@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev) · 4 unmodified lines | ||
| 63 | 69 | * unknown to us that will break add_memory() below. |
| 64 | 70 | */ |
| 65 | 71 | new_res->flags = IORESOURCE_SYSTEM_RAM; |
| 66 | − new_res->name = dev_name(dev); | |
| 67 | 72 | |
| 68 | 73 | rc = add_memory(numa_node, new_res->start, resource_size(new_res)); |
| 69 | 74 | if (rc) { |
| 70 | 75 | release_resource(new_res); |
| 71 | 76 | kfree(new_res); |
| 77 | + kfree(new_res_name); | |
| 72 | 78 | return rc; |
| 73 | 79 | } |
| 74 | 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 | 89 | struct resource *res = dev_dax->dax_kmem_res; |
| 84 | 90 | resource_size_t kmem_start = res->start; |
| 85 | 91 | resource_size_t kmem_size = resource_size(res); |
| 92 | + const char *res_name = res->name; | |
| 86 | 93 | int rc; |
| 87 | 94 | |
| 88 | 95 | /* |
| @@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev) · 13 unmodified lines | ||
| 102 | 109 | /* Release and free dax resources */ |
| 103 | 110 | release_resource(res); |
| 104 | 111 | kfree(res); |
| 112 | + kfree(res_name); | |
| 105 | 113 | dev_dax->dax_kmem_res = NULL; |
| 106 | 114 | |
| 107 | 115 | return 0; |
| @@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, · 876 unmodified lines | ||
| 877 | 877 | rmcd_error("pinned %ld out of %ld pages", |
| 878 | 878 | pinned, nr_pages); |
| 879 | 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 | 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 | 16 | # Function splitter causes unnecessary splits in __asan_load1/__asan_store1 |
| 17 | 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) | |
| 19 | −CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | |
| 20 | −CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | |
| 21 | −CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | |
| 22 | −CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | |
| 23 | −CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | |
| 24 | −CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) | |
| 25 | −CFLAGS_tags_report.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) -DDISABLE_BRANCH_PROFILING | |
| 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) -DDISABLE_BRANCH_PROFILING | |
| 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) -DDISABLE_BRANCH_PROFILING | |
| 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) -DDISABLE_BRANCH_PROFILING | |
| 26 | 26 | |
| 27 | 27 | obj-$(CONFIG_KASAN) := common.o init.o report.o |
| 28 | 28 | obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o |
| @@ -15,7 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 18 | −#define DISABLE_BRANCH_PROFILING | |
| 19 | 18 | |
| 20 | 19 | #include <linux/export.h> |
| 21 | 20 | #include <linux/interrupt.h> |
| @@ -12,7 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 15 | −#define DISABLE_BRANCH_PROFILING | |
| 16 | 15 | |
| 17 | 16 | #include <linux/export.h> |
| 18 | 17 | #include <linux/interrupt.h> |
| @@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle) · 317 unmodified lines | ||
| 318 | 318 | slots = handle_to_slots(handle); |
| 319 | 319 | write_lock(&slots->lock); |
| 320 | 320 | *(unsigned long *)handle = 0; |
| 321 | − write_unlock(&slots->lock); | |
| 322 | − if (zhdr->slots == slots) | |
| 321 | + if (zhdr->slots == slots) { | |
| 322 | + write_unlock(&slots->lock); | |
| 323 | 323 | return; /* simple case, nothing else to do */ |
| 324 | + } | |
| 324 | 325 | |
| 325 | 326 | /* we are freeing a foreign handle if we are here */ |
| 326 | 327 | zhdr->foreign_handles--; |
| 327 | 328 | is_free = true; |
| 328 | − read_lock(&slots->lock); | |
| 329 | 329 | if (!test_bit(HANDLES_ORPHANED, &slots->pool)) { |
| 330 | − read_unlock(&slots->lock); | |
| 330 | + write_unlock(&slots->lock); | |
| 331 | 331 | return; |
| 332 | 332 | } |
| 333 | 333 | for (i = 0; i <= BUDDY_MASK; i++) { |
| @@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle) · 2 unmodified lines | ||
| 336 | 336 | break; |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | − read_unlock(&slots->lock); | |
| 339 | + write_unlock(&slots->lock); | |
| 340 | 340 | |
| 341 | 341 | if (is_free) { |
| 342 | 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 | 422 | zhdr->start_middle = 0; |
| 423 | 423 | zhdr->cpu = -1; |
| 424 | 424 | zhdr->foreign_handles = 0; |
| 425 | + zhdr->mapped_count = 0; | |
| 425 | 426 | zhdr->slots = slots; |
| 426 | 427 | zhdr->pool = pool; |
| 427 | 428 | INIT_LIST_HEAD(&zhdr->buddy); |
| @@ -6,6 +6,7 @@ map_populate · 5 unmodified lines | ||
| 6 | 6 | thuge-gen |
| 7 | 7 | compaction_test |
| 8 | 8 | mlock2-tests |
| 9 | +mremap_dontunmap | |
| 9 | 10 | on-fault-limit |
| 10 | 11 | transhuge-stress |
| 11 | 12 | userfaultfd |
| @@ -74,8 +74,6 @@ int main(int argc, char **argv) · 73 unmodified lines | ||
| 74 | 74 | int write = 0; |
| 75 | 75 | int reserve = 1; |
| 76 | 76 | |
| 77 | − unsigned long i; | |
| 78 | − | |
| 79 | 77 | if (signal(SIGINT, sig_handler) == SIG_ERR) |
| 80 | 78 | err(1, "\ncan't catch SIGINT\n"); |
| 81 | 79 | |