diff options
Diffstat (limited to 'kernel/sys.c')
| -rw-r--r-- | kernel/sys.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index f0ec44dcd415..2d39a84cd857 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
| @@ -1788,7 +1788,6 @@ SYSCALL_DEFINE1(umask, int, mask) | |||
| 1788 | #ifdef CONFIG_CHECKPOINT_RESTORE | 1788 | #ifdef CONFIG_CHECKPOINT_RESTORE |
| 1789 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | 1789 | static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) |
| 1790 | { | 1790 | { |
| 1791 | struct vm_area_struct *vma; | ||
| 1792 | struct file *exe_file; | 1791 | struct file *exe_file; |
| 1793 | struct dentry *dentry; | 1792 | struct dentry *dentry; |
| 1794 | int err; | 1793 | int err; |
| @@ -1816,13 +1815,17 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | |||
| 1816 | down_write(&mm->mmap_sem); | 1815 | down_write(&mm->mmap_sem); |
| 1817 | 1816 | ||
| 1818 | /* | 1817 | /* |
| 1819 | * Forbid mm->exe_file change if there are mapped other files. | 1818 | * Forbid mm->exe_file change if old file still mapped. |
| 1820 | */ | 1819 | */ |
| 1821 | err = -EBUSY; | 1820 | err = -EBUSY; |
| 1822 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 1821 | if (mm->exe_file) { |
| 1823 | if (vma->vm_file && !path_equal(&vma->vm_file->f_path, | 1822 | struct vm_area_struct *vma; |
| 1824 | &exe_file->f_path)) | 1823 | |
| 1825 | goto exit_unlock; | 1824 | for (vma = mm->mmap; vma; vma = vma->vm_next) |
| 1825 | if (vma->vm_file && | ||
| 1826 | path_equal(&vma->vm_file->f_path, | ||
| 1827 | &mm->exe_file->f_path)) | ||
| 1828 | goto exit_unlock; | ||
| 1826 | } | 1829 | } |
| 1827 | 1830 | ||
| 1828 | /* | 1831 | /* |
| @@ -1835,6 +1838,7 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) | |||
| 1835 | if (test_and_set_bit(MMF_EXE_FILE_CHANGED, &mm->flags)) | 1838 | if (test_and_set_bit(MMF_EXE_FILE_CHANGED, &mm->flags)) |
| 1836 | goto exit_unlock; | 1839 | goto exit_unlock; |
| 1837 | 1840 | ||
| 1841 | err = 0; | ||
| 1838 | set_mm_exe_file(mm, exe_file); | 1842 | set_mm_exe_file(mm, exe_file); |
| 1839 | exit_unlock: | 1843 | exit_unlock: |
| 1840 | up_write(&mm->mmap_sem); | 1844 | up_write(&mm->mmap_sem); |
| @@ -2127,9 +2131,6 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
| 2127 | else | 2131 | else |
| 2128 | return -EINVAL; | 2132 | return -EINVAL; |
| 2129 | break; | 2133 | break; |
| 2130 | case PR_GET_TID_ADDRESS: | ||
| 2131 | error = prctl_get_tid_address(me, (int __user **)arg2); | ||
| 2132 | break; | ||
| 2133 | default: | 2134 | default: |
| 2134 | return -EINVAL; | 2135 | return -EINVAL; |
| 2135 | } | 2136 | } |
| @@ -2147,6 +2148,9 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
| 2147 | case PR_SET_MM: | 2148 | case PR_SET_MM: |
| 2148 | error = prctl_set_mm(arg2, arg3, arg4, arg5); | 2149 | error = prctl_set_mm(arg2, arg3, arg4, arg5); |
| 2149 | break; | 2150 | break; |
| 2151 | case PR_GET_TID_ADDRESS: | ||
| 2152 | error = prctl_get_tid_address(me, (int __user **)arg2); | ||
| 2153 | break; | ||
| 2150 | case PR_SET_CHILD_SUBREAPER: | 2154 | case PR_SET_CHILD_SUBREAPER: |
| 2151 | me->signal->is_child_subreaper = !!arg2; | 2155 | me->signal->is_child_subreaper = !!arg2; |
| 2152 | error = 0; | 2156 | error = 0; |
