From patchwork Thu Nov 3 03:04:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jann Horn X-Patchwork-Id: 9410097 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 D75C3601C2 for ; Thu, 3 Nov 2016 03:05:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C935A2A711 for ; Thu, 3 Nov 2016 03:05:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC2182A75C; Thu, 3 Nov 2016 03:05:48 +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 709D02A711 for ; Thu, 3 Nov 2016 03:05:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752194AbcKCDFb (ORCPT ); Wed, 2 Nov 2016 23:05:31 -0400 Received: from thejh.net ([37.221.195.125]:35350 "EHLO thejh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751549AbcKCDE4 (ORCPT ); Wed, 2 Nov 2016 23:04:56 -0400 Received: from pc.thejh.net (pc.vpn [192.168.44.2]) by thejh.net (Postfix) with ESMTPSA id F2091180A13; Thu, 3 Nov 2016 04:04:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thejh.net; s=s2016; t=1478142294; bh=QV2jiwXl8QyFoYR7cNL6MTUE67gF3EZWFiF8UsqNn7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=3dzUqo2yecyV0CUrqJ8UTxBFI4zR9/bYjIqfpOgnxuBYUjEt4lfmblHEmzw/9bIJc KYyJGb0JiCx8W1gWXh9oUKNXxIEaKv5XC4QJDtPabZKRxeMcWG81jGyHH3PYTH62YX UVjknHfMAMA0Bu9VGMTARS+0qT1fn4U9A18BZnA3ZKH7J1F0g48s3hlejMZtd3k/1Q fDIuJcNVRLkmeQFfZRzcQd9RtMAfbxT2qdnG8600oe9qineRjKmgb6BbZfGL0jgRO5 2jnAOEOq6gMEQWMazJbJuN5t+oJgKPqUVV3OhCAHjnpmPJ8FpurD2Z4RnN8LkorS7V dHSEmlWZQfLzw== 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 v3 1/3] fs/exec: don't force writing memory access Date: Thu, 3 Nov 2016 04:04:44 +0100 Message-Id: <1478142286-18427-4-git-send-email-jann@thejh.net> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1478142286-18427-1-git-send-email-jann@thejh.net> References: <1478142286-18427-1-git-send-email-jann@thejh.net> 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 Acked-by: Oleg Nesterov --- 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) {