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: 13011324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFA5CC433FE for ; Wed, 19 Oct 2022 03:30:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6BC126B0075; Tue, 18 Oct 2022 23:30:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6440B6B0078; Tue, 18 Oct 2022 23:30:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 50CBB6B007B; Tue, 18 Oct 2022 23:30:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 428106B0075 for ; Tue, 18 Oct 2022 23:30:25 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1816B1405F4 for ; Wed, 19 Oct 2022 03:30:25 +0000 (UTC) X-FDA: 80036271210.27.F980EB9 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf18.hostedemail.com (Postfix) with ESMTP id 1811F1C0002 for ; Wed, 19 Oct 2022 03:30:23 +0000 (UTC) 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666150224; a=rsa-sha256; cv=none; b=Z3nqDiB9yfNESxek+uihGfS3A6YnoOytpvjTCPy4FYwAqkrZSBI1c2ERl7PxpRCjaykw0m irnj4YSYheAnoZYJl2edOQeuhgrBNL+5gxjWTH1vGSyXPFk3aLckZtHoa3UUuYy+tENF6W RStImXuzPIvBLVzf/TaA5yay7sJlPss= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666150224; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ppy1RF3pOcFIZ3ILq218Whi5/N8wKsABR515Lv+nZj4=; b=wOieZqYJ9SxO5w/C4tTZ1ZmfiaCRUG8WGfAuk+LbZ3uEKjCRViEOe2mzzkpwCM5HKwfSmp VPcUSDZ0JyCQl4mbkDxdB+19IRKANZpCpylHBD4m7DrhKPk7SWNvvs2feRsgevLasc882s bxWnYQyQaJJctVgNV1M6fGb2BHl48rI= X-Rspam-User: Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-Stat-Signature: 7fjest8ec58sdh6shk3y1hjdw9hcd4o4 X-Rspamd-Queue-Id: 1811F1C0002 X-Rspamd-Server: rspam10 X-HE-Tag: 1666150223-707685 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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);