diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-26 12:52:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-06-26 12:52:05 -0400 |
commit | 47a469421d792dcb91a1e73319d26134241953d2 (patch) | |
tree | 6a388381a434ebe87fed2fbb10a53ced7a7ce8b5 /kernel/fork.c | |
parent | c13c81006314ad76c2b31824960a900385601b8b (diff) | |
parent | 51229b495340bd7a02ce3622d1966829b67054ea (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge second patchbomb from Andrew Morton:
- most of the rest of MM
- lots of misc things
- procfs updates
- printk feature work
- updates to get_maintainer, MAINTAINERS, checkpatch
- lib/ updates
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (96 commits)
exit,stats: /* obey this comment */
coredump: add __printf attribute to cn_*printf functions
coredump: use from_kuid/kgid when formatting corename
fs/reiserfs: remove unneeded cast
NILFS2: support NFSv2 export
fs/befs/btree.c: remove unneeded initializations
fs/minix: remove unneeded cast
init/do_mounts.c: add create_dev() failure log
kasan: remove duplicate definition of the macro KASAN_FREE_PAGE
fs/efs: femove unneeded cast
checkpatch: emit "NOTE: <types>" message only once after multiple files
checkpatch: emit an error when there's a diff in a changelog
checkpatch: validate MODULE_LICENSE content
checkpatch: add multi-line handling for PREFER_ETHER_ADDR_COPY
checkpatch: suggest using eth_zero_addr() and eth_broadcast_addr()
checkpatch: fix processing of MEMSET issues
checkpatch: suggest using ether_addr_equal*()
checkpatch: avoid NOT_UNIFIED_DIFF errors on cover-letter.patch files
checkpatch: remove local from codespell path
checkpatch: add --showfile to allow input via pipe to show filenames
...
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 0bb88b555550..4c95cb34243c 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1238,7 +1238,8 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1238 | unsigned long stack_size, | 1238 | unsigned long stack_size, |
1239 | int __user *child_tidptr, | 1239 | int __user *child_tidptr, |
1240 | struct pid *pid, | 1240 | struct pid *pid, |
1241 | int trace) | 1241 | int trace, |
1242 | unsigned long tls) | ||
1242 | { | 1243 | { |
1243 | int retval; | 1244 | int retval; |
1244 | struct task_struct *p; | 1245 | struct task_struct *p; |
@@ -1447,7 +1448,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
1447 | retval = copy_io(clone_flags, p); | 1448 | retval = copy_io(clone_flags, p); |
1448 | if (retval) | 1449 | if (retval) |
1449 | goto bad_fork_cleanup_namespaces; | 1450 | goto bad_fork_cleanup_namespaces; |
1450 | retval = copy_thread(clone_flags, stack_start, stack_size, p); | 1451 | retval = copy_thread_tls(clone_flags, stack_start, stack_size, p, tls); |
1451 | if (retval) | 1452 | if (retval) |
1452 | goto bad_fork_cleanup_io; | 1453 | goto bad_fork_cleanup_io; |
1453 | 1454 | ||
@@ -1659,7 +1660,7 @@ static inline void init_idle_pids(struct pid_link *links) | |||
1659 | struct task_struct *fork_idle(int cpu) | 1660 | struct task_struct *fork_idle(int cpu) |
1660 | { | 1661 | { |
1661 | struct task_struct *task; | 1662 | struct task_struct *task; |
1662 | task = copy_process(CLONE_VM, 0, 0, NULL, &init_struct_pid, 0); | 1663 | task = copy_process(CLONE_VM, 0, 0, NULL, &init_struct_pid, 0, 0); |
1663 | if (!IS_ERR(task)) { | 1664 | if (!IS_ERR(task)) { |
1664 | init_idle_pids(task->pids); | 1665 | init_idle_pids(task->pids); |
1665 | init_idle(task, cpu); | 1666 | init_idle(task, cpu); |
@@ -1674,11 +1675,12 @@ struct task_struct *fork_idle(int cpu) | |||
1674 | * It copies the process, and if successful kick-starts | 1675 | * It copies the process, and if successful kick-starts |
1675 | * it and waits for it to finish using the VM if required. | 1676 | * it and waits for it to finish using the VM if required. |
1676 | */ | 1677 | */ |
1677 | long do_fork(unsigned long clone_flags, | 1678 | long _do_fork(unsigned long clone_flags, |
1678 | unsigned long stack_start, | 1679 | unsigned long stack_start, |
1679 | unsigned long stack_size, | 1680 | unsigned long stack_size, |
1680 | int __user *parent_tidptr, | 1681 | int __user *parent_tidptr, |
1681 | int __user *child_tidptr) | 1682 | int __user *child_tidptr, |
1683 | unsigned long tls) | ||
1682 | { | 1684 | { |
1683 | struct task_struct *p; | 1685 | struct task_struct *p; |
1684 | int trace = 0; | 1686 | int trace = 0; |
@@ -1703,7 +1705,7 @@ long do_fork(unsigned long clone_flags, | |||
1703 | } | 1705 | } |
1704 | 1706 | ||
1705 | p = copy_process(clone_flags, stack_start, stack_size, | 1707 | p = copy_process(clone_flags, stack_start, stack_size, |
1706 | child_tidptr, NULL, trace); | 1708 | child_tidptr, NULL, trace, tls); |
1707 | /* | 1709 | /* |
1708 | * Do this prior waking up the new thread - the thread pointer | 1710 | * Do this prior waking up the new thread - the thread pointer |
1709 | * might get invalid after that point, if the thread exits quickly. | 1711 | * might get invalid after that point, if the thread exits quickly. |
@@ -1744,20 +1746,34 @@ long do_fork(unsigned long clone_flags, | |||
1744 | return nr; | 1746 | return nr; |
1745 | } | 1747 | } |
1746 | 1748 | ||
1749 | #ifndef CONFIG_HAVE_COPY_THREAD_TLS | ||
1750 | /* For compatibility with architectures that call do_fork directly rather than | ||
1751 | * using the syscall entry points below. */ | ||
1752 | long do_fork(unsigned long clone_flags, | ||
1753 | unsigned long stack_start, | ||
1754 | unsigned long stack_size, | ||
1755 | int __user *parent_tidptr, | ||
1756 | int __user *child_tidptr) | ||
1757 | { | ||
1758 | return _do_fork(clone_flags, stack_start, stack_size, | ||
1759 | parent_tidptr, child_tidptr, 0); | ||
1760 | } | ||
1761 | #endif | ||
1762 | |||
1747 | /* | 1763 | /* |
1748 | * Create a kernel thread. | 1764 | * Create a kernel thread. |
1749 | */ | 1765 | */ |
1750 | pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | 1766 | pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) |
1751 | { | 1767 | { |
1752 | return do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, | 1768 | return _do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, |
1753 | (unsigned long)arg, NULL, NULL); | 1769 | (unsigned long)arg, NULL, NULL, 0); |
1754 | } | 1770 | } |
1755 | 1771 | ||
1756 | #ifdef __ARCH_WANT_SYS_FORK | 1772 | #ifdef __ARCH_WANT_SYS_FORK |
1757 | SYSCALL_DEFINE0(fork) | 1773 | SYSCALL_DEFINE0(fork) |
1758 | { | 1774 | { |
1759 | #ifdef CONFIG_MMU | 1775 | #ifdef CONFIG_MMU |
1760 | return do_fork(SIGCHLD, 0, 0, NULL, NULL); | 1776 | return _do_fork(SIGCHLD, 0, 0, NULL, NULL, 0); |
1761 | #else | 1777 | #else |
1762 | /* can not support in nommu mode */ | 1778 | /* can not support in nommu mode */ |
1763 | return -EINVAL; | 1779 | return -EINVAL; |
@@ -1768,8 +1784,8 @@ SYSCALL_DEFINE0(fork) | |||
1768 | #ifdef __ARCH_WANT_SYS_VFORK | 1784 | #ifdef __ARCH_WANT_SYS_VFORK |
1769 | SYSCALL_DEFINE0(vfork) | 1785 | SYSCALL_DEFINE0(vfork) |
1770 | { | 1786 | { |
1771 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, | 1787 | return _do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0, |
1772 | 0, NULL, NULL); | 1788 | 0, NULL, NULL, 0); |
1773 | } | 1789 | } |
1774 | #endif | 1790 | #endif |
1775 | 1791 | ||
@@ -1777,27 +1793,27 @@ SYSCALL_DEFINE0(vfork) | |||
1777 | #ifdef CONFIG_CLONE_BACKWARDS | 1793 | #ifdef CONFIG_CLONE_BACKWARDS |
1778 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, | 1794 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, |
1779 | int __user *, parent_tidptr, | 1795 | int __user *, parent_tidptr, |
1780 | int, tls_val, | 1796 | unsigned long, tls, |
1781 | int __user *, child_tidptr) | 1797 | int __user *, child_tidptr) |
1782 | #elif defined(CONFIG_CLONE_BACKWARDS2) | 1798 | #elif defined(CONFIG_CLONE_BACKWARDS2) |
1783 | SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags, | 1799 | SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags, |
1784 | int __user *, parent_tidptr, | 1800 | int __user *, parent_tidptr, |
1785 | int __user *, child_tidptr, | 1801 | int __user *, child_tidptr, |
1786 | int, tls_val) | 1802 | unsigned long, tls) |
1787 | #elif defined(CONFIG_CLONE_BACKWARDS3) | 1803 | #elif defined(CONFIG_CLONE_BACKWARDS3) |
1788 | SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp, | 1804 | SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp, |
1789 | int, stack_size, | 1805 | int, stack_size, |
1790 | int __user *, parent_tidptr, | 1806 | int __user *, parent_tidptr, |
1791 | int __user *, child_tidptr, | 1807 | int __user *, child_tidptr, |
1792 | int, tls_val) | 1808 | unsigned long, tls) |
1793 | #else | 1809 | #else |
1794 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, | 1810 | SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp, |
1795 | int __user *, parent_tidptr, | 1811 | int __user *, parent_tidptr, |
1796 | int __user *, child_tidptr, | 1812 | int __user *, child_tidptr, |
1797 | int, tls_val) | 1813 | unsigned long, tls) |
1798 | #endif | 1814 | #endif |
1799 | { | 1815 | { |
1800 | return do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr); | 1816 | return _do_fork(clone_flags, newsp, 0, parent_tidptr, child_tidptr, tls); |
1801 | } | 1817 | } |
1802 | #endif | 1818 | #endif |
1803 | 1819 | ||