Commit 423b8baf authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'akpm' (patches from Andrew)

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
parents 23f0dac8 ca6edee6
...@@ -7829,7 +7829,7 @@ T: git git://linuxtv.org/media_tree.git ...@@ -7829,7 +7829,7 @@ T: git git://linuxtv.org/media_tree.git
F: drivers/media/platform/sti/hva F: drivers/media/platform/sti/hva
HWPOISON MEMORY FAILURE HANDLING HWPOISON MEMORY FAILURE HANDLING
M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> M: Naoya Horiguchi <naoya.horiguchi@nec.com>
L: linux-mm@kvack.org L: linux-mm@kvack.org
S: Maintained S: Maintained
F: mm/hwpoison-inject.c F: mm/hwpoison-inject.c
...@@ -9185,6 +9185,11 @@ L: kexec@lists.infradead.org ...@@ -9185,6 +9185,11 @@ L: kexec@lists.infradead.org
S: Maintained S: Maintained
W: http://lse.sourceforge.net/kdump/ W: http://lse.sourceforge.net/kdump/
F: Documentation/admin-guide/kdump/ F: Documentation/admin-guide/kdump/
F: fs/proc/vmcore.c
F: include/linux/crash_core.h
F: include/linux/crash_dump.h
F: include/uapi/linux/vmcore.h
F: kernel/crash_*.c
KEENE FM RADIO TRANSMITTER DRIVER KEENE FM RADIO TRANSMITTER DRIVER
M: Hans Verkuil <hverkuil@xs4all.nl> M: Hans Verkuil <hverkuil@xs4all.nl>
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#ifndef __ASM_SH_SOCKIOS_H #ifndef __ASM_SH_SOCKIOS_H
#define __ASM_SH_SOCKIOS_H #define __ASM_SH_SOCKIOS_H
#include <linux/time_types.h>
/* Socket-level I/O control calls. */ /* Socket-level I/O control calls. */
#define FIOGETOWN _IOR('f', 123, int) #define FIOGETOWN _IOR('f', 123, int)
#define FIOSETOWN _IOW('f', 124, int) #define FIOSETOWN _IOW('f', 124, int)
......
...@@ -333,7 +333,7 @@ static void __init srmmu_nocache_init(void) ...@@ -333,7 +333,7 @@ static void __init srmmu_nocache_init(void)
pgd = pgd_offset_k(vaddr); pgd = pgd_offset_k(vaddr);
p4d = p4d_offset(__nocache_fix(pgd), vaddr); p4d = p4d_offset(__nocache_fix(pgd), vaddr);
pud = pud_offset(__nocache_fix(p4d), vaddr); pud = pud_offset(__nocache_fix(p4d), vaddr);
pmd = pmd_offset(__nocache_fix(pgd), vaddr); pmd = pmd_offset(__nocache_fix(pud), vaddr);
pte = pte_offset_kernel(__nocache_fix(pmd), vaddr); pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV); pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
......
...@@ -52,9 +52,9 @@ static __always_inline void ...@@ -52,9 +52,9 @@ static __always_inline void
arch_set_bit(long nr, volatile unsigned long *addr) arch_set_bit(long nr, volatile unsigned long *addr)
{ {
if (__builtin_constant_p(nr)) { if (__builtin_constant_p(nr)) {
asm volatile(LOCK_PREFIX "orb %1,%0" asm volatile(LOCK_PREFIX "orb %b1,%0"
: CONST_MASK_ADDR(nr, addr) : CONST_MASK_ADDR(nr, addr)
: "iq" (CONST_MASK(nr) & 0xff) : "iq" (CONST_MASK(nr))
: "memory"); : "memory");
} else { } else {
asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0" asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
...@@ -72,9 +72,9 @@ static __always_inline void ...@@ -72,9 +72,9 @@ static __always_inline void
arch_clear_bit(long nr, volatile unsigned long *addr) arch_clear_bit(long nr, volatile unsigned long *addr)
{ {
if (__builtin_constant_p(nr)) { if (__builtin_constant_p(nr)) {
asm volatile(LOCK_PREFIX "andb %1,%0" asm volatile(LOCK_PREFIX "andb %b1,%0"
: CONST_MASK_ADDR(nr, addr) : CONST_MASK_ADDR(nr, addr)
: "iq" (CONST_MASK(nr) ^ 0xff)); : "iq" (~CONST_MASK(nr)));
} else { } else {
asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0" asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
: : RLONG_ADDR(addr), "Ir" (nr) : "memory"); : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
...@@ -123,9 +123,9 @@ static __always_inline void ...@@ -123,9 +123,9 @@ static __always_inline void
arch_change_bit(long nr, volatile unsigned long *addr) arch_change_bit(long nr, volatile unsigned long *addr)
{ {
if (__builtin_constant_p(nr)) { if (__builtin_constant_p(nr)) {
asm volatile(LOCK_PREFIX "xorb %1,%0" asm volatile(LOCK_PREFIX "xorb %b1,%0"
: CONST_MASK_ADDR(nr, addr) : CONST_MASK_ADDR(nr, addr)
: "iq" ((u8)CONST_MASK(nr))); : "iq" (CONST_MASK(nr)));
} else { } else {
asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0" asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
: : RLONG_ADDR(addr), "Ir" (nr) : "memory"); : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
......
...@@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev) ...@@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev)
resource_size_t kmem_size; resource_size_t kmem_size;
resource_size_t kmem_end; resource_size_t kmem_end;
struct resource *new_res; struct resource *new_res;
const char *new_res_name;
int numa_node; int numa_node;
int rc; int rc;
...@@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev) ...@@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev)
kmem_size &= ~(memory_block_size_bytes() - 1); kmem_size &= ~(memory_block_size_bytes() - 1);
kmem_end = kmem_start + kmem_size; kmem_end = kmem_start + kmem_size;
/* Region is permanently reserved. Hot-remove not yet implemented. */ new_res_name = kstrdup(dev_name(dev), GFP_KERNEL);
new_res = request_mem_region(kmem_start, kmem_size, dev_name(dev)); if (!new_res_name)
return -ENOMEM;
/* Region is permanently reserved if hotremove fails. */
new_res = request_mem_region(kmem_start, kmem_size, new_res_name);
if (!new_res) { if (!new_res) {
dev_warn(dev, "could not reserve region [%pa-%pa]\n", dev_warn(dev, "could not reserve region [%pa-%pa]\n",
&kmem_start, &kmem_end); &kmem_start, &kmem_end);
kfree(new_res_name);
return -EBUSY; return -EBUSY;
} }
...@@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev) ...@@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev)
* unknown to us that will break add_memory() below. * unknown to us that will break add_memory() below.
*/ */
new_res->flags = IORESOURCE_SYSTEM_RAM; new_res->flags = IORESOURCE_SYSTEM_RAM;
new_res->name = dev_name(dev);
rc = add_memory(numa_node, new_res->start, resource_size(new_res)); rc = add_memory(numa_node, new_res->start, resource_size(new_res));
if (rc) { if (rc) {
release_resource(new_res); release_resource(new_res);
kfree(new_res); kfree(new_res);
kfree(new_res_name);
return rc; return rc;
} }
dev_dax->dax_kmem_res = new_res; dev_dax->dax_kmem_res = new_res;
...@@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev) ...@@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev)
struct resource *res = dev_dax->dax_kmem_res; struct resource *res = dev_dax->dax_kmem_res;
resource_size_t kmem_start = res->start; resource_size_t kmem_start = res->start;
resource_size_t kmem_size = resource_size(res); resource_size_t kmem_size = resource_size(res);
const char *res_name = res->name;
int rc; int rc;
/* /*
...@@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev) ...@@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev)
/* Release and free dax resources */ /* Release and free dax resources */
release_resource(res); release_resource(res);
kfree(res); kfree(res);
kfree(res_name);
dev_dax->dax_kmem_res = NULL; dev_dax->dax_kmem_res = NULL;
return 0; return 0;
......
...@@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, ...@@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode,
rmcd_error("pinned %ld out of %ld pages", rmcd_error("pinned %ld out of %ld pages",
pinned, nr_pages); pinned, nr_pages);
ret = -EFAULT; ret = -EFAULT;
/*
* Set nr_pages up to mean "how many pages to unpin, in
* the error handler:
*/
nr_pages = pinned;
goto err_pg; goto err_pg;
} }
......
...@@ -15,14 +15,14 @@ CFLAGS_REMOVE_tags_report.o = $(CC_FLAGS_FTRACE) ...@@ -15,14 +15,14 @@ CFLAGS_REMOVE_tags_report.o = $(CC_FLAGS_FTRACE)
# Function splitter causes unnecessary splits in __asan_load1/__asan_store1 # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
# see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533 # see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63533
CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_init.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_quarantine.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
CFLAGS_tags_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) CFLAGS_tags_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) -DDISABLE_BRANCH_PROFILING
obj-$(CONFIG_KASAN) := common.o init.o report.o obj-$(CONFIG_KASAN) := common.o init.o report.o
obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DISABLE_BRANCH_PROFILING
#include <linux/export.h> #include <linux/export.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#define DISABLE_BRANCH_PROFILING
#include <linux/export.h> #include <linux/export.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
......
...@@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle) ...@@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle)
slots = handle_to_slots(handle); slots = handle_to_slots(handle);
write_lock(&slots->lock); write_lock(&slots->lock);
*(unsigned long *)handle = 0; *(unsigned long *)handle = 0;
write_unlock(&slots->lock); if (zhdr->slots == slots) {
if (zhdr->slots == slots) write_unlock(&slots->lock);
return; /* simple case, nothing else to do */ return; /* simple case, nothing else to do */
}
/* we are freeing a foreign handle if we are here */ /* we are freeing a foreign handle if we are here */
zhdr->foreign_handles--; zhdr->foreign_handles--;
is_free = true; is_free = true;
read_lock(&slots->lock);
if (!test_bit(HANDLES_ORPHANED, &slots->pool)) { if (!test_bit(HANDLES_ORPHANED, &slots->pool)) {
read_unlock(&slots->lock); write_unlock(&slots->lock);
return; return;
} }
for (i = 0; i <= BUDDY_MASK; i++) { for (i = 0; i <= BUDDY_MASK; i++) {
...@@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle) ...@@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle)
break; break;
} }
} }
read_unlock(&slots->lock); write_unlock(&slots->lock);
if (is_free) { if (is_free) {
struct z3fold_pool *pool = slots_to_pool(slots); struct z3fold_pool *pool = slots_to_pool(slots);
...@@ -422,6 +422,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless, ...@@ -422,6 +422,7 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless,
zhdr->start_middle = 0; zhdr->start_middle = 0;
zhdr->cpu = -1; zhdr->cpu = -1;
zhdr->foreign_handles = 0; zhdr->foreign_handles = 0;
zhdr->mapped_count = 0;
zhdr->slots = slots; zhdr->slots = slots;
zhdr->pool = pool; zhdr->pool = pool;
INIT_LIST_HEAD(&zhdr->buddy); INIT_LIST_HEAD(&zhdr->buddy);
......
...@@ -6,6 +6,7 @@ map_populate ...@@ -6,6 +6,7 @@ map_populate
thuge-gen thuge-gen
compaction_test compaction_test
mlock2-tests mlock2-tests
mremap_dontunmap
on-fault-limit on-fault-limit
transhuge-stress transhuge-stress
userfaultfd userfaultfd
......
...@@ -74,8 +74,6 @@ int main(int argc, char **argv) ...@@ -74,8 +74,6 @@ int main(int argc, char **argv)
int write = 0; int write = 0;
int reserve = 1; int reserve = 1;
unsigned long i;
if (signal(SIGINT, sig_handler) == SIG_ERR) if (signal(SIGINT, sig_handler) == SIG_ERR)
err(1, "\ncan't catch SIGINT\n"); err(1, "\ncan't catch SIGINT\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment