[v2,1/3] fs/exec: don't force writing memory access
diff mbox

Message ID 1475103281-7989-2-git-send-email-jann@thejh.net
State New
Headers show

Commit Message

Jann Horn Sept. 28, 2016, 10:54 p.m. UTC
This shouldn't change behavior in any way - at this point, there should be
no non-writable mappings, only the initial stack mapping -, but this change
makes it easier to reason about the correctness of the following commits
that place restrictions on forced memory writes.

Signed-off-by: Jann Horn <jann@thejh.net>
Reviewed-by: Janis Danisevskis <jdanis@android.com>
---
 fs/exec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Oleg Nesterov Sept. 29, 2016, 4:09 p.m. UTC | #1
On 09/29, Jann Horn wrote:
>
> @@ -204,7 +204,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
>  	 * doing the exec and bprm->mm is the new process's mm.
>  	 */
>  	ret = get_user_pages_remote(current, bprm->mm, pos, 1, write,
> -			1, &page, NULL);
> +			0, &page, NULL);

To me this looks like a reasonable cleanup regardless, FOLL_FORCE
just adds the unnecessary confusion here.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/exec.c b/fs/exec.c
index 6fcfb3f..d607da8 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -204,7 +204,7 @@  static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos,
 	 * doing the exec and bprm->mm is the new process's mm.
 	 */
 	ret = get_user_pages_remote(current, bprm->mm, pos, 1, write,
-			1, &page, NULL);
+			0, &page, NULL);
 	if (ret <= 0)
 		return NULL;