X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=fs%2Fexec.c;h=828dd2461d6beb7c37ed7df74ef11177c2bcba6d;hb=a42afc5f56f319107e987aa6adf2f65d93d527c7;hp=2d9455282744bce582e48e0ecec4f4a6d332a28c;hpb=997396a73a94de7d92d82e30d7bb1d931e38cb16;p=cascardo%2Flinux.git diff --git a/fs/exec.c b/fs/exec.c index 2d9455282744..828dd2461d6b 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -376,6 +376,9 @@ static int count(const char __user * const __user * argv, int max) argv++; if (i++ >= max) return -E2BIG; + + if (fatal_signal_pending(current)) + return -ERESTARTNOHAND; cond_resched(); } } @@ -419,6 +422,12 @@ static int copy_strings(int argc, const char __user *const __user *argv, while (len > 0) { int offset, bytes_to_copy; + if (fatal_signal_pending(current)) { + ret = -ERESTARTNOHAND; + goto out; + } + cond_resched(); + offset = pos % PAGE_SIZE; if (offset == 0) offset = PAGE_SIZE; @@ -594,6 +603,11 @@ int setup_arg_pages(struct linux_binprm *bprm, #else stack_top = arch_align_stack(stack_top); stack_top = PAGE_ALIGN(stack_top); + + if (unlikely(stack_top < mmap_min_addr) || + unlikely(vma->vm_end - vma->vm_start >= stack_top - mmap_min_addr)) + return -ENOMEM; + stack_shift = vma->vm_end - stack_top; bprm->p -= stack_shift;