aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/debug/gdbstub.c12
-rw-r--r--kernel/events/core.c6
-rw-r--r--kernel/exit.c2
-rw-r--r--kernel/fork.c10
-rw-r--r--kernel/printk.c10
-rw-r--r--kernel/stop_machine.c22
-rw-r--r--kernel/sys_ni.c4
-rw-r--r--kernel/sysctl.c9
-rw-r--r--kernel/watchdog.c4
9 files changed, 54 insertions, 25 deletions
diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c
index 34872482315e..c22d8c28ad84 100644
--- a/kernel/debug/gdbstub.c
+++ b/kernel/debug/gdbstub.c
@@ -217,7 +217,7 @@ void gdbstub_msg_write(const char *s, int len)
217 217
218 /* Pack in hex chars */ 218 /* Pack in hex chars */
219 for (i = 0; i < wcount; i++) 219 for (i = 0; i < wcount; i++)
220 bufptr = pack_hex_byte(bufptr, s[i]); 220 bufptr = hex_byte_pack(bufptr, s[i]);
221 *bufptr = '\0'; 221 *bufptr = '\0';
222 222
223 /* Move up */ 223 /* Move up */
@@ -249,7 +249,7 @@ char *kgdb_mem2hex(char *mem, char *buf, int count)
249 if (err) 249 if (err)
250 return NULL; 250 return NULL;
251 while (count > 0) { 251 while (count > 0) {
252 buf = pack_hex_byte(buf, *tmp); 252 buf = hex_byte_pack(buf, *tmp);
253 tmp++; 253 tmp++;
254 count--; 254 count--;
255 } 255 }
@@ -411,14 +411,14 @@ static char *pack_threadid(char *pkt, unsigned char *id)
411 limit = id + (BUF_THREAD_ID_SIZE / 2); 411 limit = id + (BUF_THREAD_ID_SIZE / 2);
412 while (id < limit) { 412 while (id < limit) {
413 if (!lzero || *id != 0) { 413 if (!lzero || *id != 0) {
414 pkt = pack_hex_byte(pkt, *id); 414 pkt = hex_byte_pack(pkt, *id);
415 lzero = 0; 415 lzero = 0;
416 } 416 }
417 id++; 417 id++;
418 } 418 }
419 419
420 if (lzero) 420 if (lzero)
421 pkt = pack_hex_byte(pkt, 0); 421 pkt = hex_byte_pack(pkt, 0);
422 422
423 return pkt; 423 return pkt;
424} 424}
@@ -486,7 +486,7 @@ static void gdb_cmd_status(struct kgdb_state *ks)
486 dbg_remove_all_break(); 486 dbg_remove_all_break();
487 487
488 remcom_out_buffer[0] = 'S'; 488 remcom_out_buffer[0] = 'S';
489 pack_hex_byte(&remcom_out_buffer[1], ks->signo); 489 hex_byte_pack(&remcom_out_buffer[1], ks->signo);
490} 490}
491 491
492static void gdb_get_regs_helper(struct kgdb_state *ks) 492static void gdb_get_regs_helper(struct kgdb_state *ks)
@@ -954,7 +954,7 @@ int gdb_serial_stub(struct kgdb_state *ks)
954 /* Reply to host that an exception has occurred */ 954 /* Reply to host that an exception has occurred */
955 ptr = remcom_out_buffer; 955 ptr = remcom_out_buffer;
956 *ptr++ = 'T'; 956 *ptr++ = 'T';
957 ptr = pack_hex_byte(ptr, ks->signo); 957 ptr = hex_byte_pack(ptr, ks->signo);
958 ptr += strlen(strcpy(ptr, "thread:")); 958 ptr += strlen(strcpy(ptr, "thread:"));
959 int_to_threadref(thref, shadow_pid(current->pid)); 959 int_to_threadref(thref, shadow_pid(current->pid));
960 ptr = pack_threadid(ptr, thref); 960 ptr = pack_threadid(ptr, thref);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index d1a1bee35228..12a0287e0358 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3544,7 +3544,7 @@ static void perf_mmap_close(struct vm_area_struct *vma)
3544 struct ring_buffer *rb = event->rb; 3544 struct ring_buffer *rb = event->rb;
3545 3545
3546 atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm); 3546 atomic_long_sub((size >> PAGE_SHIFT) + 1, &user->locked_vm);
3547 vma->vm_mm->locked_vm -= event->mmap_locked; 3547 vma->vm_mm->pinned_vm -= event->mmap_locked;
3548 rcu_assign_pointer(event->rb, NULL); 3548 rcu_assign_pointer(event->rb, NULL);
3549 mutex_unlock(&event->mmap_mutex); 3549 mutex_unlock(&event->mmap_mutex);
3550 3550
@@ -3625,7 +3625,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
3625 3625
3626 lock_limit = rlimit(RLIMIT_MEMLOCK); 3626 lock_limit = rlimit(RLIMIT_MEMLOCK);
3627 lock_limit >>= PAGE_SHIFT; 3627 lock_limit >>= PAGE_SHIFT;
3628 locked = vma->vm_mm->locked_vm + extra; 3628 locked = vma->vm_mm->pinned_vm + extra;
3629 3629
3630 if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() && 3630 if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() &&
3631 !capable(CAP_IPC_LOCK)) { 3631 !capable(CAP_IPC_LOCK)) {
@@ -3651,7 +3651,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
3651 atomic_long_add(user_extra, &user->locked_vm); 3651 atomic_long_add(user_extra, &user->locked_vm);
3652 event->mmap_locked = extra; 3652 event->mmap_locked = extra;
3653 event->mmap_user = get_current_user(); 3653 event->mmap_user = get_current_user();
3654 vma->vm_mm->locked_vm += event->mmap_locked; 3654 vma->vm_mm->pinned_vm += event->mmap_locked;
3655 3655
3656unlock: 3656unlock:
3657 if (!ret) 3657 if (!ret)
diff --git a/kernel/exit.c b/kernel/exit.c
index 2913b3509d42..d0b7d988f873 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -681,8 +681,6 @@ static void exit_mm(struct task_struct * tsk)
681 enter_lazy_tlb(mm, current); 681 enter_lazy_tlb(mm, current);
682 /* We don't want this task to be frozen prematurely */ 682 /* We don't want this task to be frozen prematurely */
683 clear_freeze_flag(tsk); 683 clear_freeze_flag(tsk);
684 if (tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
685 atomic_dec(&mm->oom_disable_count);
686 task_unlock(tsk); 684 task_unlock(tsk);
687 mm_update_next_owner(mm); 685 mm_update_next_owner(mm);
688 mmput(mm); 686 mmput(mm);
diff --git a/kernel/fork.c b/kernel/fork.c
index 8e6b6f4fb272..70d76191afb9 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -501,7 +501,6 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
501 mm->cached_hole_size = ~0UL; 501 mm->cached_hole_size = ~0UL;
502 mm_init_aio(mm); 502 mm_init_aio(mm);
503 mm_init_owner(mm, p); 503 mm_init_owner(mm, p);
504 atomic_set(&mm->oom_disable_count, 0);
505 504
506 if (likely(!mm_alloc_pgd(mm))) { 505 if (likely(!mm_alloc_pgd(mm))) {
507 mm->def_flags = 0; 506 mm->def_flags = 0;
@@ -816,8 +815,6 @@ good_mm:
816 /* Initializing for Swap token stuff */ 815 /* Initializing for Swap token stuff */
817 mm->token_priority = 0; 816 mm->token_priority = 0;
818 mm->last_interval = 0; 817 mm->last_interval = 0;
819 if (tsk->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
820 atomic_inc(&mm->oom_disable_count);
821 818
822 tsk->mm = mm; 819 tsk->mm = mm;
823 tsk->active_mm = mm; 820 tsk->active_mm = mm;
@@ -1391,13 +1388,8 @@ bad_fork_cleanup_io:
1391bad_fork_cleanup_namespaces: 1388bad_fork_cleanup_namespaces:
1392 exit_task_namespaces(p); 1389 exit_task_namespaces(p);
1393bad_fork_cleanup_mm: 1390bad_fork_cleanup_mm:
1394 if (p->mm) { 1391 if (p->mm)
1395 task_lock(p);
1396 if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN)
1397 atomic_dec(&p->mm->oom_disable_count);
1398 task_unlock(p);
1399 mmput(p->mm); 1392 mmput(p->mm);
1400 }
1401bad_fork_cleanup_signal: 1393bad_fork_cleanup_signal:
1402 if (!(clone_flags & CLONE_THREAD)) 1394 if (!(clone_flags & CLONE_THREAD))
1403 free_signal_struct(p->signal); 1395 free_signal_struct(p->signal);
diff --git a/kernel/printk.c b/kernel/printk.c
index b7da18391c38..1455a0d4eedd 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -532,6 +532,9 @@ static int __init ignore_loglevel_setup(char *str)
532} 532}
533 533
534early_param("ignore_loglevel", ignore_loglevel_setup); 534early_param("ignore_loglevel", ignore_loglevel_setup);
535module_param_named(ignore_loglevel, ignore_loglevel, bool, S_IRUGO | S_IWUSR);
536MODULE_PARM_DESC(ignore_loglevel, "ignore loglevel setting, to"
537 "print all kernel messages to the console.");
535 538
536/* 539/*
537 * Write out chars from start to end - 1 inclusive 540 * Write out chars from start to end - 1 inclusive
@@ -592,9 +595,6 @@ static size_t log_prefix(const char *p, unsigned int *level, char *special)
592 /* multi digit including the level and facility number */ 595 /* multi digit including the level and facility number */
593 char *endp = NULL; 596 char *endp = NULL;
594 597
595 if (p[1] < '0' && p[1] > '9')
596 return 0;
597
598 lev = (simple_strtoul(&p[1], &endp, 10) & 7); 598 lev = (simple_strtoul(&p[1], &endp, 10) & 7);
599 if (endp == NULL || endp[0] != '>') 599 if (endp == NULL || endp[0] != '>')
600 return 0; 600 return 0;
@@ -1108,6 +1108,10 @@ static int __init console_suspend_disable(char *str)
1108 return 1; 1108 return 1;
1109} 1109}
1110__setup("no_console_suspend", console_suspend_disable); 1110__setup("no_console_suspend", console_suspend_disable);
1111module_param_named(console_suspend, console_suspend_enabled,
1112 bool, S_IRUGO | S_IWUSR);
1113MODULE_PARM_DESC(console_suspend, "suspend console during suspend"
1114 " and hibernate operations");
1111 1115
1112/** 1116/**
1113 * suspend_console - suspend the console subsystem 1117 * suspend_console - suspend the console subsystem
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index ba5070ce5765..5b0951aa0496 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -41,6 +41,7 @@ struct cpu_stopper {
41}; 41};
42 42
43static DEFINE_PER_CPU(struct cpu_stopper, cpu_stopper); 43static DEFINE_PER_CPU(struct cpu_stopper, cpu_stopper);
44static bool stop_machine_initialized = false;
44 45
45static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo) 46static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
46{ 47{
@@ -386,6 +387,8 @@ static int __init cpu_stop_init(void)
386 cpu_stop_cpu_callback(&cpu_stop_cpu_notifier, CPU_ONLINE, bcpu); 387 cpu_stop_cpu_callback(&cpu_stop_cpu_notifier, CPU_ONLINE, bcpu);
387 register_cpu_notifier(&cpu_stop_cpu_notifier); 388 register_cpu_notifier(&cpu_stop_cpu_notifier);
388 389
390 stop_machine_initialized = true;
391
389 return 0; 392 return 0;
390} 393}
391early_initcall(cpu_stop_init); 394early_initcall(cpu_stop_init);
@@ -485,6 +488,25 @@ int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
485 .num_threads = num_online_cpus(), 488 .num_threads = num_online_cpus(),
486 .active_cpus = cpus }; 489 .active_cpus = cpus };
487 490
491 if (!stop_machine_initialized) {
492 /*
493 * Handle the case where stop_machine() is called
494 * early in boot before stop_machine() has been
495 * initialized.
496 */
497 unsigned long flags;
498 int ret;
499
500 WARN_ON_ONCE(smdata.num_threads != 1);
501
502 local_irq_save(flags);
503 hard_irq_disable();
504 ret = (*fn)(data);
505 local_irq_restore(flags);
506
507 return ret;
508 }
509
488 /* Set the initial state and stop all online cpus. */ 510 /* Set the initial state and stop all online cpus. */
489 set_state(&smdata, STOPMACHINE_PREPARE); 511 set_state(&smdata, STOPMACHINE_PREPARE);
490 return stop_cpus(cpu_online_mask, stop_machine_cpu_stop, &smdata); 512 return stop_cpus(cpu_online_mask, stop_machine_cpu_stop, &smdata);
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index a9a5de07c4f1..47bfa16430d7 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -145,6 +145,10 @@ cond_syscall(sys_io_submit);
145cond_syscall(sys_io_cancel); 145cond_syscall(sys_io_cancel);
146cond_syscall(sys_io_getevents); 146cond_syscall(sys_io_getevents);
147cond_syscall(sys_syslog); 147cond_syscall(sys_syslog);
148cond_syscall(sys_process_vm_readv);
149cond_syscall(sys_process_vm_writev);
150cond_syscall(compat_sys_process_vm_readv);
151cond_syscall(compat_sys_process_vm_writev);
148 152
149/* arch-specific weak syscall entries */ 153/* arch-specific weak syscall entries */
150cond_syscall(sys_pciconfig_read); 154cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 2fe2bc2a57ea..ae2719643854 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -57,6 +57,7 @@
57#include <linux/pipe_fs_i.h> 57#include <linux/pipe_fs_i.h>
58#include <linux/oom.h> 58#include <linux/oom.h>
59#include <linux/kmod.h> 59#include <linux/kmod.h>
60#include <linux/capability.h>
60 61
61#include <asm/uaccess.h> 62#include <asm/uaccess.h>
62#include <asm/processor.h> 63#include <asm/processor.h>
@@ -134,6 +135,7 @@ static int minolduid;
134static int min_percpu_pagelist_fract = 8; 135static int min_percpu_pagelist_fract = 8;
135 136
136static int ngroups_max = NGROUPS_MAX; 137static int ngroups_max = NGROUPS_MAX;
138static const int cap_last_cap = CAP_LAST_CAP;
137 139
138#ifdef CONFIG_INOTIFY_USER 140#ifdef CONFIG_INOTIFY_USER
139#include <linux/inotify.h> 141#include <linux/inotify.h>
@@ -732,6 +734,13 @@ static struct ctl_table kern_table[] = {
732 .mode = 0444, 734 .mode = 0444,
733 .proc_handler = proc_dointvec, 735 .proc_handler = proc_dointvec,
734 }, 736 },
737 {
738 .procname = "cap_last_cap",
739 .data = (void *)&cap_last_cap,
740 .maxlen = sizeof(int),
741 .mode = 0444,
742 .proc_handler = proc_dointvec,
743 },
735#if defined(CONFIG_LOCKUP_DETECTOR) 744#if defined(CONFIG_LOCKUP_DETECTOR)
736 { 745 {
737 .procname = "watchdog", 746 .procname = "watchdog",
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index d680381b0e9c..1d7bca7f4f52 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -481,6 +481,8 @@ static void watchdog_disable(int cpu)
481 } 481 }
482} 482}
483 483
484/* sysctl functions */
485#ifdef CONFIG_SYSCTL
484static void watchdog_enable_all_cpus(void) 486static void watchdog_enable_all_cpus(void)
485{ 487{
486 int cpu; 488 int cpu;
@@ -510,8 +512,6 @@ static void watchdog_disable_all_cpus(void)
510} 512}
511 513
512 514
513/* sysctl functions */
514#ifdef CONFIG_SYSCTL
515/* 515/*
516 * proc handler for /proc/sys/kernel/nmi_watchdog,watchdog_thresh 516 * proc handler for /proc/sys/kernel/nmi_watchdog,watchdog_thresh
517 */ 517 */