Skip to content

Commit 736f24d

Browse files
cyrillostorvalds
authored andcommitted
c/r: prctl: drop VMA flags test on PR_SET_MM_ stack data assignment
In commit b764375 ("procfs: mark thread stack correctly in proc/<pid>/maps") the stack allocated via clone() is marked in /proc/<pid>/maps as [stack:%d] thus it might be out of the former mm->start_stack/end_stack values (and even has some custom VMA flags set). So to be able to restore mm->start_stack/end_stack drop vma flags test, but still require the underlying VMA to exist. As always note this feature is under CONFIG_CHECKPOINT_RESTORE and requires CAP_SYS_RESOURCE to be granted. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Oleg Nesterov <oleg@redhat.com> Acked-by: Kees Cook <keescook@chromium.org> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Serge Hallyn <serge.hallyn@canonical.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 300f786 commit 736f24d

1 file changed

Lines changed: 0 additions & 14 deletions

File tree

‎kernel/sys.c‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,14 +1786,6 @@ SYSCALL_DEFINE1(umask, int, mask)
17861786
}
17871787

17881788
#ifdef CONFIG_CHECKPOINT_RESTORE
1789-
static bool vma_flags_mismatch(struct vm_area_struct *vma,
1790-
unsigned long required,
1791-
unsigned long banned)
1792-
{
1793-
return (vma->vm_flags & required) != required ||
1794-
(vma->vm_flags & banned);
1795-
}
1796-
17971789
static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)
17981790
{
17991791
struct vm_area_struct *vma;
@@ -1931,12 +1923,6 @@ static int prctl_set_mm(int opt, unsigned long addr,
19311923
error = -EFAULT;
19321924
goto out;
19331925
}
1934-
#ifdef CONFIG_STACK_GROWSUP
1935-
if (vma_flags_mismatch(vma, VM_READ | VM_WRITE | VM_GROWSUP, 0))
1936-
#else
1937-
if (vma_flags_mismatch(vma, VM_READ | VM_WRITE | VM_GROWSDOWN, 0))
1938-
#endif
1939-
goto out;
19401926
if (opt == PR_SET_MM_START_STACK)
19411927
mm->start_stack = addr;
19421928
else if (opt == PR_SET_MM_ARG_START)

0 commit comments

Comments
 (0)