Merge second patch-bomb from Andrew Morton: - various misc bits - the rest of MM - add generic fixmap.h, use it - backlight updates - dynamic_debug updates - printk() updates - checkpatch updates - binfmt_elf - ramfs - init/ - autofs4 - drivers/rtc - nilfs - hfsplus - Documentation/ - coredump - procfs - fork - exec - kexec - kdump - partitions - rapidio - rbtree - userns - memstick - w1 - decompressors * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (197 commits) lib/decompress_unlz4.c: always set an error return code on failures romfs: fix returm err while getting inode in fill_super drivers/w1/masters/w1-gpio.c: add strong pullup emulation drivers/memstick/host/rtsx_pci_ms.c: fix ms card data transfer bug userns: relax the posix_acl_valid() checks arch/sh/kernel/dwarf.c: use rbtree postorder iteration helper instead of solution using repeated rb_erase() fs-ext3-use-rbtree-postorder-iteration-helper-instead-of-opencoding-fix fs/ext3: use rbtree postorder iteration helper instead of opencoding fs/jffs2: use rbtree postorder iteration helper instead of opencoding fs/ext4: use rbtree postorder iteration helper instead of opencoding fs/ubifs: use rbtree postorder iteration helper instead of opencoding net/netfilter/ipset/ip_set_hash_netiface.c: use rbtree postorder iteration instead of opencoding rbtree/test: test rbtree_postorder_for_each_entry_safe() rbtree/test: move rb_node to the middle of the test struct rapidio: add modular rapidio core build into powerpc and mips branches partitions/efi: complete documentation of gpt kernel param purpose kdump: add /sys/kernel/vmcoreinfo ABI documentation kdump: fix exported size of vmcoreinfo note kexec: add sysctl to disable kexec_load fs/exec.c: call arch_pick_mmap_layout() only once ...
Showing the changes to kernel (8 of 231 files). Show all
Unified · Split
| @@ -800,14 +800,11 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) · 799 unmodified lines | ||
| 800 | 800 | * Allocate a new mm structure and copy contents from the |
| 801 | 801 | * mm structure of the passed in task structure. |
| 802 | 802 | */ |
| 803 | −struct mm_struct *dup_mm(struct task_struct *tsk) | |
| 803 | +static struct mm_struct *dup_mm(struct task_struct *tsk) | |
| 804 | 804 | { |
| 805 | 805 | struct mm_struct *mm, *oldmm = current->mm; |
| 806 | 806 | int err; |
| 807 | 807 | |
| 808 | − if (!oldmm) | |
| 809 | − return NULL; | |
| 810 | − | |
| 811 | 808 | mm = allocate_mm(); |
| 812 | 809 | if (!mm) |
| 813 | 810 | goto fail_nomem; |
| @@ -1229,7 +1226,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, · 415 unmodified lines | ||
| 1229 | 1226 | if (!try_module_get(task_thread_info(p)->exec_domain->module)) |
| 1230 | 1227 | goto bad_fork_cleanup_count; |
| 1231 | 1228 | |
| 1232 | − p->did_exec = 0; | |
| 1233 | 1229 | delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ |
| 1234 | 1230 | copy_flags(clone_flags, p); |
| 1235 | 1231 | INIT_LIST_HEAD(&p->children); |
| @@ -1654,7 +1650,7 @@ SYSCALL_DEFINE0(fork) · 418 unmodified lines | ||
| 1654 | 1650 | return do_fork(SIGCHLD, 0, 0, NULL, NULL); |
| 1655 | 1651 | #else |
| 1656 | 1652 | /* can not support in nommu mode */ |
| 1657 | − return(-EINVAL); | |
| 1653 | + return -EINVAL; | |
| 1658 | 1654 | #endif |
| 1659 | 1655 | } |
| 1660 | 1656 | #endif |
| @@ -1662,7 +1658,7 @@ SYSCALL_DEFINE0(fork) · 1 unmodified line | ||
| 1662 | 1658 | #ifdef __ARCH_WANT_SYS_VFORK |
| 1663 | 1659 | SYSCALL_DEFINE0(vfork) |
| 1664 | 1660 | { |
| 1665 | − return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, | |
| 1661 | + return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, | |
| 1666 | 1662 | 0, NULL, NULL); |
| 1667 | 1663 | } |
| 1668 | 1664 | #endif |
| @@ -932,6 +932,7 @@ static int kimage_load_segment(struct kimage *image, · 931 unmodified lines | ||
| 932 | 932 | */ |
| 933 | 933 | struct kimage *kexec_image; |
| 934 | 934 | struct kimage *kexec_crash_image; |
| 935 | +int kexec_load_disabled; | |
| 935 | 936 | |
| 936 | 937 | static DEFINE_MUTEX(kexec_mutex); |
| 937 | 938 | |
| @@ -942,7 +943,7 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, · 4 unmodified lines | ||
| 942 | 943 | int result; |
| 943 | 944 | |
| 944 | 945 | /* We only trust the superuser with rebooting the system. */ |
| 945 | − if (!capable(CAP_SYS_BOOT)) | |
| 946 | + if (!capable(CAP_SYS_BOOT) || kexec_load_disabled) | |
| 946 | 947 | return -EPERM; |
| 947 | 948 | |
| 948 | 949 | /* |
| @@ -126,7 +126,7 @@ static ssize_t vmcoreinfo_show(struct kobject *kobj, · 125 unmodified lines | ||
| 126 | 126 | { |
| 127 | 127 | return sprintf(buf, "%lx %x\n", |
| 128 | 128 | paddr_vmcoreinfo_note(), |
| 129 | − (unsigned int)vmcoreinfo_max_size); | |
| 129 | + (unsigned int)sizeof(vmcoreinfo_note)); | |
| 130 | 130 | } |
| 131 | 131 | KERNEL_ATTR_RO(vmcoreinfo); |
| 132 | 132 | |
| @@ -1595,10 +1595,13 @@ asmlinkage int vprintk_emit(int facility, int level, · 1594 unmodified lines | ||
| 1595 | 1595 | * either merge it with the current buffer and flush, or if |
| 1596 | 1596 | * there was a race with interrupts (prefix == true) then just |
| 1597 | 1597 | * flush it out and store this line separately. |
| 1598 | + * If the preceding printk was from a different task and missed | |
| 1599 | + * a newline, flush and append the newline. | |
| 1598 | 1600 | */ |
| 1599 | − if (cont.len && cont.owner == current) { | |
| 1600 | − if (!(lflags & LOG_PREFIX)) | |
| 1601 | − stored = cont_add(facility, level, text, text_len); | |
| 1601 | + if (cont.len) { | |
| 1602 | + if (cont.owner == current && !(lflags & LOG_PREFIX)) | |
| 1603 | + stored = cont_add(facility, level, text, | |
| 1604 | + text_len); | |
| 1602 | 1605 | cont_flush(LOG_NEWLINE); |
| 1603 | 1606 | } |
| 1604 | 1607 | |
| @@ -1770,7 +1770,29 @@ void set_numabalancing_state(bool enabled) · 1769 unmodified lines | ||
| 1770 | 1770 | numabalancing_enabled = enabled; |
| 1771 | 1771 | } |
| 1772 | 1772 | #endif /* CONFIG_SCHED_DEBUG */ |
| 1773 | −#endif /* CONFIG_NUMA_BALANCING */ | |
| 1773 | + | |
| 1774 | +#ifdef CONFIG_PROC_SYSCTL | |
| 1775 | +int sysctl_numa_balancing(struct ctl_table *table, int write, | |
| 1776 | + void __user *buffer, size_t *lenp, loff_t *ppos) | |
| 1777 | +{ | |
| 1778 | + struct ctl_table t; | |
| 1779 | + int err; | |
| 1780 | + int state = numabalancing_enabled; | |
| 1781 | + | |
| 1782 | + if (write && !capable(CAP_SYS_ADMIN)) | |
| 1783 | + return -EPERM; | |
| 1784 | + | |
| 1785 | + t = *table; | |
| 1786 | + t.data = &state; | |
| 1787 | + err = proc_dointvec_minmax(&t, write, buffer, lenp, ppos); | |
| 1788 | + if (err < 0) | |
| 1789 | + return err; | |
| 1790 | + if (write) | |
| 1791 | + set_numabalancing_state(state); | |
| 1792 | + return err; | |
| 1793 | +} | |
| 1794 | +#endif | |
| 1795 | +#endif | |
| 1774 | 1796 | |
| 1775 | 1797 | /* |
| 1776 | 1798 | * fork()/clone()-time setup: |
| @@ -2047,8 +2047,8 @@ static bool do_signal_stop(int signr) · 2046 unmodified lines | ||
| 2047 | 2047 | if (task_set_jobctl_pending(current, signr | gstop)) |
| 2048 | 2048 | sig->group_stop_count++; |
| 2049 | 2049 | |
| 2050 | − for (t = next_thread(current); t != current; | |
| 2051 | − t = next_thread(t)) { | |
| 2050 | + t = current; | |
| 2051 | + while_each_thread(current, t) { | |
| 2052 | 2052 | /* |
| 2053 | 2053 | * Setting state to TASK_STOPPED for a group |
| 2054 | 2054 | * stop is always done with the siglock held, |
| @@ -3125,8 +3125,7 @@ int do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact) · 1070 unmodified lines | ||
| 3125 | 3125 | rm_from_queue_full(&mask, &t->signal->shared_pending); |
| 3126 | 3126 | do { |
| 3127 | 3127 | rm_from_queue_full(&mask, &t->pending); |
| 3128 | − t = next_thread(t); | |
| 3129 | − } while (t != current); | |
| 3128 | + } while_each_thread(current, t); | |
| 3130 | 3129 | } |
| 3131 | 3130 | } |
| 3132 | 3131 | |
| @@ -895,8 +895,7 @@ SYSCALL_DEFINE1(times, struct tms __user *, tbuf) · 894 unmodified lines | ||
| 895 | 895 | * only important on a multi-user system anyway, to make sure one user |
| 896 | 896 | * can't send a signal to a process owned by another. -TYT, 12/12/91 |
| 897 | 897 | * |
| 898 | − * Auch. Had to add the 'did_exec' flag to conform completely to POSIX. | |
| 899 | − * LBT 04.03.94 | |
| 898 | + * !PF_FORKNOEXEC check to conform completely to POSIX. | |
| 900 | 899 | */ |
| 901 | 900 | SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) |
| 902 | 901 | { |
| @@ -932,7 +931,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) · 29 unmodified lines | ||
| 932 | 931 | if (task_session(p) != task_session(group_leader)) |
| 933 | 932 | goto out; |
| 934 | 933 | err = -EACCES; |
| 935 | − if (p->did_exec) | |
| 934 | + if (!(p->flags & PF_FORKNOEXEC)) | |
| 936 | 935 | goto out; |
| 937 | 936 | } else { |
| 938 | 937 | err = -ESRCH; |
| @@ -1572,8 +1571,7 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r) · 633 unmodified lines | ||
| 1572 | 1571 | t = p; |
| 1573 | 1572 | do { |
| 1574 | 1573 | accumulate_thread_rusage(t, r); |
| 1575 | − t = next_thread(t); | |
| 1576 | − } while (t != p); | |
| 1574 | + } while_each_thread(p, t); | |
| 1577 | 1575 | break; |
| 1578 | 1576 | |
| 1579 | 1577 | default: |
| @@ -62,6 +62,7 @@ · 61 unmodified lines | ||
| 62 | 62 | #include <linux/capability.h> |
| 63 | 63 | #include <linux/binfmts.h> |
| 64 | 64 | #include <linux/sched/sysctl.h> |
| 65 | +#include <linux/kexec.h> | |
| 65 | 66 | |
| 66 | 67 | #include <asm/uaccess.h> |
| 67 | 68 | #include <asm/processor.h> |
| @@ -389,6 +390,15 @@ static struct ctl_table kern_table[] = { · 321 unmodified lines | ||
| 389 | 390 | .mode = 0644, |
| 390 | 391 | .proc_handler = proc_dointvec, |
| 391 | 392 | }, |
| 393 | + { | |
| 394 | + .procname = "numa_balancing", | |
| 395 | + .data = NULL, /* filled in by handler */ | |
| 396 | + .maxlen = sizeof(unsigned int), | |
| 397 | + .mode = 0644, | |
| 398 | + .proc_handler = sysctl_numa_balancing, | |
| 399 | + .extra1 = &zero, | |
| 400 | + .extra2 = &one, | |
| 401 | + }, | |
| 392 | 402 | #endif /* CONFIG_NUMA_BALANCING */ |
| 393 | 403 | #endif /* CONFIG_SCHED_DEBUG */ |
| 394 | 404 | { |
| @@ -605,6 +615,18 @@ static struct ctl_table kern_table[] = { · 210 unmodified lines | ||
| 605 | 615 | .proc_handler = proc_dointvec, |
| 606 | 616 | }, |
| 607 | 617 | #endif |
| 618 | +#ifdef CONFIG_KEXEC | |
| 619 | + { | |
| 620 | + .procname = "kexec_load_disabled", | |
| 621 | + .data = &kexec_load_disabled, | |
| 622 | + .maxlen = sizeof(int), | |
| 623 | + .mode = 0644, | |
| 624 | + /* only handle a transition from default "0" to "1" */ | |
| 625 | + .proc_handler = proc_dointvec_minmax, | |
| 626 | + .extra1 = &one, | |
| 627 | + .extra2 = &one, | |
| 628 | + }, | |
| 629 | +#endif | |
| 608 | 630 | #ifdef CONFIG_MODULES |
| 609 | 631 | { |
| 610 | 632 | .procname = "modprobe", |