--- d1e2411ef160e544934dd27282f5739608ca53a7 +++ d576b552e8e2eb90a98324e79b7d8917fb96c04c @@ -1353,10 +1353,6 @@ static int compat_count(compat_uptr_t __ argv++; if (i++ >= max) return -E2BIG; - - if (fatal_signal_pending(current)) - return -ERESTARTNOHAND; - cond_resched(); } } return i; @@ -1398,12 +1394,6 @@ static int compat_copy_strings(int argc, 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; @@ -1420,8 +1410,18 @@ static int compat_copy_strings(int argc, if (!kmapped_page || kpos != (pos & PAGE_MASK)) { struct page *page; - page = get_arg_page(bprm, pos, 1); - if (!page) { +#ifdef CONFIG_STACK_GROWSUP + ret = expand_stack_downwards(bprm->vma, pos); + if (ret < 0) { + /* We've exceed the stack rlimit. */ + ret = -E2BIG; + goto out; + } +#endif + ret = get_user_pages(current, bprm->mm, pos, + 1, 1, 1, &page, NULL); + if (ret <= 0) { + /* We've exceed the stack rlimit. */ ret = -E2BIG; goto out; } @@ -1542,10 +1542,8 @@ int compat_do_execve(char * filename, return retval; out: - if (bprm->mm) { - acct_arg_size(bprm, 0); + if (bprm->mm) mmput(bprm->mm); - } out_file: if (bprm->file) {