diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-25 19:59:11 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-25 19:59:11 -0400 |
| commit | 606c61a0579669c292dc5f5e1cf898edecfc0d53 (patch) | |
| tree | 569aa7e9b99571890bfccd7278bbc303cfa0a919 /include/linux | |
| parent | 15dbc136dff62ebefb03353cfb7d308d49b275f3 (diff) | |
| parent | 0fda2788b03c1868e2f20b3b7995b8cc2adf4715 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge fourth patch-bomb from Andrew Morton:
"A lot more stuff than expected, sorry. A bunch of ocfs2 reviewing was
finished off.
- mhocko's oom-reaper out-of-memory-handler changes
- ocfs2 fixes and features
- KASAN feature work
- various fixes"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (42 commits)
thp: fix typo in khugepaged_scan_pmd()
MAINTAINERS: fill entries for KASAN
mm/filemap: generic_file_read_iter(): check for zero reads unconditionally
kasan: test fix: warn if the UAF could not be detected in kmalloc_uaf2
mm, kasan: stackdepot implementation. Enable stackdepot for SLAB
arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections
mm, kasan: add GFP flags to KASAN API
mm, kasan: SLAB support
kasan: modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right()
include/linux/oom.h: remove undefined oom_kills_count()/note_oom_kill()
mm/page_alloc: prevent merging between isolated and other pageblocks
drivers/memstick/host/r592.c: avoid gcc-6 warning
ocfs2: extend enough credits for freeing one truncate record while replaying truncate records
ocfs2: extend transaction for ocfs2_remove_rightmost_path() and ocfs2_update_edge_lengths() before to avoid inconsistency between inode and et
ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert
ocfs2: solve a problem of crossing the boundary in updating backups
ocfs2: fix occurring deadlock by changing ocfs2_wq from global to local
ocfs2/dlm: fix BUG in dlm_move_lockres_to_recovery_list
ocfs2/dlm: fix race between convert and recovery
ocfs2: fix a deadlock issue in ocfs2_dio_end_io_write()
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/ftrace.h | 11 | ||||
| -rw-r--r-- | include/linux/interrupt.h | 20 | ||||
| -rw-r--r-- | include/linux/kasan.h | 31 | ||||
| -rw-r--r-- | include/linux/mm.h | 2 | ||||
| -rw-r--r-- | include/linux/oom.h | 4 | ||||
| -rw-r--r-- | include/linux/sched.h | 4 | ||||
| -rw-r--r-- | include/linux/slab.h | 10 | ||||
| -rw-r--r-- | include/linux/slab_def.h | 14 | ||||
| -rw-r--r-- | include/linux/slub_def.h | 11 | ||||
| -rw-r--r-- | include/linux/stackdepot.h | 32 |
10 files changed, 115 insertions, 24 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 6d9df3f7e334..dea12a6e413b 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
| @@ -811,16 +811,6 @@ ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth, | |||
| 811 | */ | 811 | */ |
| 812 | #define __notrace_funcgraph notrace | 812 | #define __notrace_funcgraph notrace |
| 813 | 813 | ||
| 814 | /* | ||
| 815 | * We want to which function is an entrypoint of a hardirq. | ||
| 816 | * That will help us to put a signal on output. | ||
| 817 | */ | ||
| 818 | #define __irq_entry __attribute__((__section__(".irqentry.text"))) | ||
| 819 | |||
| 820 | /* Limits of hardirq entrypoints */ | ||
| 821 | extern char __irqentry_text_start[]; | ||
| 822 | extern char __irqentry_text_end[]; | ||
| 823 | |||
| 824 | #define FTRACE_NOTRACE_DEPTH 65536 | 814 | #define FTRACE_NOTRACE_DEPTH 65536 |
| 825 | #define FTRACE_RETFUNC_DEPTH 50 | 815 | #define FTRACE_RETFUNC_DEPTH 50 |
| 826 | #define FTRACE_RETSTACK_ALLOC_SIZE 32 | 816 | #define FTRACE_RETSTACK_ALLOC_SIZE 32 |
| @@ -857,7 +847,6 @@ static inline void unpause_graph_tracing(void) | |||
| 857 | #else /* !CONFIG_FUNCTION_GRAPH_TRACER */ | 847 | #else /* !CONFIG_FUNCTION_GRAPH_TRACER */ |
| 858 | 848 | ||
| 859 | #define __notrace_funcgraph | 849 | #define __notrace_funcgraph |
| 860 | #define __irq_entry | ||
| 861 | #define INIT_FTRACE_GRAPH | 850 | #define INIT_FTRACE_GRAPH |
| 862 | 851 | ||
| 863 | static inline void ftrace_graph_init_task(struct task_struct *t) { } | 852 | static inline void ftrace_graph_init_task(struct task_struct *t) { } |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 358076eda364..9fcabeb07787 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
| @@ -683,4 +683,24 @@ extern int early_irq_init(void); | |||
| 683 | extern int arch_probe_nr_irqs(void); | 683 | extern int arch_probe_nr_irqs(void); |
| 684 | extern int arch_early_irq_init(void); | 684 | extern int arch_early_irq_init(void); |
| 685 | 685 | ||
| 686 | #if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN) | ||
| 687 | /* | ||
| 688 | * We want to know which function is an entrypoint of a hardirq or a softirq. | ||
| 689 | */ | ||
| 690 | #define __irq_entry __attribute__((__section__(".irqentry.text"))) | ||
| 691 | #define __softirq_entry \ | ||
| 692 | __attribute__((__section__(".softirqentry.text"))) | ||
| 693 | |||
| 694 | /* Limits of hardirq entrypoints */ | ||
| 695 | extern char __irqentry_text_start[]; | ||
| 696 | extern char __irqentry_text_end[]; | ||
| 697 | /* Limits of softirq entrypoints */ | ||
| 698 | extern char __softirqentry_text_start[]; | ||
| 699 | extern char __softirqentry_text_end[]; | ||
| 700 | |||
| 701 | #else | ||
| 702 | #define __irq_entry | ||
| 703 | #define __softirq_entry | ||
| 704 | #endif | ||
| 705 | |||
| 686 | #endif | 706 | #endif |
diff --git a/include/linux/kasan.h b/include/linux/kasan.h index 0fdc798e3ff7..737371b56044 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h | |||
| @@ -48,19 +48,28 @@ void kasan_unpoison_task_stack(struct task_struct *task); | |||
| 48 | void kasan_alloc_pages(struct page *page, unsigned int order); | 48 | void kasan_alloc_pages(struct page *page, unsigned int order); |
| 49 | void kasan_free_pages(struct page *page, unsigned int order); | 49 | void kasan_free_pages(struct page *page, unsigned int order); |
| 50 | 50 | ||
| 51 | void kasan_cache_create(struct kmem_cache *cache, size_t *size, | ||
| 52 | unsigned long *flags); | ||
| 53 | |||
| 51 | void kasan_poison_slab(struct page *page); | 54 | void kasan_poison_slab(struct page *page); |
| 52 | void kasan_unpoison_object_data(struct kmem_cache *cache, void *object); | 55 | void kasan_unpoison_object_data(struct kmem_cache *cache, void *object); |
| 53 | void kasan_poison_object_data(struct kmem_cache *cache, void *object); | 56 | void kasan_poison_object_data(struct kmem_cache *cache, void *object); |
| 54 | 57 | ||
| 55 | void kasan_kmalloc_large(const void *ptr, size_t size); | 58 | void kasan_kmalloc_large(const void *ptr, size_t size, gfp_t flags); |
| 56 | void kasan_kfree_large(const void *ptr); | 59 | void kasan_kfree_large(const void *ptr); |
| 57 | void kasan_kfree(void *ptr); | 60 | void kasan_kfree(void *ptr); |
| 58 | void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size); | 61 | void kasan_kmalloc(struct kmem_cache *s, const void *object, size_t size, |
| 59 | void kasan_krealloc(const void *object, size_t new_size); | 62 | gfp_t flags); |
| 63 | void kasan_krealloc(const void *object, size_t new_size, gfp_t flags); | ||
| 60 | 64 | ||
| 61 | void kasan_slab_alloc(struct kmem_cache *s, void *object); | 65 | void kasan_slab_alloc(struct kmem_cache *s, void *object, gfp_t flags); |
| 62 | void kasan_slab_free(struct kmem_cache *s, void *object); | 66 | void kasan_slab_free(struct kmem_cache *s, void *object); |
| 63 | 67 | ||
| 68 | struct kasan_cache { | ||
| 69 | int alloc_meta_offset; | ||
| 70 | int free_meta_offset; | ||
| 71 | }; | ||
| 72 | |||
| 64 | int kasan_module_alloc(void *addr, size_t size); | 73 | int kasan_module_alloc(void *addr, size_t size); |
| 65 | void kasan_free_shadow(const struct vm_struct *vm); | 74 | void kasan_free_shadow(const struct vm_struct *vm); |
| 66 | 75 | ||
| @@ -76,20 +85,26 @@ static inline void kasan_disable_current(void) {} | |||
| 76 | static inline void kasan_alloc_pages(struct page *page, unsigned int order) {} | 85 | static inline void kasan_alloc_pages(struct page *page, unsigned int order) {} |
| 77 | static inline void kasan_free_pages(struct page *page, unsigned int order) {} | 86 | static inline void kasan_free_pages(struct page *page, unsigned int order) {} |
| 78 | 87 | ||
| 88 | static inline void kasan_cache_create(struct kmem_cache *cache, | ||
| 89 | size_t *size, | ||
| 90 | unsigned long *flags) {} | ||
| 91 | |||
| 79 | static inline void kasan_poison_slab(struct page *page) {} | 92 | static inline void kasan_poison_slab(struct page *page) {} |
| 80 | static inline void kasan_unpoison_object_data(struct kmem_cache *cache, | 93 | static inline void kasan_unpoison_object_data(struct kmem_cache *cache, |
| 81 | void *object) {} | 94 | void *object) {} |
| 82 | static inline void kasan_poison_object_data(struct kmem_cache *cache, | 95 | static inline void kasan_poison_object_data(struct kmem_cache *cache, |
| 83 | void *object) {} | 96 | void *object) {} |
| 84 | 97 | ||
| 85 | static inline void kasan_kmalloc_large(void *ptr, size_t size) {} | 98 | static inline void kasan_kmalloc_large(void *ptr, size_t size, gfp_t flags) {} |
| 86 | static inline void kasan_kfree_large(const void *ptr) {} | 99 | static inline void kasan_kfree_large(const void *ptr) {} |
| 87 | static inline void kasan_kfree(void *ptr) {} | 100 | static inline void kasan_kfree(void *ptr) {} |
| 88 | static inline void kasan_kmalloc(struct kmem_cache *s, const void *object, | 101 | static inline void kasan_kmalloc(struct kmem_cache *s, const void *object, |
| 89 | size_t size) {} | 102 | size_t size, gfp_t flags) {} |
| 90 | static inline void kasan_krealloc(const void *object, size_t new_size) {} | 103 | static inline void kasan_krealloc(const void *object, size_t new_size, |
| 104 | gfp_t flags) {} | ||
| 91 | 105 | ||
| 92 | static inline void kasan_slab_alloc(struct kmem_cache *s, void *object) {} | 106 | static inline void kasan_slab_alloc(struct kmem_cache *s, void *object, |
| 107 | gfp_t flags) {} | ||
| 93 | static inline void kasan_slab_free(struct kmem_cache *s, void *object) {} | 108 | static inline void kasan_slab_free(struct kmem_cache *s, void *object) {} |
| 94 | 109 | ||
| 95 | static inline int kasan_module_alloc(void *addr, size_t size) { return 0; } | 110 | static inline int kasan_module_alloc(void *addr, size_t size) { return 0; } |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 450fc977ed02..ed6407d1b7b5 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1132,6 +1132,8 @@ struct zap_details { | |||
| 1132 | struct address_space *check_mapping; /* Check page->mapping if set */ | 1132 | struct address_space *check_mapping; /* Check page->mapping if set */ |
| 1133 | pgoff_t first_index; /* Lowest page->index to unmap */ | 1133 | pgoff_t first_index; /* Lowest page->index to unmap */ |
| 1134 | pgoff_t last_index; /* Highest page->index to unmap */ | 1134 | pgoff_t last_index; /* Highest page->index to unmap */ |
| 1135 | bool ignore_dirty; /* Ignore dirty pages */ | ||
| 1136 | bool check_swap_entries; /* Check also swap entries */ | ||
| 1135 | }; | 1137 | }; |
| 1136 | 1138 | ||
| 1137 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | 1139 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, |
diff --git a/include/linux/oom.h b/include/linux/oom.h index 03e6257321f0..628a43242a34 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
| @@ -76,8 +76,6 @@ extern unsigned long oom_badness(struct task_struct *p, | |||
| 76 | struct mem_cgroup *memcg, const nodemask_t *nodemask, | 76 | struct mem_cgroup *memcg, const nodemask_t *nodemask, |
| 77 | unsigned long totalpages); | 77 | unsigned long totalpages); |
| 78 | 78 | ||
| 79 | extern int oom_kills_count(void); | ||
| 80 | extern void note_oom_kill(void); | ||
| 81 | extern void oom_kill_process(struct oom_control *oc, struct task_struct *p, | 79 | extern void oom_kill_process(struct oom_control *oc, struct task_struct *p, |
| 82 | unsigned int points, unsigned long totalpages, | 80 | unsigned int points, unsigned long totalpages, |
| 83 | struct mem_cgroup *memcg, const char *message); | 81 | struct mem_cgroup *memcg, const char *message); |
| @@ -91,7 +89,7 @@ extern enum oom_scan_t oom_scan_process_thread(struct oom_control *oc, | |||
| 91 | 89 | ||
| 92 | extern bool out_of_memory(struct oom_control *oc); | 90 | extern bool out_of_memory(struct oom_control *oc); |
| 93 | 91 | ||
| 94 | extern void exit_oom_victim(void); | 92 | extern void exit_oom_victim(struct task_struct *tsk); |
| 95 | 93 | ||
| 96 | extern int register_oom_notifier(struct notifier_block *nb); | 94 | extern int register_oom_notifier(struct notifier_block *nb); |
| 97 | extern int unregister_oom_notifier(struct notifier_block *nb); | 95 | extern int unregister_oom_notifier(struct notifier_block *nb); |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 589c4780b077..60bba7e032dc 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -426,6 +426,7 @@ extern signed long schedule_timeout(signed long timeout); | |||
| 426 | extern signed long schedule_timeout_interruptible(signed long timeout); | 426 | extern signed long schedule_timeout_interruptible(signed long timeout); |
| 427 | extern signed long schedule_timeout_killable(signed long timeout); | 427 | extern signed long schedule_timeout_killable(signed long timeout); |
| 428 | extern signed long schedule_timeout_uninterruptible(signed long timeout); | 428 | extern signed long schedule_timeout_uninterruptible(signed long timeout); |
| 429 | extern signed long schedule_timeout_idle(signed long timeout); | ||
| 429 | asmlinkage void schedule(void); | 430 | asmlinkage void schedule(void); |
| 430 | extern void schedule_preempt_disabled(void); | 431 | extern void schedule_preempt_disabled(void); |
| 431 | 432 | ||
| @@ -1848,6 +1849,9 @@ struct task_struct { | |||
| 1848 | unsigned long task_state_change; | 1849 | unsigned long task_state_change; |
| 1849 | #endif | 1850 | #endif |
| 1850 | int pagefault_disabled; | 1851 | int pagefault_disabled; |
| 1852 | #ifdef CONFIG_MMU | ||
| 1853 | struct task_struct *oom_reaper_list; | ||
| 1854 | #endif | ||
| 1851 | /* CPU-specific state of this task */ | 1855 | /* CPU-specific state of this task */ |
| 1852 | struct thread_struct thread; | 1856 | struct thread_struct thread; |
| 1853 | /* | 1857 | /* |
diff --git a/include/linux/slab.h b/include/linux/slab.h index e4b568738ca3..508bd827e6dc 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
| @@ -92,6 +92,12 @@ | |||
| 92 | # define SLAB_ACCOUNT 0x00000000UL | 92 | # define SLAB_ACCOUNT 0x00000000UL |
| 93 | #endif | 93 | #endif |
| 94 | 94 | ||
| 95 | #ifdef CONFIG_KASAN | ||
| 96 | #define SLAB_KASAN 0x08000000UL | ||
| 97 | #else | ||
| 98 | #define SLAB_KASAN 0x00000000UL | ||
| 99 | #endif | ||
| 100 | |||
| 95 | /* The following flags affect the page allocator grouping pages by mobility */ | 101 | /* The following flags affect the page allocator grouping pages by mobility */ |
| 96 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ | 102 | #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ |
| 97 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ | 103 | #define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ |
| @@ -370,7 +376,7 @@ static __always_inline void *kmem_cache_alloc_trace(struct kmem_cache *s, | |||
| 370 | { | 376 | { |
| 371 | void *ret = kmem_cache_alloc(s, flags); | 377 | void *ret = kmem_cache_alloc(s, flags); |
| 372 | 378 | ||
| 373 | kasan_kmalloc(s, ret, size); | 379 | kasan_kmalloc(s, ret, size, flags); |
| 374 | return ret; | 380 | return ret; |
| 375 | } | 381 | } |
| 376 | 382 | ||
| @@ -381,7 +387,7 @@ kmem_cache_alloc_node_trace(struct kmem_cache *s, | |||
| 381 | { | 387 | { |
| 382 | void *ret = kmem_cache_alloc_node(s, gfpflags, node); | 388 | void *ret = kmem_cache_alloc_node(s, gfpflags, node); |
| 383 | 389 | ||
| 384 | kasan_kmalloc(s, ret, size); | 390 | kasan_kmalloc(s, ret, size, gfpflags); |
| 385 | return ret; | 391 | return ret; |
| 386 | } | 392 | } |
| 387 | #endif /* CONFIG_TRACING */ | 393 | #endif /* CONFIG_TRACING */ |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index e878ba35ae91..9edbbf352340 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
| @@ -76,8 +76,22 @@ struct kmem_cache { | |||
| 76 | #ifdef CONFIG_MEMCG | 76 | #ifdef CONFIG_MEMCG |
| 77 | struct memcg_cache_params memcg_params; | 77 | struct memcg_cache_params memcg_params; |
| 78 | #endif | 78 | #endif |
| 79 | #ifdef CONFIG_KASAN | ||
| 80 | struct kasan_cache kasan_info; | ||
| 81 | #endif | ||
| 79 | 82 | ||
| 80 | struct kmem_cache_node *node[MAX_NUMNODES]; | 83 | struct kmem_cache_node *node[MAX_NUMNODES]; |
| 81 | }; | 84 | }; |
| 82 | 85 | ||
| 86 | static inline void *nearest_obj(struct kmem_cache *cache, struct page *page, | ||
| 87 | void *x) { | ||
| 88 | void *object = x - (x - page->s_mem) % cache->size; | ||
| 89 | void *last_object = page->s_mem + (cache->num - 1) * cache->size; | ||
| 90 | |||
| 91 | if (unlikely(object > last_object)) | ||
| 92 | return last_object; | ||
| 93 | else | ||
| 94 | return object; | ||
| 95 | } | ||
| 96 | |||
| 83 | #endif /* _LINUX_SLAB_DEF_H */ | 97 | #endif /* _LINUX_SLAB_DEF_H */ |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index ac5143f95ee6..665cd0cd18b8 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
| @@ -130,4 +130,15 @@ static inline void *virt_to_obj(struct kmem_cache *s, | |||
| 130 | void object_err(struct kmem_cache *s, struct page *page, | 130 | void object_err(struct kmem_cache *s, struct page *page, |
| 131 | u8 *object, char *reason); | 131 | u8 *object, char *reason); |
| 132 | 132 | ||
| 133 | static inline void *nearest_obj(struct kmem_cache *cache, struct page *page, | ||
| 134 | void *x) { | ||
| 135 | void *object = x - (x - page_address(page)) % cache->size; | ||
| 136 | void *last_object = page_address(page) + | ||
| 137 | (page->objects - 1) * cache->size; | ||
| 138 | if (unlikely(object > last_object)) | ||
| 139 | return last_object; | ||
| 140 | else | ||
| 141 | return object; | ||
| 142 | } | ||
| 143 | |||
| 133 | #endif /* _LINUX_SLUB_DEF_H */ | 144 | #endif /* _LINUX_SLUB_DEF_H */ |
diff --git a/include/linux/stackdepot.h b/include/linux/stackdepot.h new file mode 100644 index 000000000000..7978b3e2c1e1 --- /dev/null +++ b/include/linux/stackdepot.h | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | /* | ||
| 2 | * A generic stack depot implementation | ||
| 3 | * | ||
| 4 | * Author: Alexander Potapenko <glider@google.com> | ||
| 5 | * Copyright (C) 2016 Google, Inc. | ||
| 6 | * | ||
| 7 | * Based on code by Dmitry Chernenkov. | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License as published by | ||
| 11 | * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | * (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | * GNU General Public License for more details. | ||
| 18 | * | ||
| 19 | */ | ||
| 20 | |||
| 21 | #ifndef _LINUX_STACKDEPOT_H | ||
| 22 | #define _LINUX_STACKDEPOT_H | ||
| 23 | |||
| 24 | typedef u32 depot_stack_handle_t; | ||
| 25 | |||
| 26 | struct stack_trace; | ||
| 27 | |||
| 28 | depot_stack_handle_t depot_save_stack(struct stack_trace *trace, gfp_t flags); | ||
| 29 | |||
| 30 | void depot_fetch_stack(depot_stack_handle_t handle, struct stack_trace *trace); | ||
| 31 | |||
| 32 | #endif | ||
