aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2009-05-22 04:40:59 -0400
committerJames Morris <jmorris@namei.org>2009-05-22 04:40:59 -0400
commit2c9e703c618106f5383226fbb1f526cb11034f8a (patch)
tree87d7548001ea82f655fede0640466fc16aabcdf7 /kernel
parent6470c077cae12227318f40f3e6d756caadcce4b0 (diff)
parent5805977e63a36ad56594a623f3bd2bebcb7db233 (diff)
Merge branch 'master' into next
Conflicts: fs/exec.c Removed IMA changes (the IMA checks are now performed via may_open()). Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c3
-rw-r--r--kernel/futex.c24
-rw-r--r--kernel/kgdb.c4
-rw-r--r--kernel/kprobes.c31
-rw-r--r--kernel/lockdep_internals.h4
-rw-r--r--kernel/panic.c35
-rw-r--r--kernel/power/disk.c4
-rw-r--r--kernel/sched_clock.c3
-rw-r--r--kernel/sysctl.c23
-rw-r--r--kernel/trace/trace.c2
10 files changed, 65 insertions, 68 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 382109b5baeb..a7267bfd3765 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1133,8 +1133,7 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
1133 free_cg_links: 1133 free_cg_links:
1134 free_cg_links(&tmp_cg_links); 1134 free_cg_links(&tmp_cg_links);
1135 drop_new_super: 1135 drop_new_super:
1136 up_write(&sb->s_umount); 1136 deactivate_locked_super(sb);
1137 deactivate_super(sb);
1138 return ret; 1137 return ret;
1139} 1138}
1140 1139
diff --git a/kernel/futex.c b/kernel/futex.c
index eef8cd26b5e5..d546b2d53a62 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -193,6 +193,7 @@ static void drop_futex_key_refs(union futex_key *key)
193 * @uaddr: virtual address of the futex 193 * @uaddr: virtual address of the futex
194 * @fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED 194 * @fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED
195 * @key: address where result is stored. 195 * @key: address where result is stored.
196 * @rw: mapping needs to be read/write (values: VERIFY_READ, VERIFY_WRITE)
196 * 197 *
197 * Returns a negative error code or 0 198 * Returns a negative error code or 0
198 * The key words are stored in *key on success. 199 * The key words are stored in *key on success.
@@ -203,7 +204,8 @@ static void drop_futex_key_refs(union futex_key *key)
203 * 204 *
204 * lock_page() might sleep, the caller should not hold a spinlock. 205 * lock_page() might sleep, the caller should not hold a spinlock.
205 */ 206 */
206static int get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key) 207static int
208get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
207{ 209{
208 unsigned long address = (unsigned long)uaddr; 210 unsigned long address = (unsigned long)uaddr;
209 struct mm_struct *mm = current->mm; 211 struct mm_struct *mm = current->mm;
@@ -226,7 +228,7 @@ static int get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key)
226 * but access_ok() should be faster than find_vma() 228 * but access_ok() should be faster than find_vma()
227 */ 229 */
228 if (!fshared) { 230 if (!fshared) {
229 if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))) 231 if (unlikely(!access_ok(rw, uaddr, sizeof(u32))))
230 return -EFAULT; 232 return -EFAULT;
231 key->private.mm = mm; 233 key->private.mm = mm;
232 key->private.address = address; 234 key->private.address = address;
@@ -235,7 +237,7 @@ static int get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key)
235 } 237 }
236 238
237again: 239again:
238 err = get_user_pages_fast(address, 1, 0, &page); 240 err = get_user_pages_fast(address, 1, rw == VERIFY_WRITE, &page);
239 if (err < 0) 241 if (err < 0)
240 return err; 242 return err;
241 243
@@ -677,7 +679,7 @@ static int futex_wake(u32 __user *uaddr, int fshared, int nr_wake, u32 bitset)
677 if (!bitset) 679 if (!bitset)
678 return -EINVAL; 680 return -EINVAL;
679 681
680 ret = get_futex_key(uaddr, fshared, &key); 682 ret = get_futex_key(uaddr, fshared, &key, VERIFY_READ);
681 if (unlikely(ret != 0)) 683 if (unlikely(ret != 0))
682 goto out; 684 goto out;
683 685
@@ -723,10 +725,10 @@ futex_wake_op(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
723 int ret, op_ret; 725 int ret, op_ret;
724 726
725retry: 727retry:
726 ret = get_futex_key(uaddr1, fshared, &key1); 728 ret = get_futex_key(uaddr1, fshared, &key1, VERIFY_READ);
727 if (unlikely(ret != 0)) 729 if (unlikely(ret != 0))
728 goto out; 730 goto out;
729 ret = get_futex_key(uaddr2, fshared, &key2); 731 ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
730 if (unlikely(ret != 0)) 732 if (unlikely(ret != 0))
731 goto out_put_key1; 733 goto out_put_key1;
732 734
@@ -814,10 +816,10 @@ static int futex_requeue(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
814 int ret, drop_count = 0; 816 int ret, drop_count = 0;
815 817
816retry: 818retry:
817 ret = get_futex_key(uaddr1, fshared, &key1); 819 ret = get_futex_key(uaddr1, fshared, &key1, VERIFY_READ);
818 if (unlikely(ret != 0)) 820 if (unlikely(ret != 0))
819 goto out; 821 goto out;
820 ret = get_futex_key(uaddr2, fshared, &key2); 822 ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_READ);
821 if (unlikely(ret != 0)) 823 if (unlikely(ret != 0))
822 goto out_put_key1; 824 goto out_put_key1;
823 825
@@ -1140,7 +1142,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
1140 q.bitset = bitset; 1142 q.bitset = bitset;
1141retry: 1143retry:
1142 q.key = FUTEX_KEY_INIT; 1144 q.key = FUTEX_KEY_INIT;
1143 ret = get_futex_key(uaddr, fshared, &q.key); 1145 ret = get_futex_key(uaddr, fshared, &q.key, VERIFY_READ);
1144 if (unlikely(ret != 0)) 1146 if (unlikely(ret != 0))
1145 goto out; 1147 goto out;
1146 1148
@@ -1330,7 +1332,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
1330 q.pi_state = NULL; 1332 q.pi_state = NULL;
1331retry: 1333retry:
1332 q.key = FUTEX_KEY_INIT; 1334 q.key = FUTEX_KEY_INIT;
1333 ret = get_futex_key(uaddr, fshared, &q.key); 1335 ret = get_futex_key(uaddr, fshared, &q.key, VERIFY_WRITE);
1334 if (unlikely(ret != 0)) 1336 if (unlikely(ret != 0))
1335 goto out; 1337 goto out;
1336 1338
@@ -1594,7 +1596,7 @@ retry:
1594 if ((uval & FUTEX_TID_MASK) != task_pid_vnr(current)) 1596 if ((uval & FUTEX_TID_MASK) != task_pid_vnr(current))
1595 return -EPERM; 1597 return -EPERM;
1596 1598
1597 ret = get_futex_key(uaddr, fshared, &key); 1599 ret = get_futex_key(uaddr, fshared, &key, VERIFY_WRITE);
1598 if (unlikely(ret != 0)) 1600 if (unlikely(ret != 0))
1599 goto out; 1601 goto out;
1600 1602
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index e4dcfb2272a4..9147a3190c9d 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -1583,8 +1583,8 @@ static void sysrq_handle_gdb(int key, struct tty_struct *tty)
1583 1583
1584static struct sysrq_key_op sysrq_gdb_op = { 1584static struct sysrq_key_op sysrq_gdb_op = {
1585 .handler = sysrq_handle_gdb, 1585 .handler = sysrq_handle_gdb,
1586 .help_msg = "Gdb", 1586 .help_msg = "debug(G)",
1587 .action_msg = "GDB", 1587 .action_msg = "DEBUG",
1588}; 1588};
1589#endif 1589#endif
1590 1590
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index a5e74ddee0e2..c0fa54b276d9 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -319,6 +319,22 @@ struct kprobe __kprobes *get_kprobe(void *addr)
319 return NULL; 319 return NULL;
320} 320}
321 321
322/* Arm a kprobe with text_mutex */
323static void __kprobes arm_kprobe(struct kprobe *kp)
324{
325 mutex_lock(&text_mutex);
326 arch_arm_kprobe(kp);
327 mutex_unlock(&text_mutex);
328}
329
330/* Disarm a kprobe with text_mutex */
331static void __kprobes disarm_kprobe(struct kprobe *kp)
332{
333 mutex_lock(&text_mutex);
334 arch_disarm_kprobe(kp);
335 mutex_unlock(&text_mutex);
336}
337
322/* 338/*
323 * Aggregate handlers for multiple kprobes support - these handlers 339 * Aggregate handlers for multiple kprobes support - these handlers
324 * take care of invoking the individual kprobe handlers on p->list 340 * take care of invoking the individual kprobe handlers on p->list
@@ -538,7 +554,7 @@ static int __kprobes add_new_kprobe(struct kprobe *ap, struct kprobe *p)
538 ap->flags &= ~KPROBE_FLAG_DISABLED; 554 ap->flags &= ~KPROBE_FLAG_DISABLED;
539 if (!kprobes_all_disarmed) 555 if (!kprobes_all_disarmed)
540 /* Arm the breakpoint again. */ 556 /* Arm the breakpoint again. */
541 arch_arm_kprobe(ap); 557 arm_kprobe(ap);
542 } 558 }
543 return 0; 559 return 0;
544} 560}
@@ -789,11 +805,8 @@ static int __kprobes __unregister_kprobe_top(struct kprobe *p)
789 * enabled and not gone - otherwise, the breakpoint would 805 * enabled and not gone - otherwise, the breakpoint would
790 * already have been removed. We save on flushing icache. 806 * already have been removed. We save on flushing icache.
791 */ 807 */
792 if (!kprobes_all_disarmed && !kprobe_disabled(old_p)) { 808 if (!kprobes_all_disarmed && !kprobe_disabled(old_p))
793 mutex_lock(&text_mutex); 809 disarm_kprobe(p);
794 arch_disarm_kprobe(p);
795 mutex_unlock(&text_mutex);
796 }
797 hlist_del_rcu(&old_p->hlist); 810 hlist_del_rcu(&old_p->hlist);
798 } else { 811 } else {
799 if (p->break_handler && !kprobe_gone(p)) 812 if (p->break_handler && !kprobe_gone(p))
@@ -810,7 +823,7 @@ noclean:
810 if (!kprobe_disabled(old_p)) { 823 if (!kprobe_disabled(old_p)) {
811 try_to_disable_aggr_kprobe(old_p); 824 try_to_disable_aggr_kprobe(old_p);
812 if (!kprobes_all_disarmed && kprobe_disabled(old_p)) 825 if (!kprobes_all_disarmed && kprobe_disabled(old_p))
813 arch_disarm_kprobe(old_p); 826 disarm_kprobe(old_p);
814 } 827 }
815 } 828 }
816 return 0; 829 return 0;
@@ -1364,7 +1377,7 @@ int __kprobes disable_kprobe(struct kprobe *kp)
1364 try_to_disable_aggr_kprobe(p); 1377 try_to_disable_aggr_kprobe(p);
1365 1378
1366 if (!kprobes_all_disarmed && kprobe_disabled(p)) 1379 if (!kprobes_all_disarmed && kprobe_disabled(p))
1367 arch_disarm_kprobe(p); 1380 disarm_kprobe(p);
1368out: 1381out:
1369 mutex_unlock(&kprobe_mutex); 1382 mutex_unlock(&kprobe_mutex);
1370 return ret; 1383 return ret;
@@ -1393,7 +1406,7 @@ int __kprobes enable_kprobe(struct kprobe *kp)
1393 } 1406 }
1394 1407
1395 if (!kprobes_all_disarmed && kprobe_disabled(p)) 1408 if (!kprobes_all_disarmed && kprobe_disabled(p))
1396 arch_arm_kprobe(p); 1409 arm_kprobe(p);
1397 1410
1398 p->flags &= ~KPROBE_FLAG_DISABLED; 1411 p->flags &= ~KPROBE_FLAG_DISABLED;
1399 if (p != kp) 1412 if (p != kp)
diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h
index a2cc7e9a6e84..699a2ac3a0d7 100644
--- a/kernel/lockdep_internals.h
+++ b/kernel/lockdep_internals.h
@@ -54,9 +54,9 @@ enum {
54 * table (if it's not there yet), and we check it for lock order 54 * table (if it's not there yet), and we check it for lock order
55 * conflicts and deadlocks. 55 * conflicts and deadlocks.
56 */ 56 */
57#define MAX_LOCKDEP_ENTRIES 8192UL 57#define MAX_LOCKDEP_ENTRIES 16384UL
58 58
59#define MAX_LOCKDEP_CHAINS_BITS 14 59#define MAX_LOCKDEP_CHAINS_BITS 15
60#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS) 60#define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS)
61 61
62#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5) 62#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5)
diff --git a/kernel/panic.c b/kernel/panic.c
index 874ecf1307ae..984b3ecbd72c 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -340,39 +340,44 @@ void oops_exit(void)
340} 340}
341 341
342#ifdef WANT_WARN_ON_SLOWPATH 342#ifdef WANT_WARN_ON_SLOWPATH
343void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...) 343struct slowpath_args {
344{ 344 const char *fmt;
345 va_list args; 345 va_list args;
346 char function[KSYM_SYMBOL_LEN]; 346};
347 unsigned long caller = (unsigned long)__builtin_return_address(0);
348 const char *board;
349 347
350 sprint_symbol(function, caller); 348static void warn_slowpath_common(const char *file, int line, void *caller, struct slowpath_args *args)
349{
350 const char *board;
351 351
352 printk(KERN_WARNING "------------[ cut here ]------------\n"); 352 printk(KERN_WARNING "------------[ cut here ]------------\n");
353 printk(KERN_WARNING "WARNING: at %s:%d %s()\n", file, 353 printk(KERN_WARNING "WARNING: at %s:%d %pS()\n", file, line, caller);
354 line, function);
355 board = dmi_get_system_info(DMI_PRODUCT_NAME); 354 board = dmi_get_system_info(DMI_PRODUCT_NAME);
356 if (board) 355 if (board)
357 printk(KERN_WARNING "Hardware name: %s\n", board); 356 printk(KERN_WARNING "Hardware name: %s\n", board);
358 357
359 if (*fmt) { 358 if (args)
360 va_start(args, fmt); 359 vprintk(args->fmt, args->args);
361 vprintk(fmt, args);
362 va_end(args);
363 }
364 360
365 print_modules(); 361 print_modules();
366 dump_stack(); 362 dump_stack();
367 print_oops_end_marker(); 363 print_oops_end_marker();
368 add_taint(TAINT_WARN); 364 add_taint(TAINT_WARN);
369} 365}
366
367void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
368{
369 struct slowpath_args args;
370
371 args.fmt = fmt;
372 va_start(args.args, fmt);
373 warn_slowpath_common(file, line, __builtin_return_address(0), &args);
374 va_end(args.args);
375}
370EXPORT_SYMBOL(warn_slowpath_fmt); 376EXPORT_SYMBOL(warn_slowpath_fmt);
371 377
372void warn_slowpath_null(const char *file, int line) 378void warn_slowpath_null(const char *file, int line)
373{ 379{
374 static const char *empty = ""; 380 warn_slowpath_common(file, line, __builtin_return_address(0), NULL);
375 warn_slowpath_fmt(file, line, empty);
376} 381}
377EXPORT_SYMBOL(warn_slowpath_null); 382EXPORT_SYMBOL(warn_slowpath_null);
378#endif 383#endif
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index e71ca9cd81b2..b0dc9e7a0d17 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -241,9 +241,9 @@ static int create_image(int platform_mode)
241 241
242 local_irq_disable(); 242 local_irq_disable();
243 243
244 sysdev_suspend(PMSG_FREEZE); 244 error = sysdev_suspend(PMSG_FREEZE);
245 if (error) { 245 if (error) {
246 printk(KERN_ERR "PM: Some devices failed to power down, " 246 printk(KERN_ERR "PM: Some system devices failed to power down, "
247 "aborting hibernation\n"); 247 "aborting hibernation\n");
248 goto Enable_irqs; 248 goto Enable_irqs;
249 } 249 }
diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
index 819f17ac796e..e1d16c9a7680 100644
--- a/kernel/sched_clock.c
+++ b/kernel/sched_clock.c
@@ -38,7 +38,8 @@
38 */ 38 */
39unsigned long long __attribute__((weak)) sched_clock(void) 39unsigned long long __attribute__((weak)) sched_clock(void)
40{ 40{
41 return (unsigned long long)jiffies * (NSEC_PER_SEC / HZ); 41 return (unsigned long long)(jiffies - INITIAL_JIFFIES)
42 * (NSEC_PER_SEC / HZ);
42} 43}
43 44
44static __read_mostly int sched_clock_running; 45static __read_mostly int sched_clock_running;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 98ecf35d5bf2..149581fb48ab 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -101,7 +101,6 @@ static int __maybe_unused one = 1;
101static int __maybe_unused two = 2; 101static int __maybe_unused two = 2;
102static unsigned long one_ul = 1; 102static unsigned long one_ul = 1;
103static int one_hundred = 100; 103static int one_hundred = 100;
104static int one_thousand = 1000;
105 104
106/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */ 105/* this is needed for the proc_doulongvec_minmax of vm_dirty_bytes */
107static unsigned long dirty_bytes_min = 2 * PAGE_SIZE; 106static unsigned long dirty_bytes_min = 2 * PAGE_SIZE;
@@ -1046,28 +1045,6 @@ static struct ctl_table vm_table[] = {
1046 .proc_handler = &proc_dointvec, 1045 .proc_handler = &proc_dointvec,
1047 }, 1046 },
1048 { 1047 {
1049 .ctl_name = CTL_UNNUMBERED,
1050 .procname = "nr_pdflush_threads_min",
1051 .data = &nr_pdflush_threads_min,
1052 .maxlen = sizeof nr_pdflush_threads_min,
1053 .mode = 0644 /* read-write */,
1054 .proc_handler = &proc_dointvec_minmax,
1055 .strategy = &sysctl_intvec,
1056 .extra1 = &one,
1057 .extra2 = &nr_pdflush_threads_max,
1058 },
1059 {
1060 .ctl_name = CTL_UNNUMBERED,
1061 .procname = "nr_pdflush_threads_max",
1062 .data = &nr_pdflush_threads_max,
1063 .maxlen = sizeof nr_pdflush_threads_max,
1064 .mode = 0644 /* read-write */,
1065 .proc_handler = &proc_dointvec_minmax,
1066 .strategy = &sysctl_intvec,
1067 .extra1 = &nr_pdflush_threads_min,
1068 .extra2 = &one_thousand,
1069 },
1070 {
1071 .ctl_name = VM_SWAPPINESS, 1048 .ctl_name = VM_SWAPPINESS,
1072 .procname = "swappiness", 1049 .procname = "swappiness",
1073 .data = &vm_swappiness, 1050 .data = &vm_swappiness,
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a884c09006c4..cda81ec58d9f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2380,7 +2380,7 @@ static const char readme_msg[] =
2380 "# echo print-parent > /debug/tracing/trace_options\n" 2380 "# echo print-parent > /debug/tracing/trace_options\n"
2381 "# echo 1 > /debug/tracing/tracing_enabled\n" 2381 "# echo 1 > /debug/tracing/tracing_enabled\n"
2382 "# cat /debug/tracing/trace > /tmp/trace.txt\n" 2382 "# cat /debug/tracing/trace > /tmp/trace.txt\n"
2383 "echo 0 > /debug/tracing/tracing_enabled\n" 2383 "# echo 0 > /debug/tracing/tracing_enabled\n"
2384; 2384;
2385 2385
2386static ssize_t 2386static ssize_t