From patchwork Wed Oct 19 03:49:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 4433 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp109426wrs; Tue, 18 Oct 2022 20:38:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41i3xm8sopOLgvVYyDEgA8eDqEhLNqsIQlfnmsndvrYLRraCfQbRdy1bACZlB9iD6XuLwW X-Received: by 2002:a05:6402:5485:b0:459:147a:d902 with SMTP id fg5-20020a056402548500b00459147ad902mr5599429edb.263.1666150697980; Tue, 18 Oct 2022 20:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666150697; cv=none; d=google.com; s=arc-20160816; b=J+Mb/pp2X3lbejW9TohNWPlDetNRpdLQiWXYnXmtx2/LMnAMaLxgGXGu4bOjdncFQr SheV6wPO3px77ITdoKgm1EJTPJlbmOHpojZ/YopP7gotvqvVE03uRnF9II5b2+FlM0B+ CGTh6aQEV0mV5ruBCLhHLrfc59G4kqUOlQd2kkHqoLIKv60xdTkJULXf1P+/wjvQRgb+ MJWwqA3dgOyMVDVh9AT9/Z00RX227v/NgjtRdqxEfugWtMmgVLwsJqqtCOkA4HYNoYhr +EOwmuWaamNz0guHIn8ZD64Mx+4ABVcJ5u9m7reVa7Q7oNshOmaST3kQXSjvqVZgxlKI w6fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ppy1RF3pOcFIZ3ILq218Whi5/N8wKsABR515Lv+nZj4=; b=pXoaV6uXv5ogc2VrfgodFA2zAmSSaOd3yP4sIlFWbeoWjfAJlEcxPVVuwjIoJeyXc7 YqlY17V39SpzBZgkg/3MsBwU/hou7VC0j0JJA25gxtAeJExsYya7TXmufyavGZi9Y1bF rWpmi3YifhwQcUODuGqg6XmmqLkEZZO20Ula5xRn+s9xB237zUJVKE3M6DOwgaNpupoq CtHLqNwBZQOSv9RVwm+GnLWRApTT04FJfEmZRaSlt3n8RVLJIL2ABHatUmCobfXLrSz0 /FkiWv+IImf3HcPtg51hj+sMqmN8ozoHQb1vRBmBN2OQKKi5Kl6Dfck4MuMmdSq2s/RB Hc7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq6-20020a1709073f0600b00787c0e9818csi15656430ejc.568.2022.10.18.20.37.53; Tue, 18 Oct 2022 20:38:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229508AbiJSDar (ORCPT + 99 others); Tue, 18 Oct 2022 23:30:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbiJSDa3 (ORCPT ); Tue, 18 Oct 2022 23:30:29 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C534A659E1; Tue, 18 Oct 2022 20:30:23 -0700 (PDT) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Msbkb21cWznV2c; Wed, 19 Oct 2022 11:27:03 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 11:29:57 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 19 Oct 2022 11:29:57 +0800 From: Kefeng Wang To: , Andrew Morton CC: Dinh Nguyen , Jarkko Sakkinen , Dave Hansen , , , , Kefeng Wang Subject: [PATCH 3/5] mm: mprotect: use VM_ACCESS_FLAGS Date: Wed, 19 Oct 2022 11:49:43 +0800 Message-ID: <20221019034945.93081-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221019034945.93081-1-wangkefeng.wang@huawei.com> References: <20221019034945.93081-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747085634177044071?= X-GMAIL-MSGID: =?utf-8?q?1747085634177044071?= Simplify VM_READ|VM_WRITE|VM_EXEC with VM_ACCESS_FLAGS. Signed-off-by: Kefeng Wang --- mm/mprotect.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/mprotect.c b/mm/mprotect.c index 668bfaa6ed2a..99762403cc8f 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -756,8 +756,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len, * If a permission is not passed to mprotect(), it must be * cleared from the VMA. */ - mask_off_old_flags = VM_READ | VM_WRITE | VM_EXEC | - VM_FLAGS_CLEAR; + mask_off_old_flags = VM_ACCESS_FLAGS | VM_FLAGS_CLEAR; new_vma_pkey = arch_override_mprotect_pkey(vma, prot, pkey); newflags = calc_vm_prot_bits(prot, new_vma_pkey);