diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-06-12 19:29:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-06-12 19:29:53 -0400 |
| commit | a568fa1c91d4f0e565345119d0b942cc7f74ca3d (patch) | |
| tree | 8d57522244da002e44b2f79cc2b376799630ba83 /kernel | |
| parent | 1a9c3d68d65f4b5ce32f7d67ccc730396e04cdd2 (diff) | |
| parent | c2853c8df57f49620d26f317d7d43347c29bfc2e (diff) | |
Merge branch 'akpm' (updates from Andrew Morton)
Merge misc fixes from Andrew Morton:
"Bunch of fixes and one little addition to math64.h"
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (27 commits)
include/linux/math64.h: add div64_ul()
mm: memcontrol: fix lockless reclaim hierarchy iterator
frontswap: fix incorrect zeroing and allocation size for frontswap_map
kernel/audit_tree.c:audit_add_tree_rule(): protect `rule' from kill_rules()
mm: migration: add migrate_entry_wait_huge()
ocfs2: add missing lockres put in dlm_mig_lockres_handler
mm/page_alloc.c: fix watermark check in __zone_watermark_ok()
drivers/misc/sgi-gru/grufile.c: fix info leak in gru_get_config_info()
aio: fix io_destroy() regression by using call_rcu()
rtc-at91rm9200: use shadow IMR on at91sam9x5
rtc-at91rm9200: add shadow interrupt mask
rtc-at91rm9200: refactor interrupt-register handling
rtc-at91rm9200: add configuration support
rtc-at91rm9200: add match-table compile guard
fs/ocfs2/namei.c: remove unecessary ERROR when removing non-empty directory
swap: avoid read_swap_cache_async() race to deadlock while waiting on discard I/O completion
drivers/rtc/rtc-twl.c: fix missing device_init_wakeup() when booted with device tree
cciss: fix broken mutex usage in ioctl
audit: wait_for_auditd() should use TASK_UNINTERRUPTIBLE
drivers/rtc/rtc-cmos.c: fix accidentally enabling rtc channel
...
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/audit.c | 2 | ||||
| -rw-r--r-- | kernel/audit_tree.c | 1 | ||||
| -rw-r--r-- | kernel/cpu.c | 55 | ||||
| -rw-r--r-- | kernel/printk.c | 91 | ||||
| -rw-r--r-- | kernel/sys.c | 29 |
5 files changed, 101 insertions, 77 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 21c7fa615bd3..91e53d04b6a9 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
| @@ -1056,7 +1056,7 @@ static inline void audit_get_stamp(struct audit_context *ctx, | |||
| 1056 | static void wait_for_auditd(unsigned long sleep_time) | 1056 | static void wait_for_auditd(unsigned long sleep_time) |
| 1057 | { | 1057 | { |
| 1058 | DECLARE_WAITQUEUE(wait, current); | 1058 | DECLARE_WAITQUEUE(wait, current); |
| 1059 | set_current_state(TASK_INTERRUPTIBLE); | 1059 | set_current_state(TASK_UNINTERRUPTIBLE); |
| 1060 | add_wait_queue(&audit_backlog_wait, &wait); | 1060 | add_wait_queue(&audit_backlog_wait, &wait); |
| 1061 | 1061 | ||
| 1062 | if (audit_backlog_limit && | 1062 | if (audit_backlog_limit && |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index a291aa23fb3f..43c307dc9453 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
| @@ -658,6 +658,7 @@ int audit_add_tree_rule(struct audit_krule *rule) | |||
| 658 | struct vfsmount *mnt; | 658 | struct vfsmount *mnt; |
| 659 | int err; | 659 | int err; |
| 660 | 660 | ||
| 661 | rule->tree = NULL; | ||
| 661 | list_for_each_entry(tree, &tree_list, list) { | 662 | list_for_each_entry(tree, &tree_list, list) { |
| 662 | if (!strcmp(seed->pathname, tree->pathname)) { | 663 | if (!strcmp(seed->pathname, tree->pathname)) { |
| 663 | put_tree(seed); | 664 | put_tree(seed); |
diff --git a/kernel/cpu.c b/kernel/cpu.c index b5e4ab2d427e..198a38883e64 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -133,6 +133,27 @@ static void cpu_hotplug_done(void) | |||
| 133 | mutex_unlock(&cpu_hotplug.lock); | 133 | mutex_unlock(&cpu_hotplug.lock); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | /* | ||
| 137 | * Wait for currently running CPU hotplug operations to complete (if any) and | ||
| 138 | * disable future CPU hotplug (from sysfs). The 'cpu_add_remove_lock' protects | ||
| 139 | * the 'cpu_hotplug_disabled' flag. The same lock is also acquired by the | ||
| 140 | * hotplug path before performing hotplug operations. So acquiring that lock | ||
| 141 | * guarantees mutual exclusion from any currently running hotplug operations. | ||
| 142 | */ | ||
| 143 | void cpu_hotplug_disable(void) | ||
| 144 | { | ||
| 145 | cpu_maps_update_begin(); | ||
| 146 | cpu_hotplug_disabled = 1; | ||
| 147 | cpu_maps_update_done(); | ||
| 148 | } | ||
| 149 | |||
| 150 | void cpu_hotplug_enable(void) | ||
| 151 | { | ||
| 152 | cpu_maps_update_begin(); | ||
| 153 | cpu_hotplug_disabled = 0; | ||
| 154 | cpu_maps_update_done(); | ||
| 155 | } | ||
| 156 | |||
| 136 | #else /* #if CONFIG_HOTPLUG_CPU */ | 157 | #else /* #if CONFIG_HOTPLUG_CPU */ |
| 137 | static void cpu_hotplug_begin(void) {} | 158 | static void cpu_hotplug_begin(void) {} |
| 138 | static void cpu_hotplug_done(void) {} | 159 | static void cpu_hotplug_done(void) {} |
| @@ -541,36 +562,6 @@ static int __init alloc_frozen_cpus(void) | |||
| 541 | core_initcall(alloc_frozen_cpus); | 562 | core_initcall(alloc_frozen_cpus); |
| 542 | 563 | ||
| 543 | /* | 564 | /* |
| 544 | * Prevent regular CPU hotplug from racing with the freezer, by disabling CPU | ||
| 545 | * hotplug when tasks are about to be frozen. Also, don't allow the freezer | ||
| 546 | * to continue until any currently running CPU hotplug operation gets | ||
| 547 | * completed. | ||
| 548 | * To modify the 'cpu_hotplug_disabled' flag, we need to acquire the | ||
| 549 | * 'cpu_add_remove_lock'. And this same lock is also taken by the regular | ||
| 550 | * CPU hotplug path and released only after it is complete. Thus, we | ||
| 551 | * (and hence the freezer) will block here until any currently running CPU | ||
| 552 | * hotplug operation gets completed. | ||
| 553 | */ | ||
| 554 | void cpu_hotplug_disable_before_freeze(void) | ||
| 555 | { | ||
| 556 | cpu_maps_update_begin(); | ||
| 557 | cpu_hotplug_disabled = 1; | ||
| 558 | cpu_maps_update_done(); | ||
| 559 | } | ||
| 560 | |||
| 561 | |||
| 562 | /* | ||
| 563 | * When tasks have been thawed, re-enable regular CPU hotplug (which had been | ||
| 564 | * disabled while beginning to freeze tasks). | ||
| 565 | */ | ||
| 566 | void cpu_hotplug_enable_after_thaw(void) | ||
| 567 | { | ||
| 568 | cpu_maps_update_begin(); | ||
| 569 | cpu_hotplug_disabled = 0; | ||
| 570 | cpu_maps_update_done(); | ||
| 571 | } | ||
| 572 | |||
| 573 | /* | ||
| 574 | * When callbacks for CPU hotplug notifications are being executed, we must | 565 | * When callbacks for CPU hotplug notifications are being executed, we must |
| 575 | * ensure that the state of the system with respect to the tasks being frozen | 566 | * ensure that the state of the system with respect to the tasks being frozen |
| 576 | * or not, as reported by the notification, remains unchanged *throughout the | 567 | * or not, as reported by the notification, remains unchanged *throughout the |
| @@ -589,12 +580,12 @@ cpu_hotplug_pm_callback(struct notifier_block *nb, | |||
| 589 | 580 | ||
| 590 | case PM_SUSPEND_PREPARE: | 581 | case PM_SUSPEND_PREPARE: |
| 591 | case PM_HIBERNATION_PREPARE: | 582 | case PM_HIBERNATION_PREPARE: |
| 592 | cpu_hotplug_disable_before_freeze(); | 583 | cpu_hotplug_disable(); |
| 593 | break; | 584 | break; |
| 594 | 585 | ||
| 595 | case PM_POST_SUSPEND: | 586 | case PM_POST_SUSPEND: |
| 596 | case PM_POST_HIBERNATION: | 587 | case PM_POST_HIBERNATION: |
| 597 | cpu_hotplug_enable_after_thaw(); | 588 | cpu_hotplug_enable(); |
| 598 | break; | 589 | break; |
| 599 | 590 | ||
| 600 | default: | 591 | default: |
diff --git a/kernel/printk.c b/kernel/printk.c index fa36e1494420..8212c1aef125 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
| @@ -363,6 +363,53 @@ static void log_store(int facility, int level, | |||
| 363 | log_next_seq++; | 363 | log_next_seq++; |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | #ifdef CONFIG_SECURITY_DMESG_RESTRICT | ||
| 367 | int dmesg_restrict = 1; | ||
| 368 | #else | ||
| 369 | int dmesg_restrict; | ||
| 370 | #endif | ||
| 371 | |||
| 372 | static int syslog_action_restricted(int type) | ||
| 373 | { | ||
| 374 | if (dmesg_restrict) | ||
| 375 | return 1; | ||
| 376 | /* | ||
| 377 | * Unless restricted, we allow "read all" and "get buffer size" | ||
| 378 | * for everybody. | ||
| 379 | */ | ||
| 380 | return type != SYSLOG_ACTION_READ_ALL && | ||
| 381 | type != SYSLOG_ACTION_SIZE_BUFFER; | ||
| 382 | } | ||
| 383 | |||
| 384 | static int check_syslog_permissions(int type, bool from_file) | ||
| 385 | { | ||
| 386 | /* | ||
| 387 | * If this is from /proc/kmsg and we've already opened it, then we've | ||
| 388 | * already done the capabilities checks at open time. | ||
| 389 | */ | ||
| 390 | if (from_file && type != SYSLOG_ACTION_OPEN) | ||
| 391 | return 0; | ||
| 392 | |||
| 393 | if (syslog_action_restricted(type)) { | ||
| 394 | if (capable(CAP_SYSLOG)) | ||
| 395 | return 0; | ||
| 396 | /* | ||
| 397 | * For historical reasons, accept CAP_SYS_ADMIN too, with | ||
| 398 | * a warning. | ||
| 399 | */ | ||
| 400 | if (capable(CAP_SYS_ADMIN)) { | ||
| 401 | pr_warn_once("%s (%d): Attempt to access syslog with " | ||
| 402 | "CAP_SYS_ADMIN but no CAP_SYSLOG " | ||
| 403 | "(deprecated).\n", | ||
| 404 | current->comm, task_pid_nr(current)); | ||
| 405 | return 0; | ||
| 406 | } | ||
| 407 | return -EPERM; | ||
| 408 | } | ||
| 409 | return security_syslog(type); | ||
| 410 | } | ||
| 411 | |||
| 412 | |||
| 366 | /* /dev/kmsg - userspace message inject/listen interface */ | 413 | /* /dev/kmsg - userspace message inject/listen interface */ |
| 367 | struct devkmsg_user { | 414 | struct devkmsg_user { |
| 368 | u64 seq; | 415 | u64 seq; |
| @@ -620,7 +667,8 @@ static int devkmsg_open(struct inode *inode, struct file *file) | |||
| 620 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) | 667 | if ((file->f_flags & O_ACCMODE) == O_WRONLY) |
| 621 | return 0; | 668 | return 0; |
| 622 | 669 | ||
| 623 | err = security_syslog(SYSLOG_ACTION_READ_ALL); | 670 | err = check_syslog_permissions(SYSLOG_ACTION_READ_ALL, |
| 671 | SYSLOG_FROM_READER); | ||
| 624 | if (err) | 672 | if (err) |
| 625 | return err; | 673 | return err; |
| 626 | 674 | ||
| @@ -813,45 +861,6 @@ static inline void boot_delay_msec(int level) | |||
| 813 | } | 861 | } |
| 814 | #endif | 862 | #endif |
| 815 | 863 | ||
| 816 | #ifdef CONFIG_SECURITY_DMESG_RESTRICT | ||
| 817 | int dmesg_restrict = 1; | ||
| 818 | #else | ||
