aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c4
-rw-r--r--kernel/compat.c58
-rw-r--r--kernel/dma.c2
-rw-r--r--kernel/exit.c9
-rw-r--r--kernel/kallsyms.c1
-rw-r--r--kernel/kmod.c67
-rw-r--r--kernel/kprobes.c2
-rw-r--r--kernel/ksysfs.c35
-rw-r--r--kernel/module.c56
-rw-r--r--kernel/panic.c67
-rw-r--r--kernel/power/disk.c11
-rw-r--r--kernel/power/main.c7
-rw-r--r--kernel/power/user.c10
-rw-r--r--kernel/printk.c26
-rw-r--r--kernel/profile.c41
-rw-r--r--kernel/resource.c92
-rw-r--r--kernel/sched_clock.c6
-rw-r--r--kernel/sched_debug.c2
-rw-r--r--kernel/softirq.c142
-rw-r--r--kernel/softlockup.c2
-rw-r--r--kernel/sys.c34
-rw-r--r--kernel/sys_ni.c6
-rw-r--r--kernel/sysctl.c115
-rw-r--r--kernel/time/Kconfig1
-rw-r--r--kernel/time/tick-sched.c2
-rw-r--r--kernel/timer.c1
-rw-r--r--kernel/utsname_sysctl.c5
-rw-r--r--kernel/wait.c14
-rw-r--r--kernel/workqueue.c2
29 files changed, 600 insertions, 220 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index a0123d75ec9a..8c6e1c17e6d3 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2735,6 +2735,8 @@ void cgroup_fork_callbacks(struct task_struct *child)
2735 * Called on every change to mm->owner. mm_init_owner() does not 2735 * Called on every change to mm->owner. mm_init_owner() does not
2736 * invoke this routine, since it assigns the mm->owner the first time 2736 * invoke this routine, since it assigns the mm->owner the first time
2737 * and does not change it. 2737 * and does not change it.
2738 *
2739 * The callbacks are invoked with mmap_sem held in read mode.
2738 */ 2740 */
2739void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new) 2741void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
2740{ 2742{
@@ -2750,7 +2752,7 @@ void cgroup_mm_owner_callbacks(struct task_struct *old, struct task_struct *new)
2750 if (oldcgrp == newcgrp) 2752 if (oldcgrp == newcgrp)
2751 continue; 2753 continue;
2752 if (ss->mm_owner_changed) 2754 if (ss->mm_owner_changed)
2753 ss->mm_owner_changed(ss, oldcgrp, newcgrp); 2755 ss->mm_owner_changed(ss, oldcgrp, newcgrp, new);
2754 } 2756 }
2755 } 2757 }
2756} 2758}
diff --git a/kernel/compat.c b/kernel/compat.c
index 32c254a8ab9a..143990e48cb9 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -26,6 +26,64 @@
26 26
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28 28
29/*
30 * Note that the native side is already converted to a timespec, because
31 * that's what we want anyway.
32 */
33static int compat_get_timeval(struct timespec *o,
34 struct compat_timeval __user *i)
35{
36 long usec;
37
38 if (get_user(o->tv_sec, &i->tv_sec) ||
39 get_user(usec, &i->tv_usec))
40 return -EFAULT;
41 o->tv_nsec = usec * 1000;
42 return 0;
43}
44
45static int compat_put_timeval(struct compat_timeval __user *o,
46 struct timeval *i)
47{
48 return (put_user(i->tv_sec, &o->tv_sec) ||
49 put_user(i->tv_usec, &o->tv_usec)) ? -EFAULT : 0;
50}
51
52asmlinkage long compat_sys_gettimeofday(struct compat_timeval __user *tv,
53 struct timezone __user *tz)
54{
55 if (tv) {
56 struct timeval ktv;
57 do_gettimeofday(&ktv);
58 if (compat_put_timeval(tv, &ktv))
59 return -EFAULT;
60 }
61 if (tz) {
62 if (copy_to_user(tz, &sys_tz, sizeof(sys_tz)))
63 return -EFAULT;
64 }
65
66 return 0;
67}
68
69asmlinkage long compat_sys_settimeofday(struct compat_timeval __user *tv,
70 struct timezone __user *tz)
71{
72 struct timespec kts;
73 struct timezone ktz;
74
75 if (tv) {
76 if (compat_get_timeval(&kts, tv))
77 return -EFAULT;
78 }
79 if (tz) {
80 if (copy_from_user(&ktz, tz, sizeof(ktz)))
81 return -EFAULT;
82 }
83
84 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
85}
86
29int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) 87int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
30{ 88{
31 return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) || 89 return (!access_ok(VERIFY_READ, cts, sizeof(*cts)) ||
diff --git a/kernel/dma.c b/kernel/dma.c
index d2c60a822790..f903189c5304 100644
--- a/kernel/dma.c
+++ b/kernel/dma.c
@@ -1,4 +1,4 @@
1/* $Id: dma.c,v 1.7 1994/12/28 03:35:33 root Exp root $ 1/*
2 * linux/kernel/dma.c: A DMA channel allocator. Inspired by linux/kernel/irq.c. 2 * linux/kernel/dma.c: A DMA channel allocator. Inspired by linux/kernel/irq.c.
3 * 3 *
4 * Written by Hennus Bergman, 1992. 4 * Written by Hennus Bergman, 1992.
diff --git a/kernel/exit.c b/kernel/exit.c
index 7b71f87f1207..138887881a11 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -644,24 +644,23 @@ retry:
644assign_new_owner: 644assign_new_owner:
645 BUG_ON(c == p); 645 BUG_ON(c == p);
646 get_task_struct(c); 646 get_task_struct(c);
647 read_unlock(&tasklist_lock);
648 down_write(&mm->mmap_sem);
647 /* 649 /*
648 * The task_lock protects c->mm from changing. 650 * The task_lock protects c->mm from changing.
649 * We always want mm->owner->mm == mm 651 * We always want mm->owner->mm == mm
650 */ 652 */
651 task_lock(c); 653 task_lock(c);
652 /*
653 * Delay read_unlock() till we have the task_lock()
654 * to ensure that c does not slip away underneath us
655 */
656 read_unlock(&tasklist_lock);
657 if (c->mm != mm) { 654 if (c->mm != mm) {
658 task_unlock(c); 655 task_unlock(c);
656 up_write(&mm->mmap_sem);
659 put_task_struct(c); 657 put_task_struct(c);
660 goto retry; 658 goto retry;
661 } 659 }
662 cgroup_mm_owner_callbacks(mm->owner, c); 660 cgroup_mm_owner_callbacks(mm->owner, c);
663 mm->owner = c; 661 mm->owner = c;
664 task_unlock(c); 662 task_unlock(c);
663 up_write(&mm->mmap_sem);
665 put_task_struct(c); 664 put_task_struct(c);
666} 665}
667#endif /* CONFIG_MM_OWNER */ 666#endif /* CONFIG_MM_OWNER */
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 38fc10ac7541..5072cf1685a2 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -260,7 +260,6 @@ const char *kallsyms_lookup(unsigned long addr,
260 /* see if it's in a module */ 260 /* see if it's in a module */
261 return module_address_lookup(addr, symbolsize, offset, modname, 261 return module_address_lookup(addr, symbolsize, offset, modname,
262 namebuf); 262 namebuf);
263 return NULL;
264} 263}
265 264
266int lookup_symbol_name(unsigned long addr, char *symname) 265int lookup_symbol_name(unsigned long addr, char *symname)
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 2456d1a0befb..3d3c3ea3a023 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -113,7 +113,7 @@ int request_module(const char *fmt, ...)
113 return ret; 113 return ret;
114} 114}
115EXPORT_SYMBOL(request_module); 115EXPORT_SYMBOL(request_module);
116#endif /* CONFIG_KMOD */ 116#endif /* CONFIG_MODULES */
117 117
118struct subprocess_info { 118struct subprocess_info {
119 struct work_struct work; 119 struct work_struct work;
@@ -265,7 +265,7 @@ static void __call_usermodehelper(struct work_struct *work)
265 } 265 }
266} 266}
267 267
268#ifdef CONFIG_PM 268#ifdef CONFIG_PM_SLEEP
269/* 269/*
270 * If set, call_usermodehelper_exec() will exit immediately returning -EBUSY 270 * If set, call_usermodehelper_exec() will exit immediately returning -EBUSY
271 * (used for preventing user land processes from being created after the user 271 * (used for preventing user land processes from being created after the user
@@ -288,39 +288,37 @@ static DECLARE_WAIT_QUEUE_HEAD(running_helpers_waitq);
288 */ 288 */
289#define RUNNING_HELPERS_TIMEOUT (5 * HZ) 289#define RUNNING_HELPERS_TIMEOUT (5 * HZ)
290 290
291static int usermodehelper_pm_callback(struct notifier_block *nfb, 291/**
292 unsigned long action, 292 * usermodehelper_disable - prevent new helpers from being started
293 void *ignored) 293 */
294int usermodehelper_disable(void)
294{ 295{
295 long retval; 296 long retval;
296 297
297 switch (action) { 298 usermodehelper_disabled = 1;
298 case PM_HIBERNATION_PREPARE: 299 smp_mb();
299 case PM_SUSPEND_PREPARE: 300 /*
300 usermodehelper_disabled = 1; 301 * From now on call_usermodehelper_exec() won't start any new
301 smp_mb(); 302 * helpers, so it is sufficient if running_helpers turns out to
302 /* 303 * be zero at one point (it may be increased later, but that
303 * From now on call_usermodehelper_exec() won't start any new 304 * doesn't matter).
304 * helpers, so it is sufficient if running_helpers turns out to 305 */
305 * be zero at one point (it may be increased later, but that 306 retval = wait_event_timeout(running_helpers_waitq,
306 * doesn't matter).
307 */
308 retval = wait_event_timeout(running_helpers_waitq,
309 atomic_read(&running_helpers) == 0, 307 atomic_read(&running_helpers) == 0,
310 RUNNING_HELPERS_TIMEOUT); 308 RUNNING_HELPERS_TIMEOUT);
311 if (retval) { 309 if (retval)
312 return NOTIFY_OK; 310 return 0;
313 } else {
314 usermodehelper_disabled = 0;
315 return NOTIFY_BAD;
316 }
317 case PM_POST_HIBERNATION:
318 case PM_POST_SUSPEND:
319 usermodehelper_disabled = 0;
320 return NOTIFY_OK;
321 }
322 311
323 return NOTIFY_DONE; 312 usermodehelper_disabled = 0;
313 return -EAGAIN;
314}
315
316/**
317 * usermodehelper_enable - allow new helpers to be started again
318 */
319void usermodehelper_enable(void)
320{
321 usermodehelper_disabled = 0;
324} 322}
325 323
326static void helper_lock(void) 324static void helper_lock(void)
@@ -334,18 +332,12 @@ static void helper_unlock(void)
334 if (atomic_dec_and_test(&running_helpers)) 332 if (atomic_dec_and_test(&running_helpers))
335 wake_up(&running_helpers_waitq); 333 wake_up(&running_helpers_waitq);
336} 334}
337 335#else /* CONFIG_PM_SLEEP */
338static void register_pm_notifier_callback(void)
339{
340 pm_notifier(usermodehelper_pm_callback, 0);
341}
342#else /* CONFIG_PM */
343#define usermodehelper_disabled 0 336#define usermodehelper_disabled 0
344 337
345static inline void helper_lock(void) {} 338static inline void helper_lock(void) {}
346static inline void helper_unlock(void) {} 339static inline void helper_unlock(void) {}
347static inline void register_pm_notifier_callback(void) {} 340#endif /* CONFIG_PM_SLEEP */
348#endif /* CONFIG_PM */
349 341
350/** 342/**
351 * call_usermodehelper_setup - prepare to call a usermode helper 343 * call_usermodehelper_setup - prepare to call a usermode helper
@@ -515,5 +507,4 @@ void __init usermodehelper_init(void)
515{ 507{
516 khelper_wq = create_singlethread_workqueue("khelper"); 508 khelper_wq = create_singlethread_workqueue("khelper");
517 BUG_ON(!khelper_wq); 509 BUG_ON(!khelper_wq);
518 register_pm_notifier_callback();
519} 510}
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 75bc2cd9ebc6..8b57a2597f21 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -404,7 +404,7 @@ void kretprobe_hash_lock(struct task_struct *tsk,
404 spin_lock_irqsave(hlist_lock, *flags); 404 spin_lock_irqsave(hlist_lock, *flags);
405} 405}
406 406
407void kretprobe_table_lock(unsigned long hash, unsigned long *flags) 407static void kretprobe_table_lock(unsigned long hash, unsigned long *flags)
408{ 408{
409 spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash); 409 spinlock_t *hlist_lock = kretprobe_table_lock_ptr(hash);
410 spin_lock_irqsave(hlist_lock, *flags); 410 spin_lock_irqsave(hlist_lock, *flags);
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index e53bc30e9ba5..08dd8ed86c77 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -14,6 +14,7 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/kexec.h> 16#include <linux/kexec.h>
17#include <linux/profile.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18 19
19#define KERNEL_ATTR_RO(_name) \ 20#define KERNEL_ATTR_RO(_name) \
@@ -53,6 +54,37 @@ static ssize_t uevent_helper_store(struct kobject *kobj,
53KERNEL_ATTR_RW(uevent_helper); 54KERNEL_ATTR_RW(uevent_helper);
54#endif 55#endif
55 56
57#ifdef CONFIG_PROFILING
58static ssize_t profiling_show(struct kobject *kobj,
59 struct kobj_attribute *attr, char *buf)
60{
61 return sprintf(buf, "%d\n", prof_on);
62}
63static ssize_t profiling_store(struct kobject *kobj,
64 struct kobj_attribute *attr,
65 const char *buf, size_t count)
66{
67 int ret;
68
69 if (prof_on)
70 return -EEXIST;
71 /*
72 * This eventually calls into get_option() which
73 * has a ton of callers and is not const. It is
74 * easiest to cast it away here.
75 */
76 profile_setup((char *)buf);
77 ret = profile_init();
78 if (ret)
79 return ret;
80 ret = create_proc_profile();
81 if (ret)
82 return ret;
83 return count;
84}
85KERNEL_ATTR_RW(profiling);
86#endif
87
56#ifdef CONFIG_KEXEC 88#ifdef CONFIG_KEXEC
57static ssize_t kexec_loaded_show(struct kobject *kobj, 89static ssize_t kexec_loaded_show(struct kobject *kobj,
58 struct kobj_attribute *attr, char *buf) 90 struct kobj_attribute *attr, char *buf)
@@ -109,6 +141,9 @@ static struct attribute * kernel_attrs[] = {
109 &uevent_seqnum_attr.attr, 141 &uevent_seqnum_attr.attr,
110 &uevent_helper_attr.attr, 142 &uevent_helper_attr.attr,
111#endif 143#endif
144#ifdef CONFIG_PROFILING
145 &profiling_attr.attr,
146#endif
112#ifdef CONFIG_KEXEC 147#ifdef CONFIG_KEXEC
113 &kexec_loaded_attr.attr, 148 &kexec_loaded_attr.attr,
114 &kexec_crash_loaded_attr.attr, 149 &kexec_crash_loaded_attr.attr,
diff --git a/kernel/module.c b/kernel/module.c
index 7576c2d9462f..0d8d21ee792c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -102,7 +102,7 @@ static inline int strong_try_module_get(struct module *mod)
102static inline void add_taint_module(struct module *mod, unsigned flag) 102static inline void add_taint_module(struct module *mod, unsigned flag)
103{ 103{
104 add_taint(flag); 104 add_taint(flag);
105 mod->taints |= flag; 105 mod->taints |= (1U << flag);
106} 106}
107 107
108/* 108/*
@@ -786,6 +786,7 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
786 mutex_lock(&module_mutex); 786 mutex_lock(&module_mutex);
787 /* Store the name of the last unloaded module for diagnostic purposes */ 787 /* Store the name of the last unloaded module for diagnostic purposes */
788 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module)); 788 strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
789 unregister_dynamic_debug_module(mod->name);
789 free_module(mod); 790 free_module(mod);
790 791
791 out: 792 out:
@@ -925,7 +926,7 @@ static const char vermagic[] = VERMAGIC_STRING;
925static int try_to_force_load(struct module *mod, const char *symname) 926static int try_to_force_load(struct module *mod, const char *symname)
926{ 927{
927#ifdef CONFIG_MODULE_FORCE_LOAD 928#ifdef CONFIG_MODULE_FORCE_LOAD
928 if (!(tainted & TAINT_FORCED_MODULE)) 929 if (!test_taint(TAINT_FORCED_MODULE))
929 printk("%s: no version for \"%s\" found: kernel tainted.\n", 930 printk("%s: no version for \"%s\" found: kernel tainted.\n",
930 mod->name, symname); 931 mod->name, symname);
931 add_taint_module(mod, TAINT_FORCED_MODULE); 932 add_taint_module(mod, TAINT_FORCED_MODULE);
@@ -1035,7 +1036,7 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
1035 const unsigned long *crc; 1036 const unsigned long *crc;
1036 1037
1037 ret = find_symbol(name, &owner, &crc, 1038 ret = find_symbol(name, &owner, &crc,
1038 !(mod->taints & TAINT_PROPRIETARY_MODULE), true); 1039 !(mod->taints & (1 << TAINT_PROPRIETARY_MODULE)), true);
1039 if (!IS_ERR_VALUE(ret)) { 1040 if (!IS_ERR_VALUE(ret)) {
1040 /* use_module can fail due to OOM, 1041 /* use_module can fail due to OOM,
1041 or module initialization or unloading */ 1042 or module initialization or unloading */
@@ -1175,7 +1176,7 @@ static void free_notes_attrs(struct module_notes_attrs *notes_attrs,
1175 while (i-- > 0) 1176 while (i-- > 0)
1176 sysfs_remove_bin_file(notes_attrs->dir, 1177 sysfs_remove_bin_file(notes_attrs->dir,
1177 &notes_attrs->attrs[i]); 1178 &notes_attrs->attrs[i]);
1178 kobject_del(notes_attrs->dir); 1179 kobject_put(notes_attrs->dir);
1179 } 1180 }
1180 kfree(notes_attrs); 1181 kfree(notes_attrs);
1181} 1182}
@@ -1639,7 +1640,7 @@ static void set_license(struct module *mod, const char *license)
1639 license = "unspecified"; 1640 license = "unspecified";
1640 1641
1641 if (!license_is_gpl_compatible(license)) { 1642 if (!license_is_gpl_compatible(license)) {
1642 if (!(tainted & TAINT_PROPRIETARY_MODULE)) 1643 if (!test_taint(TAINT_PROPRIETARY_MODULE))
1643 printk(KERN_WARNING "%s: module license '%s' taints " 1644 printk(KERN_WARNING "%s: module license '%s' taints "
1644 "kernel.\n", mod->name, license); 1645 "kernel.\n", mod->name, license);
1645 add_taint_module(mod, TAINT_PROPRIETARY_MODULE); 1646 add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
@@ -1788,6 +1789,33 @@ static inline void add_kallsyms(struct module *mod,
1788} 1789}
1789#endif /* CONFIG_KALLSYMS */ 1790#endif /* CONFIG_KALLSYMS */
1790 1791
1792#ifdef CONFIG_DYNAMIC_PRINTK_DEBUG
1793static void dynamic_printk_setup(Elf_Shdr *sechdrs, unsigned int verboseindex)
1794{
1795 struct mod_debug *debug_info;
1796 unsigned long pos, end;
1797 unsigned int num_verbose;
1798
1799 pos = sechdrs[verboseindex].sh_addr;
1800 num_verbose = sechdrs[verboseindex].sh_size /
1801 sizeof(struct mod_debug);
1802 end = pos + (num_verbose * sizeof(struct mod_debug));
1803
1804 for (; pos < end; pos += sizeof(struct mod_debug)) {
1805 debug_info = (struct mod_debug *)pos;
1806 register_dynamic_debug_module(debug_info->modname,
1807 debug_info->type, debug_info->logical_modname,
1808 debug_info->flag_names, debug_info->hash,
1809 debug_info->hash2);
1810 }
1811}
1812#else
1813static inline void dynamic_printk_setup(Elf_Shdr *sechdrs,
1814 unsigned int verboseindex)
1815{
1816}
1817#endif /* CONFIG_DYNAMIC_PRINTK_DEBUG */
1818
1791static void *module_alloc_update_bounds(unsigned long size) 1819static void *module_alloc_update_bounds(unsigned long size)
1792{ 1820{
1793 void *ret = module_alloc(size); 1821 void *ret = module_alloc(size);
@@ -1811,6 +1839,7 @@ static noinline struct module *load_module(void __user *umod,
1811 Elf_Ehdr *hdr; 1839 Elf_Ehdr *hdr;
1812 Elf_Shdr *sechdrs; 1840 Elf_Shdr *sechdrs;
1813 char *secstrings, *args, *modmagic, *strtab = NULL; 1841 char *secstrings, *args, *modmagic, *strtab = NULL;
1842 char *staging;
1814 unsigned int i; 1843 unsigned int i;
1815 unsigned int symindex = 0; 1844 unsigned int symindex = 0;
1816 unsigned int strindex = 0; 1845 unsigned int strindex = 0;
@@ -1836,6 +1865,7 @@ static noinline struct module *load_module(void __user *umod,
1836#endif 1865#endif
1837 unsigned int markersindex; 1866 unsigned int markersindex;
1838 unsigned int markersstringsindex; 1867 unsigned int markersstringsindex;
1868 unsigned int verboseindex;
1839 unsigned int tracepointsindex; 1869 unsigned int tracepointsindex;
1840 unsigned int tracepointsstringsindex; 1870 unsigned int tracepointsstringsindex;
1841 unsigned int mcountindex; 1871 unsigned int mcountindex;
@@ -1969,6 +1999,14 @@ static noinline struct module *load_module(void __user *umod,
1969 goto free_hdr; 1999 goto free_hdr;
1970 } 2000 }
1971 2001
2002 staging = get_modinfo(sechdrs, infoindex, "staging");
2003 if (staging) {
2004 add_taint_module(mod, TAINT_CRAP);
2005 printk(KERN_WARNING "%s: module is from the staging directory,"
2006 " the quality is unknown, you have been warned.\n",
2007 mod->name);
2008 }
2009
1972 /* Now copy in args */ 2010 /* Now copy in args */
1973 args = strndup_user(uargs, ~0UL >> 1); 2011 args = strndup_user(uargs, ~0UL >> 1);
1974 if (IS_ERR(args)) { 2012 if (IS_ERR(args)) {
@@ -2126,6 +2164,7 @@ static noinline struct module *load_module(void __user *umod,
2126 markersindex = find_sec(hdr, sechdrs, secstrings, "__markers"); 2164 markersindex = find_sec(hdr, sechdrs, secstrings, "__markers");
2127 markersstringsindex = find_sec(hdr, sechdrs, secstrings, 2165 markersstringsindex = find_sec(hdr, sechdrs, secstrings,
2128 "__markers_strings"); 2166 "__markers_strings");
2167 verboseindex = find_sec(hdr, sechdrs, secstrings, "__verbose");
2129 tracepointsindex = find_sec(hdr, sechdrs, secstrings, "__tracepoints"); 2168 tracepointsindex = find_sec(hdr, sechdrs, secstrings, "__tracepoints");
2130 tracepointsstringsindex = find_sec(hdr, sechdrs, secstrings, 2169 tracepointsstringsindex = find_sec(hdr, sechdrs, secstrings,
2131 "__tracepoints_strings"); 2170 "__tracepoints_strings");
@@ -2188,6 +2227,7 @@ static noinline struct module *load_module(void __user *umod,
2188 marker_update_probe_range(mod->markers, 2227 marker_update_probe_range(mod->markers,
2189 mod->markers + mod->num_markers); 2228 mod->markers + mod->num_markers);
2190#endif 2229#endif
2230 dynamic_printk_setup(sechdrs, verboseindex);
2191#ifdef CONFIG_TRACEPOINTS 2231#ifdef CONFIG_TRACEPOINTS
2192 tracepoint_update_probe_range(mod->tracepoints, 2232 tracepoint_update_probe_range(mod->tracepoints,
2193 mod->tracepoints + mod->num_tracepoints); 2233 mod->tracepoints + mod->num_tracepoints);
@@ -2584,10 +2624,12 @@ static char *module_flags(struct module *mod, char *buf)
2584 mod->state == MODULE_STATE_GOING || 2624 mod->state == MODULE_STATE_GOING ||
2585 mod->state == MODULE_STATE_COMING) { 2625 mod->state == MODULE_STATE_COMING) {
2586 buf[bx++] = '('; 2626 buf[bx++] = '(';
2587 if (mod->taints & TAINT_PROPRIETARY_MODULE) 2627 if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE))
2588 buf[bx++] = 'P'; 2628 buf[bx++] = 'P';
2589 if (mod->taints & TAINT_FORCED_MODULE) 2629 if (mod->taints & (1 << TAINT_FORCED_MODULE))
2590 buf[bx++] = 'F'; 2630 buf[bx++] = 'F';
2631 if (mod->taints & (1 << TAINT_CRAP))
2632 buf[bx++] = 'C';
2591 /* 2633 /*
2592 * TAINT_FORCED_RMMOD: could be added. 2634 * TAINT_FORCED_RMMOD: could be added.
2593 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't 2635 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
diff --git a/kernel/panic.c b/kernel/panic.c
index 12c5a0a6c89b..bda561ef3cdf 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -23,7 +23,7 @@
23#include <linux/kallsyms.h> 23#include <linux/kallsyms.h>
24 24
25int panic_on_oops; 25int panic_on_oops;
26int tainted; 26static unsigned long tainted_mask;
27static int pause_on_oops; 27static int pause_on_oops;
28static int pause_on_oops_flag; 28static int pause_on_oops_flag;
29static DEFINE_SPINLOCK(pause_on_oops_lock); 29static DEFINE_SPINLOCK(pause_on_oops_lock);
@@ -143,6 +143,27 @@ NORET_TYPE void panic(const char * fmt, ...)
143 143
144EXPORT_SYMBOL(panic); 144EXPORT_SYMBOL(panic);
145 145
146
147struct tnt {
148 u8 bit;
149 char true;
150 char false;
151};
152
153static const struct tnt tnts[] = {
154 { TAINT_PROPRIETARY_MODULE, 'P', 'G' },
155 { TAINT_FORCED_MODULE, 'F', ' ' },
156 { TAINT_UNSAFE_SMP, 'S', ' ' },
157 { TAINT_FORCED_RMMOD, 'R', ' ' },
158 { TAINT_MACHINE_CHECK, 'M', ' ' },
159 { TAINT_BAD_PAGE, 'B', ' ' },
160 { TAINT_USER, 'U', ' ' },
161 { TAINT_DIE, 'D', ' ' },
162 { TAINT_OVERRIDDEN_ACPI_TABLE, 'A', ' ' },
163 { TAINT_WARN, 'W', ' ' },
164 { TAINT_CRAP, 'C', ' ' },
165};
166
146/** 167/**
147 * print_tainted - return a string to represent the kernel taint state. 168 * print_tainted - return a string to represent the kernel taint state.
148 * 169 *
@@ -155,35 +176,45 @@ EXPORT_SYMBOL(panic);
155 * 'U' - Userspace-defined naughtiness. 176 * 'U' - Userspace-defined naughtiness.
156 * 'A' - ACPI table overridden. 177 * 'A' - ACPI table overridden.
157 * 'W' - Taint on warning. 178 * 'W' - Taint on warning.
179 * 'C' - modules from drivers/staging are loaded.
158 * 180 *
159 * The string is overwritten by the next call to print_taint(). 181 * The string is overwritten by the next call to print_taint().
160 */ 182 */
161
162const char *print_tainted(void) 183const char *print_tainted(void)
163{ 184{
164 static char buf[20]; 185 static char buf[ARRAY_SIZE(tnts) + sizeof("Tainted: ") + 1];
165 if (tainted) { 186
166 snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c%c%c", 187 if (tainted_mask) {
167 tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', 188 char *s;
168 tainted & TAINT_FORCED_MODULE ? 'F' : ' ', 189 int i;
169 tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', 190
170 tainted & TAINT_FORCED_RMMOD ? 'R' : ' ', 191 s = buf + sprintf(buf, "Tainted: ");
171 tainted & TAINT_MACHINE_CHECK ? 'M' : ' ', 192 for (i = 0; i < ARRAY_SIZE(tnts); i++) {
172 tainted & TAINT_BAD_PAGE ? 'B' : ' ', 193 const struct tnt *t = &tnts[i];
173 tainted & TAINT_USER ? 'U' : ' ', 194 *s++ = test_bit(t->bit, &tainted_mask) ?
174 tainted & TAINT_DIE ? 'D' : ' ', 195 t->true : t->false;
175 tainted & TAINT_OVERRIDDEN_ACPI_TABLE ? 'A' : ' ', 196 }
176 tainted & TAINT_WARN ? 'W' : ' '); 197 *s = 0;
177 } 198 } else
178 else
179 snprintf(buf, sizeof(buf), "Not tainted"); 199 snprintf(buf, sizeof(buf), "Not tainted");
180 return(buf); 200 return(buf);
181} 201}
182 202
203int test_taint(unsigned flag)
204{
205 return test_bit(flag, &tainted_mask);
206}
207EXPORT_SYMBOL(test_taint);
208
209unsigned long get_taint(void)
210{
211 return tainted_mask;
212}
213
183void add_taint(unsigned flag) 214void add_taint(unsigned flag)
184{ 215{
185 debug_locks = 0; /* can't trust the integrity of the kernel anymore */ 216 debug_locks = 0; /* can't trust the integrity of the kernel anymore */
186 tainted |= flag; 217 set_bit(flag, &tainted_mask);
187} 218}
188EXPORT_SYMBOL(add_taint); 219EXPORT_SYMBOL(add_taint);
189 220
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index bbd85c60f741..331f9836383f 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -14,6 +14,7 @@
14#include <linux/reboot.h> 14#include <linux/reboot.h>
15#include <linux/string.h> 15#include <linux/string.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/kmod.h>
17#include <linux/delay.h> 18#include <linux/delay.h>
18#include <linux/fs.h> 19#include <linux/fs.h>
19#include <linux/mount.h> 20#include <linux/mount.h>
@@ -520,6 +521,10 @@ int hibernate(void)
520 if (error) 521 if (error)
521 goto Exit; 522 goto Exit;
522 523
524 error = usermodehelper_disable();
525 if (error)
526 goto Exit;
527
523 /* Allocate memory management structures */ 528 /* Allocate memory management structures */
524 error = create_basic_memory_bitmaps(); 529 error = create_basic_memory_bitmaps();
525 if (error) 530 if (error)
@@ -558,6 +563,7 @@ int hibernate(void)
558 thaw_processes(); 563 thaw_processes();
559 Finish: 564 Finish:
560 free_basic_memory_bitmaps(); 565 free_basic_memory_bitmaps();
566 usermodehelper_enable();
561 Exit: 567 Exit:
562 pm_notifier_call_chain(PM_POST_HIBERNATION); 568 pm_notifier_call_chain(PM_POST_HIBERNATION);
563 pm_restore_console(); 569 pm_restore_console();
@@ -634,6 +640,10 @@ static int software_resume(void)
634 if (error) 640 if (error)
635 goto Finish; 641 goto Finish;
636 642
643 error = usermodehelper_disable();
644 if (error)
645 goto Finish;
646
637 error = create_basic_memory_bitmaps(); 647 error = create_basic_memory_bitmaps();
638 if (error) 648 if (error)
639 goto Finish; 649 goto Finish;
@@ -656,6 +666,7 @@ static int software_resume(void)
656 thaw_processes(); 666 thaw_processes();
657 Done: 667 Done:
658 free_basic_memory_bitmaps(); 668 free_basic_memory_bitmaps();
669 usermodehelper_enable();
659 Finish: 670 Finish:
660 pm_notifier_call_chain(PM_POST_RESTORE); 671 pm_notifier_call_chain(PM_POST_RESTORE);
661 pm_restore_console(); 672 pm_restore_console();
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 540b16b68565..19122cf6d827 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <linux/kmod.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/console.h> 19#include <linux/console.h>
19#include <linux/cpu.h> 20#include <linux/cpu.h>
@@ -237,6 +238,10 @@ static int suspend_prepare(void)
237 if (error) 238 if (error)
238 goto Finish; 239 goto Finish;
239 240
241 error = usermodehelper_disable();
242 if (error)
243 goto Finish;
244
240 if (suspend_freeze_processes()) { 245 if (suspend_freeze_processes()) {
241 error = -EAGAIN; 246 error = -EAGAIN;
242 goto Thaw; 247 goto Thaw;
@@ -256,6 +261,7 @@ static int suspend_prepare(void)
256 261
257 Thaw: 262 Thaw:
258 suspend_thaw_processes(); 263 suspend_thaw_processes();
264 usermodehelper_enable();
259 Finish: 265 Finish:
260 pm_notifier_call_chain(PM_POST_SUSPEND); 266 pm_notifier_call_chain(PM_POST_SUSPEND);
261 pm_restore_console(); 267 pm_restore_console();
@@ -376,6 +382,7 @@ int suspend_devices_and_enter(suspend_state_t state)
376static void suspend_finish(void) 382static void suspend_finish(void)
377{ 383{
378 suspend_thaw_processes(); 384 suspend_thaw_processes();
385 usermodehelper_enable();
379 pm_notifier_call_chain(PM_POST_SUSPEND); 386 pm_notifier_call_chain(PM_POST_SUSPEND);
380 pm_restore_console(); 387 pm_restore_console();
381} 388}
diff --git a/kernel/power/user.c b/kernel/power/user.c
index a6332a313262..005b93d839ba 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -212,13 +212,20 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
212 case SNAPSHOT_FREEZE: 212 case SNAPSHOT_FREEZE:
213 if (data->frozen) 213 if (data->frozen)
214 break; 214 break;
215
215 printk("Syncing filesystems ... "); 216 printk("Syncing filesystems ... ");
216 sys_sync(); 217 sys_sync();
217 printk("done.\n"); 218 printk("done.\n");
218 219
219 error = freeze_processes(); 220 error = usermodehelper_disable();
220 if (error) 221 if (error)
222 break;
223
224 error = freeze_processes();
225 if (error) {
221 thaw_processes(); 226 thaw_processes();
227 usermodehelper_enable();
228 }
222 if (!error) 229 if (!error)
223 data->frozen = 1; 230 data->frozen = 1;
224 break; 231 break;
@@ -227,6 +234,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
227 if (!data->frozen || data->ready) 234 if (!data->frozen || data->ready)
228 break; 235 break;
229 thaw_processes(); 236 thaw_processes();
237 usermodehelper_enable();
230 data->frozen = 0; 238 data->frozen = 0;
231 break; 239 break;
232 240
diff --git a/kernel/printk.c b/kernel/printk.c
index a430fd04008b..6341af77eb65 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -13,7 +13,7 @@
13 * Fixed SMP synchronization, 08/08/99, Manfred Spraul 13 * Fixed SMP synchronization, 08/08/99, Manfred Spraul
14 * manfred@colorfullife.com 14 * manfred@colorfullife.com
15 * Rewrote bits to get rid of console_lock 15 * Rewrote bits to get rid of console_lock
16 * 01Mar01 Andrew Morton <andrewm@uow.edu.au> 16 * 01Mar01 Andrew Morton
17 */ 17 */
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
@@ -577,9 +577,6 @@ static int have_callable_console(void)
577 * @fmt: format string 577 * @fmt: format string
578 * 578 *
579 * This is printk(). It can be called from any context. We want it to work. 579 * This is printk(). It can be called from any context. We want it to work.
580 * Be aware of the fact that if oops_in_progress is not set, we might try to
581 * wake klogd up which could deadlock on runqueue lock if printk() is called
582 * from scheduler code.
583 * 580 *
584 * We try to grab the console_sem. If we succeed, it's easy - we log the output and 581 * We try to grab the console_sem. If we succeed, it's easy - we log the output and
585 * call the console drivers. If we fail to get the semaphore we place the output 582 * call the console drivers. If we fail to get the semaphore we place the output
@@ -593,6 +590,8 @@ static int have_callable_console(void)
593 * 590 *
594 * See also: 591 * See also:
595 * printf(3) 592 * printf(3)
593 *
594 * See the vsnprintf() documentation for format string extensions over C99.
596 */ 595 */
597 596
598asmlinkage int printk(const char *fmt, ...) 597asmlinkage int printk(const char *fmt, ...)
@@ -982,10 +981,25 @@ int is_console_locked(void)
982 return console_locked; 981 return console_locked;
983} 982}
984 983
985void wake_up_klogd(void) 984static DEFINE_PER_CPU(int, printk_pending);
985
986void printk_tick(void)
986{ 987{
987 if (!oops_in_progress && waitqueue_active(&log_wait)) 988 if (__get_cpu_var(printk_pending)) {
989 __get_cpu_var(printk_pending) = 0;
988 wake_up_interruptible(&log_wait); 990 wake_up_interruptible(&log_wait);
991 }
992}
993
994int printk_needs_cpu(int cpu)
995{
996 return per_cpu(printk_pending, cpu);
997}
998
999void wake_up_klogd(void)
1000{
1001 if (waitqueue_active(&log_wait))
1002 __raw_get_cpu_var(printk_pending) = 1;
989} 1003}
990 1004
991/** 1005/**
diff --git a/kernel/profile.c b/kernel/profile.c
index cd26bed4cc26..a9e422df6bf6 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -22,6 +22,8 @@
22#include <linux/cpu.h> 22#include <linux/cpu.h>
23#include <linux/highmem.h> 23#include <linux/highmem.h>
24#include <linux/mutex.h> 24#include <linux/mutex.h>
25#include <linux/slab.h>
26#include <linux/vmalloc.h>
25#include <asm/sections.h> 27#include <asm/sections.h>
26#include <asm/irq_regs.h> 28#include <asm/irq_regs.h>
27#include <asm/ptrace.h> 29#include <asm/ptrace.h>
@@ -50,11 +52,11 @@ static DEFINE_PER_CPU(int, cpu_profile_flip);
50static DEFINE_MUTEX(profile_flip_mutex); 52static DEFINE_MUTEX(profile_flip_mutex);
51#endif /* CONFIG_SMP */ 53#endif /* CONFIG_SMP */
52 54
53static int __init profile_setup(char *str) 55int profile_setup(char *str)
54{ 56{
55 static char __initdata schedstr[] = "schedule"; 57 static char schedstr[] = "schedule";
56 static char __initdata sleepstr[] = "sleep"; 58 static char sleepstr[] = "sleep";
57 static char __initdata kvmstr[] = "kvm"; 59 static char kvmstr[] = "kvm";
58 int par; 60 int par;
59 61
60 if (!strncmp(str, sleepstr, strlen(sleepstr))) { 62 if (!strncmp(str, sleepstr, strlen(sleepstr))) {
@@ -100,14 +102,33 @@ static int __init profile_setup(char *str)
100__setup("profile=", profile_setup); 102__setup("profile=", profile_setup);
101 103
102 104
103void __init profile_init(void) 105int profile_init(void)
104{ 106{
107 int buffer_bytes;
105 if (!prof_on) 108 if (!prof_on)
106 return; 109 return 0;
107 110
108 /* only text is profiled */ 111 /* only text is profiled */
109 prof_len = (_etext - _stext) >> prof_shift; 112 prof_len = (_etext - _stext) >> prof_shift;
110 prof_buffer = alloc_bootmem(prof_len*sizeof(atomic_t)); 113 buffer_bytes = prof_len*sizeof(atomic_t);
114 if (!slab_is_available()) {
115 prof_buffer = alloc_bootmem(buffer_bytes);
116 return 0;
117 }
118
119 prof_buffer = kzalloc(buffer_bytes, GFP_KERNEL);
120 if (prof_buffer)
121 return 0;
122
123 prof_buffer = alloc_pages_exact(buffer_bytes, GFP_KERNEL|__GFP_ZERO);
124 if (prof_buffer)
125 return 0;
126
127 prof_buffer = vmalloc(buffer_bytes);
128 if (prof_buffer)
129 return 0;
130
131 return -ENOMEM;
111} 132}
112 133
113/* Profile event notifications */ 134/* Profile event notifications */
@@ -527,7 +548,7 @@ static void __init profile_nop(void *unused)
527{ 548{
528} 549}
529 550
530static int __init create_hash_tables(void) 551static int create_hash_tables(void)
531{ 552{
532 int cpu; 553 int cpu;
533 554
@@ -575,14 +596,14 @@ out_cleanup:
575#define create_hash_tables() ({ 0; }) 596#define create_hash_tables() ({ 0; })
576#endif 597#endif
577 598
578static int __init create_proc_profile(void) 599int create_proc_profile(void)
579{ 600{
580 struct proc_dir_entry *entry; 601 struct proc_dir_entry *entry;
581 602
582 if (!prof_on) 603 if (!prof_on)
583 return 0; 604 return 0;
584 if (create_hash_tables()) 605 if (create_hash_tables())
585 return -1; 606 return -ENOMEM;
586 entry = proc_create("profile", S_IWUSR | S_IRUGO, 607 entry = proc_create("profile", S_IWUSR | S_IRUGO,
587 NULL, &proc_profile_operations); 608 NULL, &proc_profile_operations);
588 if (!entry) 609 if (!entry)
diff --git a/kernel/resource.c b/kernel/resource.c
index 414d6fc9131e..4089d12af6e0 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -38,10 +38,6 @@ EXPORT_SYMBOL(iomem_resource);
38 38
39static DEFINE_RWLOCK(resource_lock); 39static DEFINE_RWLOCK(resource_lock);
40 40
41#ifdef CONFIG_PROC_FS
42
43enum { MAX_IORES_LEVEL = 5 };
44
45static void *r_next(struct seq_file *m, void *v, loff_t *pos) 41static void *r_next(struct seq_file *m, void *v, loff_t *pos)
46{ 42{
47 struct resource *p = v; 43 struct resource *p = v;
@@ -53,6 +49,10 @@ static void *r_next(struct seq_file *m, void *v, loff_t *pos)
53 return p->sibling; 49 return p->sibling;
54} 50}
55 51
52#ifdef CONFIG_PROC_FS
53
54enum { MAX_IORES_LEVEL = 5 };
55
56static void *r_start(struct seq_file *m, loff_t *pos) 56static void *r_start(struct seq_file *m, loff_t *pos)
57 __acquires(resource_lock) 57 __acquires(resource_lock)
58{ 58{
@@ -549,13 +549,9 @@ static void __init __reserve_region_with_split(struct resource *root,
549 } 549 }
550 550
551 if (!res) { 551 if (!res) {
552 printk(KERN_DEBUG " __reserve_region_with_split: (%s) [%llx, %llx], res: (%s) [%llx, %llx]\n",
553 conflict->name, conflict->start, conflict->end,
554 name, start, end);
555
556 /* failed, split and try again */ 552 /* failed, split and try again */
557 553
558 /* conflict coverred whole area */ 554 /* conflict covered whole area */
559 if (conflict->start <= start && conflict->end >= end) 555 if (conflict->start <= start && conflict->end >= end)
560 return; 556 return;
561 557
@@ -630,33 +626,34 @@ struct resource * __request_region(struct resource *parent,
630{ 626{
631 struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL); 627 struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
632 628
633 if (res) { 629 if (!res)
634 res->name = name; 630 return NULL;
635 res->start = start;
636 res->end = start + n - 1;
637 res->flags = IORESOURCE_BUSY;
638 631
639 write_lock(&resource_lock); 632 res->name = name;
633 res->start = start;
634 res->end = start + n - 1;
635 res->flags = IORESOURCE_BUSY;
640 636
641 for (;;) { 637 write_lock(&resource_lock);
642 struct resource *conflict;
643 638
644 conflict = __request_resource(parent, res); 639 for (;;) {
645 if (!conflict) 640 struct resource *conflict;
646 break;
647 if (conflict != parent) {
648 parent = conflict;
649 if (!(conflict->flags & IORESOURCE_BUSY))
650 continue;
651 }
652 641
653 /* Uhhuh, that didn't work out.. */ 642 conflict = __request_resource(parent, res);
654 kfree(res); 643 if (!conflict)
655 res = NULL;
656 break; 644 break;
645 if (conflict != parent) {
646 parent = conflict;
647 if (!(conflict->flags & IORESOURCE_BUSY))
648 continue;
657 } 649 }
658 write_unlock(&resource_lock); 650
651 /* Uhhuh, that didn't work out.. */
652 kfree(res);
653 res = NULL;
654 break;
659 } 655 }
656 write_unlock(&resource_lock);
660 return res; 657 return res;
661} 658}
662EXPORT_SYMBOL(__request_region); 659EXPORT_SYMBOL(__request_region);
@@ -831,3 +828,40 @@ static int __init reserve_setup(char *str)
831} 828}
832 829
833__setup("reserve=", reserve_setup); 830__setup("reserve=", reserve_setup);
831
832/*
833 * Check if the requested addr and size spans more than any slot in the
834 * iomem resource tree.
835 */
836int iomem_map_sanity_check(resource_size_t addr, unsigned long size)
837{
838 struct resource *p = &iomem_resource;
839 int err = 0;
840 loff_t l;
841
842 read_lock(&resource_lock);
843 for (p = p->child; p ; p = r_next(NULL, p, &l)) {
844 /*
845 * We can probably skip the resources without
846 * IORESOURCE_IO attribute?
847 */
848 if (p->start >= addr + size)
849 continue;
850 if (p->end < addr)
851 continue;
852 if (p->start <= addr && (p->end >= addr + size - 1))
853 continue;
854 printk(KERN_WARNING "resource map sanity check conflict: "
855 "0x%llx 0x%llx 0x%llx 0x%llx %s\n",
856 (unsigned long long)addr,
857 (unsigned long long)(addr + size - 1),
858 (unsigned long long)p->start,
859 (unsigned long long)p->end,
860 p->name);
861 err = -1;
862 break;
863 }
864 read_unlock(&resource_lock);
865
866 return err;
867}
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index e8ab096ddfe3..81787248b60f 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -118,13 +118,13 @@ static u64 __update_sched_clock(struct sched_clock_data *scd, u64 now)
118 118
119 /* 119 /*
120 * scd->clock = clamp(scd->tick_gtod + delta, 120 * scd->clock = clamp(scd->tick_gtod + delta,
121 * max(scd->tick_gtod, scd->clock), 121 * max(scd->tick_gtod, scd->clock),
122 * scd->tick_gtod + TICK_NSEC); 122 * max(scd->clock, scd->tick_gtod + TICK_NSEC));
123 */ 123 */
124 124
125 clock = scd->tick_gtod + delta; 125 clock = scd->tick_gtod + delta;
126 min_clock = wrap_max(scd->tick_gtod, scd->clock); 126 min_clock = wrap_max(scd->tick_gtod, scd->clock);
127 max_clock = scd->tick_gtod + TICK_NSEC; 127 max_clock = wrap_max(scd->clock, scd->tick_gtod + TICK_NSEC);
128 128
129 clock = wrap_max(clock, min_clock); 129 clock = wrap_max(clock, min_clock);
130 clock = wrap_min(clock, max_clock); 130 clock = wrap_min(clock, max_clock);
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
index bbe6b31c3c56..ad958c1ec708 100644
--- a/kernel/sched_debug.c
+++ b/kernel/sched_debug.c
@@ -333,12 +333,10 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
333 unsigned long flags; 333 unsigned long flags;
334 int num_threads = 1; 334 int num_threads = 1;
335 335
336 rcu_read_lock();
337 if (lock_task_sighand(p, &flags)) { 336 if (lock_task_sighand(p, &flags)) {
338 num_threads = atomic_read(&p->signal->count); 337 num_threads = atomic_read(&p->signal->count);
339 unlock_task_sighand(p, &flags); 338 unlock_task_sighand(p, &flags);
340 } 339 }
341 rcu_read_unlock();
342 340
343 SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid, num_threads); 341 SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, p->pid, num_threads);
344 SEQ_printf(m, 342 SEQ_printf(m,
diff --git a/kernel/softirq.c b/kernel/softirq.c
index c506f266a6b9..83ba21a13bd4 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -6,6 +6,8 @@
6 * Distribute under GPLv2. 6 * Distribute under GPLv2.
7 * 7 *
8 * Rewritten. Old one was good in 2.2, but in 2.3 it was immoral. --ANK (990903) 8 * Rewritten. Old one was good in 2.2, but in 2.3 it was immoral. --ANK (990903)
9 *
10 * Remote softirq infrastructure is by Jens Axboe.
9 */ 11 */
10 12
11#include <linux/module.h> 13#include <linux/module.h>
@@ -46,7 +48,7 @@ irq_cpustat_t irq_stat[NR_CPUS] ____cacheline_aligned;
46EXPORT_SYMBOL(irq_stat); 48EXPORT_SYMBOL(irq_stat);
47#endif 49#endif
48 50
49static struct softirq_action softirq_vec[32] __cacheline_aligned_in_smp; 51static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp;
50 52
51static DEFINE_PER_CPU(struct task_struct *, ksoftirqd); 53static DEFINE_PER_CPU(struct task_struct *, ksoftirqd);
52 54
@@ -205,7 +207,18 @@ restart:
205 207
206 do { 208 do {
207 if (pending & 1) { 209 if (pending & 1) {
210 int prev_count = preempt_count();
211
208 h->action(h); 212 h->action(h);
213
214 if (unlikely(prev_count != preempt_count())) {
215 printk(KERN_ERR "huh, entered softirq %td %p"
216 "with preempt_count %08x,"
217 " exited with %08x?\n", h - softirq_vec,
218 h->action, prev_count, preempt_count());
219 preempt_count() = prev_count;
220 }
221
209 rcu_bh_qsctr_inc(cpu); 222 rcu_bh_qsctr_inc(cpu);
210 } 223 }
211 h++; 224 h++;
@@ -463,17 +476,144 @@ void tasklet_kill(struct tasklet_struct *t)
463 476
464EXPORT_SYMBOL(tasklet_kill); 477EXPORT_SYMBOL(tasklet_kill);
465 478
479DEFINE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list);
480EXPORT_PER_CPU_SYMBOL(softirq_work_list);
481
482static void __local_trigger(struct call_single_data *cp, int softirq)
483{
484 struct list_head *head = &__get_cpu_var(softirq_work_list[softirq]);
485
486 list_add_tail(&cp->list, head);
487
488 /* Trigger the softirq only if the list was previously empty. */
489 if (head->next == &cp->list)
490 raise_softirq_irqoff(softirq);
491}
492
493#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
494static void remote_softirq_receive(void *data)
495{
496 struct call_single_data *cp = data;
497 unsigned long flags;
498 int softirq;
499
500 softirq = cp->priv;
501
502 local_irq_save(flags);
503 __local_trigger(cp, softirq);
504 local_irq_restore(flags);
505}
506
507static int __try_remote_softirq(struct call_single_data *cp, int cpu, int softirq)
508{
509 if (cpu_online(cpu)) {
510 cp->func = remote_softirq_receive;
511 cp->info = cp;
512 cp->flags = 0;
513 cp->priv = softirq;
514
515 __smp_call_function_single(cpu, cp);
516 return 0;
517 }
518 return 1;
519}
520#else /* CONFIG_USE_GENERIC_SMP_HELPERS */
521static int __try_remote_softirq(struct call_single_data *cp, int cpu, int softirq)
522{
523 return 1;
524}
525#endif
526
527/**
528 * __send_remote_softirq - try to schedule softirq work on a remote cpu
529 * @cp: private SMP call function data area
530 * @cpu: the remote cpu
531 * @this_cpu: the currently executing cpu
532 * @softirq: the softirq for the work
533 *
534 * Attempt to schedule softirq work on a remote cpu. If this cannot be
535 * done, the work is instead queued up on the local cpu.
536 *
537 * Interrupts must be disabled.
538 */
539void __send_remote_softirq(struct call_single_data *cp, int cpu, int this_cpu, int softirq)
540{
541 if (cpu == this_cpu || __try_remote_softirq(cp, cpu, softirq))
542 __local_trigger(cp, softirq);
543}
544EXPORT_SYMBOL(__send_remote_softirq);
545
546/**
547 * send_remote_softirq - try to schedule softirq work on a remote cpu
548 * @cp: private SMP call function data area
549 * @cpu: the remote cpu
550 * @softirq: the softirq for the work
551 *
552 * Like __send_remote_softirq except that disabling interrupts and
553 * computing the current cpu is done for the caller.
554 */
555void send_remote_softirq(struct call_single_data *cp, int cpu, int softirq)
556{
557 unsigned long flags;
558 int this_cpu;
559
560 local_irq_save(flags);
561 this_cpu = smp_processor_id();
562 __send_remote_softirq(cp, cpu, this_cpu, softirq);
563 local_irq_restore(flags);
564}
565EXPORT_SYMBOL(send_remote_softirq);
566
567static int __cpuinit remote_softirq_cpu_notify(struct notifier_block *self,
568 unsigned long action, void *hcpu)
569{
570 /*
571 * If a CPU goes away, splice its entries to the current CPU
572 * and trigger a run of the softirq
573 */
574 if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
575 int cpu = (unsigned long) hcpu;
576 int i;
577
578 local_irq_disable();
579 for (i = 0; i < NR_SOFTIRQS; i++) {
580 struct list_head *head = &per_cpu(softirq_work_list[i], cpu);
581 struct list_head *local_head;
582
583 if (list_empty(head))
584 continue;
585
586 local_head = &__get_cpu_var(softirq_work_list[i]);
587 list_splice_init(head, local_head);
588 raise_softirq_irqoff(i);
589 }
590 local_irq_enable();
591 }
592
593 return NOTIFY_OK;
594}
595
596static struct notifier_block __cpuinitdata remote_softirq_cpu_notifier = {
597 .notifier_call = remote_softirq_cpu_notify,
598};
599
466void __init softirq_init(void) 600void __init softirq_init(void)
467{ 601{
468 int cpu; 602 int cpu;
469 603
470 for_each_possible_cpu(cpu) { 604 for_each_possible_cpu(cpu) {
605 int i;
606
471 per_cpu(tasklet_vec, cpu).tail = 607 per_cpu(tasklet_vec, cpu).tail =
472 &per_cpu(tasklet_vec, cpu).head; 608 &per_cpu(tasklet_vec, cpu).head;
473 per_cpu(tasklet_hi_vec, cpu).tail = 609 per_cpu(tasklet_hi_vec, cpu).tail =
474 &per_cpu(tasklet_hi_vec, cpu).head; 610 &per_cpu(tasklet_hi_vec, cpu).head;
611 for (i = 0; i < NR_SOFTIRQS; i++)
612 INIT_LIST_HEAD(&per_cpu(softirq_work_list[i], cpu));
475 } 613 }
476 614
615 register_hotcpu_notifier(&remote_softirq_cpu_notifier);
616
477 open_softirq(TASKLET_SOFTIRQ, tasklet_action); 617 open_softirq(TASKLET_SOFTIRQ, tasklet_action);
478 open_softirq(HI_SOFTIRQ, tasklet_hi_action); 618 open_softirq(HI_SOFTIRQ, tasklet_hi_action);
479} 619}
diff --git a/kernel/softlockup.c b/kernel/softlockup.c
index cb838ee93a82..3953e4aed733 100644
--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -226,7 +226,7 @@ static void check_hung_uninterruptible_tasks(int this_cpu)
226 * If the system crashed already then all bets are off, 226 * If the system crashed already then all bets are off,
227 * do not report extra hung tasks: 227 * do not report extra hung tasks:
228 */ 228 */
229 if ((tainted & TAINT_DIE) || did_panic) 229 if (test_taint(TAINT_DIE) || did_panic)
230 return; 230 return;
231 231
232 read_lock(&tasklist_lock); 232 read_lock(&tasklist_lock);
diff --git a/kernel/sys.c b/kernel/sys.c
index 234d9454294e..0bc8fa3c2288 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1349,8 +1349,10 @@ asmlinkage long sys_sethostname(char __user *name, int len)
1349 down_write(&uts_sem); 1349 down_write(&uts_sem);
1350 errno = -EFAULT; 1350 errno = -EFAULT;
1351 if (!copy_from_user(tmp, name, len)) { 1351 if (!copy_from_user(tmp, name, len)) {
1352 memcpy(utsname()->nodename, tmp, len); 1352 struct new_utsname *u = utsname();
1353 utsname()->nodename[len] = 0; 1353
1354 memcpy(u->nodename, tmp, len);
1355 memset(u->nodename + len, 0, sizeof(u->nodename) - len);
1354 errno = 0; 1356 errno = 0;
1355 } 1357 }
1356 up_write(&uts_sem); 1358 up_write(&uts_sem);
@@ -1362,15 +1364,17 @@ asmlinkage long sys_sethostname(char __user *name, int len)
1362asmlinkage long sys_gethostname(char __user *name, int len) 1364asmlinkage long sys_gethostname(char __user *name, int len)
1363{ 1365{
1364 int i, errno; 1366 int i, errno;
1367 struct new_utsname *u;
1365 1368
1366 if (len < 0) 1369 if (len < 0)
1367 return -EINVAL; 1370 return -EINVAL;
1368 down_read(&uts_sem); 1371 down_read(&uts_sem);
1369 i = 1 + strlen(utsname()->nodename); 1372 u = utsname();
1373 i = 1 + strlen(u->nodename);
1370 if (i > len) 1374 if (i > len)
1371 i = len; 1375 i = len;
1372 errno = 0; 1376 errno = 0;
1373 if (copy_to_user(name, utsname()->nodename, i)) 1377 if (copy_to_user(name, u->nodename, i))
1374 errno = -EFAULT; 1378 errno = -EFAULT;
1375 up_read(&uts_sem); 1379 up_read(&uts_sem);
1376 return errno; 1380 return errno;
@@ -1395,8 +1399,10 @@ asmlinkage long sys_setdomainname(char __user *name, int len)
1395 down_write(&uts_sem); 1399 down_write(&uts_sem);
1396 errno = -EFAULT; 1400 errno = -EFAULT;
1397 if (!copy_from_user(tmp, name, len)) { 1401 if (!copy_from_user(tmp, name, len)) {
1398 memcpy(utsname()->domainname, tmp, len); 1402 struct new_utsname *u = utsname();
1399 utsname()->domainname[len] = 0; 1403
1404 memcpy(u->domainname, tmp, len);
1405 memset(u->domainname + len, 0, sizeof(u->domainname) - len);
1400 errno = 0; 1406 errno = 0;
1401 } 1407 }
1402 up_write(&uts_sem); 1408 up_write(&uts_sem);
@@ -1450,14 +1456,22 @@ asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim)
1450 return -EINVAL; 1456 return -EINVAL;
1451 if (copy_from_user(&new_rlim, rlim, sizeof(*rlim))) 1457 if (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
1452 return -EFAULT; 1458 return -EFAULT;
1453 if (new_rlim.rlim_cur > new_rlim.rlim_max)
1454 return -EINVAL;
1455 old_rlim = current->signal->rlim + resource; 1459 old_rlim = current->signal->rlim + resource;
1456 if ((new_rlim.rlim_max > old_rlim->rlim_max) && 1460 if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
1457 !capable(CAP_SYS_RESOURCE)) 1461 !capable(CAP_SYS_RESOURCE))
1458 return -EPERM; 1462 return -EPERM;
1459 if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open) 1463
1460 return -EPERM; 1464 if (resource == RLIMIT_NOFILE) {
1465 if (new_rlim.rlim_max == RLIM_INFINITY)
1466 new_rlim.rlim_max = sysctl_nr_open;
1467 if (new_rlim.rlim_cur == RLIM_INFINITY)
1468 new_rlim.rlim_cur = sysctl_nr_open;
1469 if (new_rlim.rlim_max > sysctl_nr_open)
1470 return -EPERM;
1471 }
1472
1473 if (new_rlim.rlim_cur > new_rlim.rlim_max)
1474 return -EINVAL;
1461 1475
1462 retval = security_task_setrlimit(resource, &new_rlim); 1476 retval = security_task_setrlimit(resource, &new_rlim);
1463 if (retval) 1477 if (retval)
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c
index 08d6e1bb99ac..a77b27b11b04 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -125,6 +125,12 @@ cond_syscall(sys_vm86old);
125cond_syscall(sys_vm86); 125cond_syscall(sys_vm86);
126cond_syscall(compat_sys_ipc); 126cond_syscall(compat_sys_ipc);
127cond_syscall(compat_sys_sysctl); 127cond_syscall(compat_sys_sysctl);
128cond_syscall(sys_flock);
129cond_syscall(sys_io_setup);
130cond_syscall(sys_io_destroy);
131cond_syscall(sys_io_submit);
132cond_syscall(sys_io_cancel);
133cond_syscall(sys_io_getevents);
128 134
129/* arch-specific weak syscall entries */ 135/* arch-specific weak syscall entries */
130cond_syscall(sys_pciconfig_read); 136cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 1bf369bd4423..617d41e4d6a0 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -80,7 +80,6 @@ extern int pid_max_min, pid_max_max;
80extern int sysctl_drop_caches; 80extern int sysctl_drop_caches;
81extern int percpu_pagelist_fraction; 81extern int percpu_pagelist_fraction;
82extern int compat_log; 82extern int compat_log;
83extern int maps_protect;
84extern int latencytop_enabled; 83extern int latencytop_enabled;
85extern int sysctl_nr_open_min, sysctl_nr_open_max; 84extern int sysctl_nr_open_min, sysctl_nr_open_max;
86#ifdef CONFIG_RCU_TORTURE_TEST 85#ifdef CONFIG_RCU_TORTURE_TEST
@@ -97,7 +96,7 @@ static int sixty = 60;
97static int neg_one = -1; 96static int neg_one = -1;
98#endif 97#endif
99 98
100#ifdef CONFIG_MMU 99#if defined(CONFIG_MMU) && defined(CONFIG_FILE_LOCKING)
101static int two = 2; 100static int two = 2;
102#endif 101#endif
103 102
@@ -150,7 +149,7 @@ extern int max_lock_depth;
150#ifdef CONFIG_PROC_SYSCTL 149#ifdef CONFIG_PROC_SYSCTL
151static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp, 150static int proc_do_cad_pid(struct ctl_table *table, int write, struct file *filp,
152 void __user *buffer, size_t *lenp, loff_t *ppos); 151 void __user *buffer, size_t *lenp, loff_t *ppos);
153static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp, 152static int proc_taint(struct ctl_table *table, int write, struct file *filp,
154 void __user *buffer, size_t *lenp, loff_t *ppos); 153 void __user *buffer, size_t *lenp, loff_t *ppos);
155#endif 154#endif
156 155
@@ -380,10 +379,9 @@ static struct ctl_table kern_table[] = {
380#ifdef CONFIG_PROC_SYSCTL 379#ifdef CONFIG_PROC_SYSCTL
381 { 380 {
382 .procname = "tainted", 381 .procname = "tainted",
383 .data = &tainted, 382 .maxlen = sizeof(long),
384 .maxlen = sizeof(int),
385 .mode = 0644, 383 .mode = 0644,
386 .proc_handler = &proc_dointvec_taint, 384 .proc_handler = &proc_taint,
387 }, 385 },
388#endif 386#endif
389#ifdef CONFIG_LATENCYTOP 387#ifdef CONFIG_LATENCYTOP
@@ -808,16 +806,6 @@ static struct ctl_table kern_table[] = {
808 .proc_handler = &proc_dointvec, 806 .proc_handler = &proc_dointvec,
809 }, 807 },
810#endif 808#endif
811#ifdef CONFIG_PROC_FS
812 {
813 .ctl_name = CTL_UNNUMBERED,
814 .procname = "maps_protect",
815 .data = &maps_protect,
816 .maxlen = sizeof(int),
817 .mode = 0644,
818 .proc_handler = &proc_dointvec,
819 },
820#endif
821 { 809 {
822 .ctl_name = CTL_UNNUMBERED, 810 .ctl_name = CTL_UNNUMBERED,
823 .procname = "poweroff_cmd", 811 .procname = "poweroff_cmd",
@@ -1259,6 +1247,7 @@ static struct ctl_table fs_table[] = {
1259 .extra1 = &minolduid, 1247 .extra1 = &minolduid,
1260 .extra2 = &maxolduid, 1248 .extra2 = &maxolduid,
1261 }, 1249 },
1250#ifdef CONFIG_FILE_LOCKING
1262 { 1251 {
1263 .ctl_name = FS_LEASES, 1252 .ctl_name = FS_LEASES,
1264 .procname = "leases-enable", 1253 .procname = "leases-enable",
@@ -1267,6 +1256,7 @@ static struct ctl_table fs_table[] = {
1267 .mode = 0644, 1256 .mode = 0644,
1268 .proc_handler = &proc_dointvec, 1257 .proc_handler = &proc_dointvec,
1269 }, 1258 },
1259#endif
1270#ifdef CONFIG_DNOTIFY 1260#ifdef CONFIG_DNOTIFY
1271 { 1261 {
1272 .ctl_name = FS_DIR_NOTIFY, 1262 .ctl_name = FS_DIR_NOTIFY,
@@ -1278,6 +1268,7 @@ static struct ctl_table fs_table[] = {
1278 }, 1268 },
1279#endif 1269#endif
1280#ifdef CONFIG_MMU 1270#ifdef CONFIG_MMU
1271#ifdef CONFIG_FILE_LOCKING
1281 { 1272 {
1282 .ctl_name = FS_LEASE_TIME, 1273 .ctl_name = FS_LEASE_TIME,
1283 .procname = "lease-break-time", 1274 .procname = "lease-break-time",
@@ -1289,6 +1280,8 @@ static struct ctl_table fs_table[] = {
1289 .extra1 = &zero, 1280 .extra1 = &zero,
1290 .extra2 = &two, 1281 .extra2 = &two,
1291 }, 1282 },
1283#endif
1284#ifdef CONFIG_AIO
1292 { 1285 {
1293 .procname = "aio-nr", 1286 .procname = "aio-nr",
1294 .data = &aio_nr, 1287 .data = &aio_nr,
@@ -1303,6 +1296,7 @@ static struct ctl_table fs_table[] = {
1303 .mode = 0644, 1296 .mode = 0644,
1304 .proc_handler = &proc_doulongvec_minmax, 1297 .proc_handler = &proc_doulongvec_minmax,
1305 }, 1298 },
1299#endif /* CONFIG_AIO */
1306#ifdef CONFIG_INOTIFY_USER 1300#ifdef CONFIG_INOTIFY_USER
1307 { 1301 {
1308 .ctl_name = FS_INOTIFY, 1302 .ctl_name = FS_INOTIFY,
@@ -1508,7 +1502,6 @@ void register_sysctl_root(struct ctl_table_root *root)
1508/* Perform the actual read/write of a sysctl table entry. */ 1502/* Perform the actual read/write of a sysctl table entry. */
1509static int do_sysctl_strategy(struct ctl_table_root *root, 1503static int do_sysctl_strategy(struct ctl_table_root *root,
1510 struct ctl_table *table, 1504 struct ctl_table *table,
1511 int __user *name, int nlen,
1512 void __user *oldval, size_t __user *oldlenp, 1505 void __user *oldval, size_t __user *oldlenp,
1513 void __user *newval, size_t newlen) 1506 void __user *newval, size_t newlen)
1514{ 1507{
@@ -1522,8 +1515,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root,
1522 return -EPERM; 1515 return -EPERM;
1523 1516
1524 if (table->strategy) { 1517 if (table->strategy) {
1525 rc = table->strategy(table, name, nlen, oldval, oldlenp, 1518 rc = table->strategy(table, oldval, oldlenp, newval, newlen);
1526 newval, newlen);
1527 if (rc < 0) 1519 if (rc < 0)
1528 return rc; 1520 return rc;
1529 if (rc > 0) 1521 if (rc > 0)
@@ -1533,8 +1525,7 @@ static int do_sysctl_strategy(struct ctl_table_root *root,
1533 /* If there is no strategy routine, or if the strategy returns 1525 /* If there is no strategy routine, or if the strategy returns
1534 * zero, proceed with automatic r/w */ 1526 * zero, proceed with automatic r/w */
1535 if (table->data && table->maxlen) { 1527 if (table->data && table->maxlen) {
1536 rc = sysctl_data(table, name, nlen, oldval, oldlenp, 1528 rc = sysctl_data(table, oldval, oldlenp, newval, newlen);
1537 newval, newlen);
1538 if (rc < 0) 1529 if (rc < 0)
1539 return rc; 1530 return rc;
1540 } 1531 }
@@ -1566,7 +1557,7 @@ repeat:
1566 table = table->child; 1557 table = table->child;
1567 goto repeat; 1558 goto repeat;
1568 } 1559 }
1569 error = do_sysctl_strategy(root, table, name, nlen, 1560 error = do_sysctl_strategy(root, table,
1570 oldval, oldlenp, 1561 oldval, oldlenp,
1571 newval, newlen); 1562 newval, newlen);
1572 return error; 1563 return error;
@@ -2235,49 +2226,39 @@ int proc_dointvec(struct ctl_table *table, int write, struct file *filp,
2235 NULL,NULL); 2226 NULL,NULL);
2236} 2227}
2237 2228
2238#define OP_SET 0
2239#define OP_AND 1
2240#define OP_OR 2
2241
2242static int do_proc_dointvec_bset_conv(int *negp, unsigned long *lvalp,
2243 int *valp,
2244 int write, void *data)
2245{
2246 int op = *(int *)data;
2247 if (write) {
2248 int val = *negp ? -*lvalp : *lvalp;
2249 switch(op) {
2250 case OP_SET: *valp = val; break;
2251 case OP_AND: *valp &= val; break;
2252 case OP_OR: *valp |= val; break;
2253 }
2254 } else {
2255 int val = *valp;
2256 if (val < 0) {
2257 *negp = -1;
2258 *lvalp = (unsigned long)-val;
2259 } else {
2260 *negp = 0;
2261 *lvalp = (unsigned long)val;
2262 }
2263 }
2264 return 0;
2265}
2266
2267/* 2229/*
2268 * Taint values can only be increased 2230 * Taint values can only be increased
2231 * This means we can safely use a temporary.
2269 */ 2232 */
2270static int proc_dointvec_taint(struct ctl_table *table, int write, struct file *filp, 2233static int proc_taint(struct ctl_table *table, int write, struct file *filp,
2271 void __user *buffer, size_t *lenp, loff_t *ppos) 2234 void __user *buffer, size_t *lenp, loff_t *ppos)
2272{ 2235{
2273 int op; 2236 struct ctl_table t;
2237 unsigned long tmptaint = get_taint();
2238 int err;
2274 2239
2275 if (write && !capable(CAP_SYS_ADMIN)) 2240 if (write && !capable(CAP_SYS_ADMIN))
2276 return -EPERM; 2241 return -EPERM;
2277 2242
2278 op = OP_OR; 2243 t = *table;
2279 return do_proc_dointvec(table,write,filp,buffer,lenp,ppos, 2244 t.data = &tmptaint;
2280 do_proc_dointvec_bset_conv,&op); 2245 err = proc_doulongvec_minmax(&t, write, filp, buffer, lenp, ppos);
2246 if (err < 0)
2247 return err;
2248
2249 if (write) {
2250 /*
2251 * Poor man's atomic or. Not worth adding a primitive
2252 * to everyone's atomic.h for this
2253 */
2254 int i;
2255 for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
2256 if ((tmptaint >> i) & 1)
2257 add_taint(i);
2258 }
2259 }
2260
2261 return err;
2281} 2262}
2282 2263
2283struct do_proc_dointvec_minmax_conv_param { 2264struct do_proc_dointvec_minmax_conv_param {
@@ -2725,7 +2706,7 @@ int proc_doulongvec_ms_jiffies_minmax(struct ctl_table *table, int write,
2725 */ 2706 */
2726 2707
2727/* The generic sysctl data routine (used if no strategy routine supplied) */ 2708/* The generic sysctl data routine (used if no strategy routine supplied) */
2728int sysctl_data(struct ctl_table *table, int __user *name, int nlen, 2709int sysctl_data(struct ctl_table *table,
2729 void __user *oldval, size_t __user *oldlenp, 2710 void __user *oldval, size_t __user *oldlenp,
2730 void __user *newval, size_t newlen) 2711 void __user *newval, size_t newlen)
2731{ 2712{
@@ -2759,7 +2740,7 @@ int sysctl_data(struct ctl_table *table, int __user *name, int nlen,
2759} 2740}
2760 2741
2761/* The generic string strategy routine: */ 2742/* The generic string strategy routine: */
2762int sysctl_string(struct ctl_table *table, int __user *name, int nlen, 2743int sysctl_string(struct ctl_table *table,
2763 void __user *oldval, size_t __user *oldlenp, 2744 void __user *oldval, size_t __user *oldlenp,
2764 void __user *newval, size_t newlen) 2745 void __user *newval, size_t newlen)
2765{ 2746{
@@ -2805,7 +2786,7 @@ int sysctl_string(struct ctl_table *table, int __user *name, int nlen,
2805 * are between the minimum and maximum values given in the arrays 2786 * are between the minimum and maximum values given in the arrays
2806 * table->extra1 and table->extra2, respectively. 2787 * table->extra1 and table->extra2, respectively.
2807 */ 2788 */
2808int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen, 2789int sysctl_intvec(struct ctl_table *table,
2809 void __user *oldval, size_t __user *oldlenp, 2790 void __user *oldval, size_t __user *oldlenp,
2810 void __user *newval, size_t newlen) 2791 void __user *newval, size_t newlen)
2811{ 2792{
@@ -2841,7 +2822,7 @@ int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen,
2841} 2822}
2842 2823
2843/* Strategy function to convert jiffies to seconds */ 2824/* Strategy function to convert jiffies to seconds */
2844int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen, 2825int sysctl_jiffies(struct ctl_table *table,
2845 void __user *oldval, size_t __user *oldlenp, 2826 void __user *oldval, size_t __user *oldlenp,
2846 void __user *newval, size_t newlen) 2827 void __user *newval, size_t newlen)
2847{ 2828{
@@ -2875,7 +2856,7 @@ int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen,
2875} 2856}
2876 2857
2877/* Strategy function to convert jiffies to seconds */ 2858/* Strategy function to convert jiffies to seconds */
2878int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen, 2859int sysctl_ms_jiffies(struct ctl_table *table,
2879 void __user *oldval, size_t __user *oldlenp, 2860 void __user *oldval, size_t __user *oldlenp,
2880 void __user *newval, size_t newlen) 2861 void __user *newval, size_t newlen)
2881{ 2862{
@@ -2930,35 +2911,35 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
2930 return error; 2911 return error;
2931} 2912}
2932 2913
2933int sysctl_data(struct ctl_table *table, int __user *name, int nlen, 2914int sysctl_data(struct ctl_table *table,
2934 void __user *oldval, size_t __user *oldlenp, 2915 void __user *oldval, size_t __user *oldlenp,
2935 void __user *newval, size_t newlen) 2916 void __user *newval, size_t newlen)
2936{ 2917{
2937 return -ENOSYS; 2918 return -ENOSYS;
2938} 2919}
2939 2920
2940int sysctl_string(struct ctl_table *table, int __user *name, int nlen, 2921int sysctl_string(struct ctl_table *table,
2941 void __user *oldval, size_t __user *oldlenp, 2922 void __user *oldval, size_t __user *oldlenp,
2942 void __user *newval, size_t newlen) 2923 void __user *newval, size_t newlen)
2943{ 2924{
2944 return -ENOSYS; 2925 return -ENOSYS;
2945} 2926}
2946 2927
2947int sysctl_intvec(struct ctl_table *table, int __user *name, int nlen, 2928int sysctl_intvec(struct ctl_table *table,
2948 void __user *oldval, size_t __user *oldlenp, 2929 void __user *oldval, size_t __user *oldlenp,
2949 void __user *newval, size_t newlen) 2930 void __user *newval, size_t newlen)
2950{ 2931{
2951 return -ENOSYS; 2932 return -ENOSYS;
2952} 2933}
2953 2934
2954int sysctl_jiffies(struct ctl_table *table, int __user *name, int nlen, 2935int sysctl_jiffies(struct ctl_table *table,
2955 void __user *oldval, size_t __user *oldlenp, 2936 void __user *oldval, size_t __user *oldlenp,
2956 void __user *newval, size_t newlen) 2937 void __user *newval, size_t newlen)
2957{ 2938{
2958 return -ENOSYS; 2939 return -ENOSYS;
2959} 2940}
2960 2941
2961int sysctl_ms_jiffies(struct ctl_table *table, int __user *name, int nlen, 2942int sysctl_ms_jiffies(struct ctl_table *table,
2962 void __user *oldval, size_t __user *oldlenp, 2943 void __user *oldval, size_t __user *oldlenp,
2963 void __user *newval, size_t newlen) 2944 void __user *newval, size_t newlen)
2964{ 2945{
diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index 8d53106a0a92..95ed42951e0a 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -3,7 +3,6 @@
3# 3#
4config TICK_ONESHOT 4config TICK_ONESHOT
5 bool 5 bool
6 default n
7 6
8config NO_HZ 7config NO_HZ
9 bool "Tickless System (Dynamic Ticks)" 8 bool "Tickless System (Dynamic Ticks)"
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index a4d219398167..b711ffcb106c 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -270,7 +270,7 @@ void tick_nohz_stop_sched_tick(int inidle)
270 next_jiffies = get_next_timer_interrupt(last_jiffies); 270 next_jiffies = get_next_timer_interrupt(last_jiffies);
271 delta_jiffies = next_jiffies - last_jiffies; 271 delta_jiffies = next_jiffies - last_jiffies;
272 272
273 if (rcu_needs_cpu(cpu)) 273 if (rcu_needs_cpu(cpu) || printk_needs_cpu(cpu))
274 delta_jiffies = 1; 274 delta_jiffies = 1;
275 /* 275 /*
276 * Do not stop the tick, if we are only one off 276 * Do not stop the tick, if we are only one off
diff --git a/kernel/timer.c b/kernel/timer.c
index 03bc7f1f1593..510fe69351ca 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -978,6 +978,7 @@ void update_process_times(int user_tick)
978 run_local_timers(); 978 run_local_timers();
979 if (rcu_pending(cpu)) 979 if (rcu_pending(cpu))
980 rcu_check_callbacks(cpu, user_tick); 980 rcu_check_callbacks(cpu, user_tick);
981 printk_tick();
981 scheduler_tick(); 982 scheduler_tick();
982 run_posix_cpu_timers(p); 983 run_posix_cpu_timers(p);
983} 984}
diff --git a/kernel/utsname_sysctl.c b/kernel/utsname_sysctl.c
index 4ab9659d269e..3b34b3545936 100644
--- a/kernel/utsname_sysctl.c
+++ b/kernel/utsname_sysctl.c
@@ -60,7 +60,7 @@ static int proc_do_uts_string(ctl_table *table, int write, struct file *filp,
60 60
61#ifdef CONFIG_SYSCTL_SYSCALL 61#ifdef CONFIG_SYSCTL_SYSCALL
62/* The generic string strategy routine: */ 62/* The generic string strategy routine: */
63static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen, 63static int sysctl_uts_string(ctl_table *table,
64 void __user *oldval, size_t __user *oldlenp, 64 void __user *oldval, size_t __user *oldlenp,
65 void __user *newval, size_t newlen) 65 void __user *newval, size_t newlen)
66{ 66{
@@ -69,8 +69,7 @@ static int sysctl_uts_string(ctl_table *table, int __user *name, int nlen,
69 write = newval && newlen; 69 write = newval && newlen;
70 memcpy(&uts_table, table, sizeof(uts_table)); 70 memcpy(&uts_table, table, sizeof(uts_table));
71 uts_table.data = get_uts(table, write); 71 uts_table.data = get_uts(table, write);
72 r = sysctl_string(&uts_table, name, nlen, 72 r = sysctl_string(&uts_table, oldval, oldlenp, newval, newlen);
73 oldval, oldlenp, newval, newlen);
74 put_uts(table, write, uts_table.data); 73 put_uts(table, write, uts_table.data);
75 return r; 74 return r;
76} 75}
diff --git a/kernel/wait.c b/kernel/wait.c
index c275c56cf2d3..cd87131f2fc2 100644
--- a/kernel/wait.c
+++ b/kernel/wait.c
@@ -72,12 +72,7 @@ prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)
72 spin_lock_irqsave(&q->lock, flags); 72 spin_lock_irqsave(&q->lock, flags);
73 if (list_empty(&wait->task_list)) 73 if (list_empty(&wait->task_list))
74 __add_wait_queue(q, wait); 74 __add_wait_queue(q, wait);
75 /* 75 set_current_state(state);
76 * don't alter the task state if this is just going to
77 * queue an async wait queue callback
78 */
79 if (is_sync_wait(wait))
80 set_current_state(state);
81 spin_unlock_irqrestore(&q->lock, flags); 76 spin_unlock_irqrestore(&q->lock, flags);
82} 77}
83EXPORT_SYMBOL(prepare_to_wait); 78EXPORT_SYMBOL(prepare_to_wait);
@@ -91,12 +86,7 @@ prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state)
91 spin_lock_irqsave(&q->lock, flags); 86 spin_lock_irqsave(&q->lock, flags);
92 if (list_empty(&wait->task_list)) 87 if (list_empty(&wait->task_list))
93 __add_wait_queue_tail(q, wait); 88 __add_wait_queue_tail(q, wait);
94 /* 89 set_current_state(state);
95 * don't alter the task state if this is just going to
96 * queue an async wait queue callback
97 */
98 if (is_sync_wait(wait))
99 set_current_state(state);
100 spin_unlock_irqrestore(&q->lock, flags); 90 spin_unlock_irqrestore(&q->lock, flags);
101} 91}
102EXPORT_SYMBOL(prepare_to_wait_exclusive); 92EXPORT_SYMBOL(prepare_to_wait_exclusive);
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 4048e92aa04f..714afad46539 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -9,7 +9,7 @@
9 * Derived from the taskqueue/keventd code by: 9 * Derived from the taskqueue/keventd code by:
10 * 10 *
11 * David Woodhouse <dwmw2@infradead.org> 11 * David Woodhouse <dwmw2@infradead.org>
12 * Andrew Morton <andrewm@uow.edu.au> 12 * Andrew Morton
13 * Kai Petzke <wpp@marie.physik.tu-berlin.de> 13 * Kai Petzke <wpp@marie.physik.tu-berlin.de>
14 * Theodore Ts'o <tytso@mit.edu> 14 * Theodore Ts'o <tytso@mit.edu>
15 * 15 *