aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/auditsc.c13
-rw-r--r--kernel/cpu.c4
-rw-r--r--kernel/events/core.c2
-rw-r--r--kernel/events/uprobes.c8
-rw-r--r--kernel/fork.c32
-rw-r--r--kernel/sysctl.c3
-rw-r--r--kernel/trace/trace.c8
-rw-r--r--kernel/trace/trace_functions.c15
8 files changed, 23 insertions, 62 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 29e090cc0e46..f4a7756f999c 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1151,7 +1151,6 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
1151 const struct cred *cred; 1151 const struct cred *cred;
1152 char name[sizeof(tsk->comm)]; 1152 char name[sizeof(tsk->comm)];
1153 struct mm_struct *mm = tsk->mm; 1153 struct mm_struct *mm = tsk->mm;
1154 struct vm_area_struct *vma;
1155 char *tty; 1154 char *tty;
1156 1155
1157 if (!ab) 1156 if (!ab)
@@ -1191,16 +1190,8 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
1191 1190
1192 if (mm) { 1191 if (mm) {
1193 down_read(&mm->mmap_sem); 1192 down_read(&mm->mmap_sem);
1194 vma = mm->mmap; 1193 if (mm->exe_file)
1195 while (vma) { 1194 audit_log_d_path(ab, " exe=", &mm->exe_file->f_path);
1196 if ((vma->vm_flags & VM_EXECUTABLE) &&
1197 vma->vm_file) {
1198 audit_log_d_path(ab, " exe=",
1199 &vma->vm_file->f_path);
1200 break;
1201 }
1202 vma = vma->vm_next;
1203 }
1204 up_read(&mm->mmap_sem); 1195 up_read(&mm->mmap_sem);
1205 } 1196 }
1206 audit_log_task_context(ab); 1197 audit_log_task_context(ab);
diff --git a/kernel/cpu.c b/kernel/cpu.c
index f560598807c1..42bd331ee0ab 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -80,6 +80,10 @@ void put_online_cpus(void)
80 if (cpu_hotplug.active_writer == current) 80 if (cpu_hotplug.active_writer == current)
81 return; 81 return;
82 mutex_lock(&cpu_hotplug.lock); 82 mutex_lock(&cpu_hotplug.lock);
83
84 if (WARN_ON(!cpu_hotplug.refcount))
85 cpu_hotplug.refcount++; /* try to fix things up */
86
83 if (!--cpu_hotplug.refcount && unlikely(cpu_hotplug.active_writer)) 87 if (!--cpu_hotplug.refcount && unlikely(cpu_hotplug.active_writer))
84 wake_up_process(cpu_hotplug.active_writer); 88 wake_up_process(cpu_hotplug.active_writer);
85 mutex_unlock(&cpu_hotplug.lock); 89 mutex_unlock(&cpu_hotplug.lock);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index f16f3c58f11a..cda3ebd49e86 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3671,7 +3671,7 @@ unlock:
3671 atomic_inc(&event->mmap_count); 3671 atomic_inc(&event->mmap_count);
3672 mutex_unlock(&event->mmap_mutex); 3672 mutex_unlock(&event->mmap_mutex);
3673 3673
3674 vma->vm_flags |= VM_RESERVED; 3674 vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
3675 vma->vm_ops = &perf_mmap_vmops; 3675 vma->vm_ops = &perf_mmap_vmops;
3676 3676
3677 return ret; 3677 return ret;
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 912ef48d28ab..98256bc71ee1 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -141,10 +141,14 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
141 spinlock_t *ptl; 141 spinlock_t *ptl;
142 pte_t *ptep; 142 pte_t *ptep;
143 int err; 143 int err;
144 /* For mmu_notifiers */
145 const unsigned long mmun_start = addr;
146 const unsigned long mmun_end = addr + PAGE_SIZE;
144 147
145 /* For try_to_free_swap() and munlock_vma_page() below */ 148 /* For try_to_free_swap() and munlock_vma_page() below */
146 lock_page(page); 149 lock_page(page);
147 150
151 mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
148 err = -EAGAIN; 152 err = -EAGAIN;
149 ptep = page_check_address(page, mm, addr, &ptl, 0); 153 ptep = page_check_address(page, mm, addr, &ptl, 0);
150 if (!ptep) 154 if (!ptep)
@@ -173,6 +177,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
173 177
174 err = 0; 178 err = 0;
175 unlock: 179 unlock:
180 mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
176 unlock_page(page); 181 unlock_page(page);
177 return err; 182 return err;
178} 183}
@@ -735,7 +740,6 @@ static struct map_info *
735build_map_info(struct address_space *mapping, loff_t offset, bool is_register) 740build_map_info(struct address_space *mapping, loff_t offset, bool is_register)
736{ 741{
737 unsigned long pgoff = offset >> PAGE_SHIFT; 742 unsigned long pgoff = offset >> PAGE_SHIFT;
738 struct prio_tree_iter iter;
739 struct vm_area_struct *vma; 743 struct vm_area_struct *vma;
740 struct map_info *curr = NULL; 744 struct map_info *curr = NULL;
741 struct map_info *prev = NULL; 745 struct map_info *prev = NULL;
@@ -744,7 +748,7 @@ build_map_info(struct address_space *mapping, loff_t offset, bool is_register)
744 748
745 again: 749 again:
746 mutex_lock(&mapping->i_mmap_mutex); 750 mutex_lock(&mapping->i_mmap_mutex);
747 vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) { 751 vma_interval_tree_foreach(vma, &mapping->i_mmap, pgoff, pgoff) {
748 if (!valid_vma(vma, is_register)) 752 if (!valid_vma(vma, is_register))
749 continue; 753 continue;
750 754
diff --git a/kernel/fork.c b/kernel/fork.c
index a2b1efc20928..1cd7d581b3b2 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -423,7 +423,12 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
423 mapping->i_mmap_writable++; 423 mapping->i_mmap_writable++;
424 flush_dcache_mmap_lock(mapping); 424 flush_dcache_mmap_lock(mapping);
425 /* insert tmp into the share list, just after mpnt */ 425 /* insert tmp into the share list, just after mpnt */
426 vma_prio_tree_add(tmp, mpnt); 426 if (unlikely(tmp->vm_flags & VM_NONLINEAR))
427 vma_nonlinear_insert(tmp,
428 &mapping->i_mmap_nonlinear);
429 else
430 vma_interval_tree_insert_after(tmp, mpnt,
431 &mapping->i_mmap);
427 flush_dcache_mmap_unlock(mapping); 432 flush_dcache_mmap_unlock(mapping);
428 mutex_unlock(&mapping->i_mmap_mutex); 433 mutex_unlock(&mapping->i_mmap_mutex);
429 } 434 }
@@ -622,26 +627,6 @@ void mmput(struct mm_struct *mm)
622} 627}
623EXPORT_SYMBOL_GPL(mmput); 628EXPORT_SYMBOL_GPL(mmput);
624 629
625/*
626 * We added or removed a vma mapping the executable. The vmas are only mapped
627 * during exec and are not mapped with the mmap system call.
628 * Callers must hold down_write() on the mm's mmap_sem for these
629 */
630void added_exe_file_vma(struct mm_struct *mm)
631{
632 mm->num_exe_file_vmas++;
633}
634
635void removed_exe_file_vma(struct mm_struct *mm)
636{
637 mm->num_exe_file_vmas--;
638 if ((mm->num_exe_file_vmas == 0) && mm->exe_file) {
639 fput(mm->exe_file);
640 mm->exe_file = NULL;
641 }
642
643}
644
645void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file) 630void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
646{ 631{
647 if (new_exe_file) 632 if (new_exe_file)
@@ -649,15 +634,13 @@ void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
649 if (mm->exe_file) 634 if (mm->exe_file)
650 fput(mm->exe_file); 635 fput(mm->exe_file);
651 mm->exe_file = new_exe_file; 636 mm->exe_file = new_exe_file;
652 mm->num_exe_file_vmas = 0;
653} 637}
654 638
655struct file *get_mm_exe_file(struct mm_struct *mm) 639struct file *get_mm_exe_file(struct mm_struct *mm)
656{ 640{
657 struct file *exe_file; 641 struct file *exe_file;
658 642
659 /* We need mmap_sem to protect against races with removal of 643 /* We need mmap_sem to protect against races with removal of exe_file */
660 * VM_EXECUTABLE vmas */
661 down_read(&mm->mmap_sem); 644 down_read(&mm->mmap_sem);
662 exe_file = mm->exe_file; 645 exe_file = mm->exe_file;
663 if (exe_file) 646 if (exe_file)
@@ -1078,7 +1061,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1078 init_rwsem(&sig->group_rwsem); 1061 init_rwsem(&sig->group_rwsem);
1079#endif 1062#endif
1080 1063
1081 sig->oom_adj = current->signal->oom_adj;
1082 sig->oom_score_adj = current->signal->oom_score_adj; 1064 sig->oom_score_adj = current->signal->oom_score_adj;
1083 sig->oom_score_adj_min = current->signal->oom_score_adj_min; 1065 sig->oom_score_adj_min = current->signal->oom_score_adj_min;
1084 1066
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c2a2f8084bad..26f65eaa01f9 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1549,8 +1549,7 @@ static struct ctl_table fs_table[] = {
1549}; 1549};
1550 1550
1551static struct ctl_table debug_table[] = { 1551static struct ctl_table debug_table[] = {
1552#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_SPARC) || \ 1552#ifdef CONFIG_SYSCTL_EXCEPTION_TRACE
1553 defined(CONFIG_S390) || defined(CONFIG_TILE) || defined(CONFIG_ARM64)
1554 { 1553 {
1555 .procname = "exception-trace", 1554 .procname = "exception-trace",
1556 .data = &show_unhandled_signals, 1555 .data = &show_unhandled_signals,
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index cdcb59450b49..31e4f55773f1 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4200,12 +4200,6 @@ static void buffer_pipe_buf_release(struct pipe_inode_info *pipe,
4200 buf->private = 0; 4200 buf->private = 0;
4201} 4201}
4202 4202
4203static int buffer_pipe_buf_steal(struct pipe_inode_info *pipe,
4204 struct pipe_buffer *buf)
4205{
4206 return 1;
4207}
4208
4209static void buffer_pipe_buf_get(struct pipe_inode_info *pipe, 4203static void buffer_pipe_buf_get(struct pipe_inode_info *pipe,
4210 struct pipe_buffer *buf) 4204 struct pipe_buffer *buf)
4211{ 4205{
@@ -4221,7 +4215,7 @@ static const struct pipe_buf_operations buffer_pipe_buf_ops = {
4221 .unmap = generic_pipe_buf_unmap, 4215 .unmap = generic_pipe_buf_unmap,
4222 .confirm = generic_pipe_buf_confirm, 4216 .confirm = generic_pipe_buf_confirm,
4223 .release = buffer_pipe_buf_release, 4217 .release = buffer_pipe_buf_release,
4224 .steal = buffer_pipe_buf_steal, 4218 .steal = generic_pipe_buf_steal,
4225 .get = buffer_pipe_buf_get, 4219 .get = buffer_pipe_buf_get,
4226}; 4220};
4227 4221
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index 483162a9f908..507a7a9630bf 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -13,7 +13,6 @@
13#include <linux/debugfs.h> 13#include <linux/debugfs.h>
14#include <linux/uaccess.h> 14#include <linux/uaccess.h>
15#include <linux/ftrace.h> 15#include <linux/ftrace.h>
16#include <linux/pstore.h>
17#include <linux/fs.h> 16#include <linux/fs.h>
18 17
19#include "trace.h" 18#include "trace.h"
@@ -76,10 +75,9 @@ function_trace_call_preempt_only(unsigned long ip, unsigned long parent_ip,
76 preempt_enable_notrace(); 75 preempt_enable_notrace();
77} 76}
78 77
79/* Our two options */ 78/* Our option */
80enum { 79enum {
81 TRACE_FUNC_OPT_STACK = 0x1, 80 TRACE_FUNC_OPT_STACK = 0x1,
82 TRACE_FUNC_OPT_PSTORE = 0x2,
83}; 81};
84 82
85static struct tracer_flags func_flags; 83static struct tracer_flags func_flags;
@@ -109,12 +107,6 @@ function_trace_call(unsigned long ip, unsigned long parent_ip,
109 disabled = atomic_inc_return(&data->disabled); 107 disabled = atomic_inc_return(&data->disabled);
110 108
111 if (likely(disabled == 1)) { 109 if (likely(disabled == 1)) {
112 /*
113 * So far tracing doesn't support multiple buffers, so
114 * we make an explicit call for now.
115 */
116 if (unlikely(func_flags.val & TRACE_FUNC_OPT_PSTORE))
117 pstore_ftrace_call(ip, parent_ip);
118 pc = preempt_count(); 110 pc = preempt_count();
119 trace_function(tr, ip, parent_ip, flags, pc); 111 trace_function(tr, ip, parent_ip, flags, pc);
120 } 112 }
@@ -181,9 +173,6 @@ static struct tracer_opt func_opts[] = {
181#ifdef CONFIG_STACKTRACE 173#ifdef CONFIG_STACKTRACE
182 { TRACER_OPT(func_stack_trace, TRACE_FUNC_OPT_STACK) }, 174 { TRACER_OPT(func_stack_trace, TRACE_FUNC_OPT_STACK) },
183#endif 175#endif
184#ifdef CONFIG_PSTORE_FTRACE
185 { TRACER_OPT(func_pstore, TRACE_FUNC_OPT_PSTORE) },
186#endif
187 { } /* Always set a last empty entry */ 176 { } /* Always set a last empty entry */
188}; 177};
189 178
@@ -236,8 +225,6 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)
236 } 225 }
237 226
238 break; 227 break;
239 case TRACE_FUNC_OPT_PSTORE:
240 break;
241 default: 228 default:
242 return -EINVAL; 229 return -EINVAL;
243 } 230 }