From patchwork Thu Nov 3 03:04:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 9410083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2C982601C2 for ; Thu, 3 Nov 2016 03:04:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1203F2A6B9 for ; Thu, 3 Nov 2016 03:04:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 037352A6BF; Thu, 3 Nov 2016 03:04:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 721682A6B9 for ; Thu, 3 Nov 2016 03:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751455AbcKCDEz (ORCPT ); Wed, 2 Nov 2016 23:04:55 -0400 Received: from thejh.net ([37.221.195.125]:35314 "EHLO thejh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750935AbcKCDEz (ORCPT ); Wed, 2 Nov 2016 23:04:55 -0400 Received: from pc.thejh.net (pc.vpn [192.168.44.2]) by thejh.net (Postfix) with ESMTPSA id E8C99180974; Thu, 3 Nov 2016 04:04:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thejh.net; s=s2016; t=1478142292; bh=QV2jiwXl8QyFoYR7cNL6MTUE67gF3EZWFiF8UsqNn7o=; h=From:To:Cc:Subject:Date:From; b=w3SmTyTrXxpag1PSO50XwR2eSQ1NVahZE8etbOIQT96McHypVEZcyqE8PkbZvqQdj CCA21yylI13PmFnmV9d1Qq4YbvyWKHqfShh4wd6GceSNC+tL8L6vqM1ux3LcWnbnzN aCEsxkiLEqrCy+u5239/eVQSZYvPIU9Fk6PkNCRURyAwC376+ro75oBPbWpLvrn/2I rWX5dieDJmkgGFcJvK3e5X/SyxlRu9y8fSZa3oJA4hVYu5FJrTC/oG6iONQrOls9IK GkFSBE2eP1VjjtttRuYuqEKv4ngqyqcMQThWvLqqN1eYcZ1Q6LxJwbjFRNvbR3bOed b9RD0dtY1iIKg== From: Jann Horn To: security@kernel.org, Alexander Viro , Paul Moore , Stephen Smalley , Eric Paris , James Morris , "Serge E. Hallyn" , mchong@google.com, Andy Lutomirski , Ingo Molnar , Oleg Nesterov , Nick Kralevich , Janis Danisevskis Cc: linux-security-module@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] fs/exec: don't force writing memory access Date: Thu, 3 Nov 2016 04:04:41 +0100 Message-Id: <1478142286-18427-1-git-send-email-jann@thejh.net> X-Mailer: git-send-email 2.1.4 Sender: owner-linux-security-module@vger.kernel.org Precedence: bulk List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Janis Danisevskis --- fs/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/exec.c b/fs/exec.c index 4e497b9ee71e..dbc2dd2f0829 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -191,7 +191,7 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, { struct page *page; int ret; - unsigned int gup_flags = FOLL_FORCE; + unsigned int gup_flags = 0; #ifdef CONFIG_STACK_GROWSUP if (write) {