History

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

Linus Torvalds committed 6 years ago

Commit 423b8ba2 parents 23f0dac ca6edee12 files · +46 −28Browse files

Unified · Split

12 files
  1. MAINTAINERS +6 −1
  2. arch/sh/include/uapi/asm/sockios.h +2 −0
  3. arch/sparc/mm/srmmu.c +1 −1
  4. arch/x86/include/asm/bitops.h +6 −6
  5. drivers/dax/kmem.c +11 −3
  6. drivers/rapidio/devices/rio_mport_cdev.c +5 −0
  7. mm/kasan/Makefile +8 −8
  8. mm/kasan/generic.c +0 −1
  9. mm/kasan/tags.c +0 −1
  10. mm/z3fold.c +6 −5
  11. tools/testing/selftests/vm/.gitignore +1 −0
  12. tools/testing/selftests/vm/write_to_hugetlbfs.c +0 −2
MAINTAINERS+6−1
@@ -7829,7 +7829,7 @@ T: git git://linuxtv.org/media_tree.git · 7828 unmodified lines
78297829 F: drivers/media/platform/sti/hva
78307830
78317831 HWPOISON MEMORY FAILURE HANDLING
7832−M: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
7832+M: Naoya Horiguchi <naoya.horiguchi@nec.com>
78337833 L: linux-mm@kvack.org
78347834 S: Maintained
78357835 F: mm/hwpoison-inject.c
@@ -9185,6 +9185,11 @@ L: kexec@lists.infradead.org · 1349 unmodified lines
91859185 S: Maintained
91869186 W: http://lse.sourceforge.net/kdump/
91879187 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
91889193
91899194 KEENE FM RADIO TRANSMITTER DRIVER
91909195 M: Hans Verkuil <hverkuil@xs4all.nl>
arch/sh/include/uapi/asm/sockios.h+2−0
@@ -2,6 +2,8 @@ · 1 unmodified line
22 #ifndef __ASM_SH_SOCKIOS_H
33 #define __ASM_SH_SOCKIOS_H
44
5+#include <linux/time_types.h>
6+
57 /* Socket-level I/O control calls. */
68 #define FIOGETOWN _IOR('f', 123, int)
79 #define FIOSETOWN _IOW('f', 124, int)
arch/sparc/mm/srmmu.c+1−1
@@ -333,7 +333,7 @@ static void __init srmmu_nocache_init(void) · 332 unmodified lines
333333 pgd = pgd_offset_k(vaddr);
334334 p4d = p4d_offset(__nocache_fix(pgd), vaddr);
335335 pud = pud_offset(__nocache_fix(p4d), vaddr);
336− pmd = pmd_offset(__nocache_fix(pgd), vaddr);
336+ pmd = pmd_offset(__nocache_fix(pud), vaddr);
337337 pte = pte_offset_kernel(__nocache_fix(pmd), vaddr);
338338
339339 pteval = ((paddr >> 4) | SRMMU_ET_PTE | SRMMU_PRIV);
arch/x86/include/asm/bitops.h+6−6
@@ -52,9 +52,9 @@ static __always_inline void · 51 unmodified lines
5252 arch_set_bit(long nr, volatile unsigned long *addr)
5353 {
5454 if (__builtin_constant_p(nr)) {
55− asm volatile(LOCK_PREFIX "orb %1,%0"
55+ asm volatile(LOCK_PREFIX "orb %b1,%0"
5656 : CONST_MASK_ADDR(nr, addr)
57− : "iq" (CONST_MASK(nr) & 0xff)
57+ : "iq" (CONST_MASK(nr))
5858 : "memory");
5959 } else {
6060 asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0"
@@ -72,9 +72,9 @@ static __always_inline void · 11 unmodified lines
7272 arch_clear_bit(long nr, volatile unsigned long *addr)
7373 {
7474 if (__builtin_constant_p(nr)) {
75− asm volatile(LOCK_PREFIX "andb %1,%0"
75+ asm volatile(LOCK_PREFIX "andb %b1,%0"
7676 : CONST_MASK_ADDR(nr, addr)
77− : "iq" (CONST_MASK(nr) ^ 0xff));
77+ : "iq" (~CONST_MASK(nr)));
7878 } else {
7979 asm volatile(LOCK_PREFIX __ASM_SIZE(btr) " %1,%0"
8080 : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
@@ -123,9 +123,9 @@ static __always_inline void · 42 unmodified lines
123123 arch_change_bit(long nr, volatile unsigned long *addr)
124124 {
125125 if (__builtin_constant_p(nr)) {
126− asm volatile(LOCK_PREFIX "xorb %1,%0"
126+ asm volatile(LOCK_PREFIX "xorb %b1,%0"
127127 : CONST_MASK_ADDR(nr, addr)
128− : "iq" ((u8)CONST_MASK(nr)));
128+ : "iq" (CONST_MASK(nr)));
129129 } else {
130130 asm volatile(LOCK_PREFIX __ASM_SIZE(btc) " %1,%0"
131131 : : RLONG_ADDR(addr), "Ir" (nr) : "memory");
drivers/dax/kmem.c+11−3
@@ -22,6 +22,7 @@ int dev_dax_kmem_probe(struct device *dev) · 21 unmodified lines
2222 resource_size_t kmem_size;
2323 resource_size_t kmem_end;
2424 struct resource *new_res;
25+ const char *new_res_name;
2526 int numa_node;
2627 int rc;
2728
@@ -48,11 +49,16 @@ int dev_dax_kmem_probe(struct device *dev) · 20 unmodified lines
4849 kmem_size &= ~(memory_block_size_bytes() - 1);
4950 kmem_end = kmem_start + kmem_size;
5051
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);
5358 if (!new_res) {
5459 dev_warn(dev, "could not reserve region [%pa-%pa]\n",
5560 &kmem_start, &kmem_end);
61+ kfree(new_res_name);
5662 return -EBUSY;
5763 }
5864
@@ -63,12 +69,12 @@ int dev_dax_kmem_probe(struct device *dev) · 4 unmodified lines
6369 * unknown to us that will break add_memory() below.
6470 */
6571 new_res->flags = IORESOURCE_SYSTEM_RAM;
66− new_res->name = dev_name(dev);
6772
6873 rc = add_memory(numa_node, new_res->start, resource_size(new_res));
6974 if (rc) {
7075 release_resource(new_res);
7176 kfree(new_res);
77+ kfree(new_res_name);
7278 return rc;
7379 }
7480 dev_dax->dax_kmem_res = new_res;
@@ -83,6 +89,7 @@ static int dev_dax_kmem_remove(struct device *dev) · 8 unmodified lines
8389 struct resource *res = dev_dax->dax_kmem_res;
8490 resource_size_t kmem_start = res->start;
8591 resource_size_t kmem_size = resource_size(res);
92+ const char *res_name = res->name;
8693 int rc;
8794
8895 /*
@@ -102,6 +109,7 @@ static int dev_dax_kmem_remove(struct device *dev) · 13 unmodified lines
102109 /* Release and free dax resources */
103110 release_resource(res);
104111 kfree(res);
112+ kfree(res_name);
105113 dev_dax->dax_kmem_res = NULL;
106114
107115 return 0;
drivers/rapidio/devices/rio_mport_cdev.c+5−0
@@ -877,6 +877,11 @@ rio_dma_transfer(struct file *filp, u32 transfer_mode, · 876 unmodified lines
877877 rmcd_error("pinned %ld out of %ld pages",
878878 pinned, nr_pages);
879879 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;
880885 goto err_pg;
881886 }
882887
mm/kasan/Makefile+8−8
@@ -15,14 +15,14 @@ CFLAGS_REMOVE_tags_report.o = $(CC_FLAGS_FTRACE) · 14 unmodified lines
1515
1616 # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
1717 # 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
2626
2727 obj-$(CONFIG_KASAN) := common.o init.o report.o
2828 obj-$(CONFIG_KASAN_GENERIC) += generic.o generic_report.o quarantine.o
mm/kasan/generic.c+0−1
@@ -15,7 +15,6 @@ · 14 unmodified lines
1515 */
1616
1717 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18−#define DISABLE_BRANCH_PROFILING
1918
2019 #include <linux/export.h>
2120 #include <linux/interrupt.h>
mm/kasan/tags.c+0−1
@@ -12,7 +12,6 @@ · 11 unmodified lines
1212 */
1313
1414 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
15−#define DISABLE_BRANCH_PROFILING
1615
1716 #include <linux/export.h>
1817 #include <linux/interrupt.h>
mm/z3fold.c+6−5
@@ -318,16 +318,16 @@ static inline void free_handle(unsigned long handle) · 317 unmodified lines
318318 slots = handle_to_slots(handle);
319319 write_lock(&slots->lock);
320320 *(unsigned long *)handle = 0;
321− write_unlock(&slots->lock);
322− if (zhdr->slots == slots)
321+ if (zhdr->slots == slots) {
322+ write_unlock(&slots->lock);
323323 return; /* simple case, nothing else to do */
324+ }
324325
325326 /* we are freeing a foreign handle if we are here */
326327 zhdr->foreign_handles--;
327328 is_free = true;
328− read_lock(&slots->lock);
329329 if (!test_bit(HANDLES_ORPHANED, &slots->pool)) {
330− read_unlock(&slots->lock);
330+ write_unlock(&slots->lock);
331331 return;
332332 }
333333 for (i = 0; i <= BUDDY_MASK; i++) {
@@ -336,7 +336,7 @@ static inline void free_handle(unsigned long handle) · 2 unmodified lines
336336 break;
337337 }
338338 }
339− read_unlock(&slots->lock);
339+ write_unlock(&slots->lock);
340340
341341 if (is_free) {
342342 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
422422 zhdr->start_middle = 0;
423423 zhdr->cpu = -1;
424424 zhdr->foreign_handles = 0;
425+ zhdr->mapped_count = 0;
425426 zhdr->slots = slots;
426427 zhdr->pool = pool;
427428 INIT_LIST_HEAD(&zhdr->buddy);
tools/testing/selftests/vm/.gitignore+1−0
@@ -6,6 +6,7 @@ map_populate · 5 unmodified lines
66 thuge-gen
77 compaction_test
88 mlock2-tests
9+mremap_dontunmap
910 on-fault-limit
1011 transhuge-stress
1112 userfaultfd
tools/testing/selftests/vm/write_to_hugetlbfs.c+0−2
@@ -74,8 +74,6 @@ int main(int argc, char **argv) · 73 unmodified lines
7474 int write = 0;
7575 int reserve = 1;
7676
77− unsigned long i;
78−
7977 if (signal(SIGINT, sig_handler) == SIG_ERR)
8078 err(1, "\ncan't catch SIGINT\n");
8179

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t