History

Merge branch 'akpm' (incoming from Andrew)

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 ...

Linus Torvalds committed 12 years ago

Commit 3aacd622 parents 7e21774 2a1d689231 files · +3339 −2187Browse files

Showing the changes to kernel (8 of 231 files). Show all

Unified · Split

8 files
  1. kernel/fork.c +3 −7
  2. kernel/kexec.c +2 −1
  3. kernel/ksysfs.c +1 −1
  4. kernel/printk/printk.c +6 −3
  5. kernel/sched/core.c +23 −1
  6. kernel/signal.c +3 −4
  7. kernel/sys.c +3 −5
  8. kernel/sysctl.c +22 −0
kernel/fork.c+3−7
@@ -800,14 +800,11 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) · 799 unmodified lines
800800 * Allocate a new mm structure and copy contents from the
801801 * mm structure of the passed in task structure.
802802 */
803−struct mm_struct *dup_mm(struct task_struct *tsk)
803+static struct mm_struct *dup_mm(struct task_struct *tsk)
804804 {
805805 struct mm_struct *mm, *oldmm = current->mm;
806806 int err;
807807
808− if (!oldmm)
809− return NULL;
810−
811808 mm = allocate_mm();
812809 if (!mm)
813810 goto fail_nomem;
@@ -1229,7 +1226,6 @@ static struct task_struct *copy_process(unsigned long clone_flags, · 415 unmodified lines
12291226 if (!try_module_get(task_thread_info(p)->exec_domain->module))
12301227 goto bad_fork_cleanup_count;
12311228
1232− p->did_exec = 0;
12331229 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */
12341230 copy_flags(clone_flags, p);
12351231 INIT_LIST_HEAD(&p->children);
@@ -1654,7 +1650,7 @@ SYSCALL_DEFINE0(fork) · 418 unmodified lines
16541650 return do_fork(SIGCHLD, 0, 0, NULL, NULL);
16551651 #else
16561652 /* can not support in nommu mode */
1657− return(-EINVAL);
1653+ return -EINVAL;
16581654 #endif
16591655 }
16601656 #endif
@@ -1662,7 +1658,7 @@ SYSCALL_DEFINE0(fork) · 1 unmodified line
16621658 #ifdef __ARCH_WANT_SYS_VFORK
16631659 SYSCALL_DEFINE0(vfork)
16641660 {
1665− return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0,
1661+ return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0,
16661662 0, NULL, NULL);
16671663 }
16681664 #endif
kernel/kexec.c+2−1
@@ -932,6 +932,7 @@ static int kimage_load_segment(struct kimage *image, · 931 unmodified lines
932932 */
933933 struct kimage *kexec_image;
934934 struct kimage *kexec_crash_image;
935+int kexec_load_disabled;
935936
936937 static DEFINE_MUTEX(kexec_mutex);
937938
@@ -942,7 +943,7 @@ SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments, · 4 unmodified lines
942943 int result;
943944
944945 /* We only trust the superuser with rebooting the system. */
945− if (!capable(CAP_SYS_BOOT))
946+ if (!capable(CAP_SYS_BOOT) || kexec_load_disabled)
946947 return -EPERM;
947948
948949 /*
kernel/ksysfs.c+1−1
@@ -126,7 +126,7 @@ static ssize_t vmcoreinfo_show(struct kobject *kobj, · 125 unmodified lines
126126 {
127127 return sprintf(buf, "%lx %x\n",
128128 paddr_vmcoreinfo_note(),
129− (unsigned int)vmcoreinfo_max_size);
129+ (unsigned int)sizeof(vmcoreinfo_note));
130130 }
131131 KERNEL_ATTR_RO(vmcoreinfo);
132132
kernel/printk/printk.c+6−3
@@ -1595,10 +1595,13 @@ asmlinkage int vprintk_emit(int facility, int level, · 1594 unmodified lines
15951595 * either merge it with the current buffer and flush, or if
15961596 * there was a race with interrupts (prefix == true) then just
15971597 * 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.
15981600 */
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);
16021605 cont_flush(LOG_NEWLINE);
16031606 }
16041607
kernel/sched/core.c+23−1
@@ -1770,7 +1770,29 @@ void set_numabalancing_state(bool enabled) · 1769 unmodified lines
17701770 numabalancing_enabled = enabled;
17711771 }
17721772 #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
17741796
17751797 /*
17761798 * fork()/clone()-time setup:
kernel/signal.c+3−4
@@ -2047,8 +2047,8 @@ static bool do_signal_stop(int signr) · 2046 unmodified lines
20472047 if (task_set_jobctl_pending(current, signr | gstop))
20482048 sig->group_stop_count++;
20492049
2050− for (t = next_thread(current); t != current;
2051− t = next_thread(t)) {
2050+ t = current;
2051+ while_each_thread(current, t) {
20522052 /*
20532053 * Setting state to TASK_STOPPED for a group
20542054 * 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
31253125 rm_from_queue_full(&mask, &t->signal->shared_pending);
31263126 do {
31273127 rm_from_queue_full(&mask, &t->pending);
3128− t = next_thread(t);
3129− } while (t != current);
3128+ } while_each_thread(current, t);
31303129 }
31313130 }
31323131
kernel/sys.c+3−5
@@ -895,8 +895,7 @@ SYSCALL_DEFINE1(times, struct tms __user *, tbuf) · 894 unmodified lines
895895 * only important on a multi-user system anyway, to make sure one user
896896 * can't send a signal to a process owned by another. -TYT, 12/12/91
897897 *
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.
900899 */
901900 SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
902901 {
@@ -932,7 +931,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid) · 29 unmodified lines
932931 if (task_session(p) != task_session(group_leader))
933932 goto out;
934933 err = -EACCES;
935− if (p->did_exec)
934+ if (!(p->flags & PF_FORKNOEXEC))
936935 goto out;
937936 } else {
938937 err = -ESRCH;
@@ -1572,8 +1571,7 @@ static void k_getrusage(struct task_struct *p, int who, struct rusage *r) · 633 unmodified lines
15721571 t = p;
15731572 do {
15741573 accumulate_thread_rusage(t, r);
1575− t = next_thread(t);
1576− } while (t != p);
1574+ } while_each_thread(p, t);
15771575 break;
15781576
15791577 default:
kernel/sysctl.c+22−0
@@ -62,6 +62,7 @@ · 61 unmodified lines
6262 #include <linux/capability.h>
6363 #include <linux/binfmts.h>
6464 #include <linux/sched/sysctl.h>
65+#include <linux/kexec.h>
6566
6667 #include <asm/uaccess.h>
6768 #include <asm/processor.h>
@@ -389,6 +390,15 @@ static struct ctl_table kern_table[] = { · 321 unmodified lines
389390 .mode = 0644,
390391 .proc_handler = proc_dointvec,
391392 },
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+ },
392402 #endif /* CONFIG_NUMA_BALANCING */
393403 #endif /* CONFIG_SCHED_DEBUG */
394404 {
@@ -605,6 +615,18 @@ static struct ctl_table kern_table[] = { · 210 unmodified lines
605615 .proc_handler = proc_dointvec,
606616 },
607617 #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
608630 #ifdef CONFIG_MODULES
609631 {
610632 .procname = "modprobe",