Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2320215pxu; Mon, 7 Dec 2020 03:38:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJzNKoQBpoS2qXHvAkj2T63GSMW1ysR/xnY6HKeBRKyMdzmCwPlL8Z1H5P+w/jE/GZ2iAhN+ X-Received: by 2002:a17:906:1a01:: with SMTP id i1mr18586074ejf.315.1607341128946; Mon, 07 Dec 2020 03:38:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607341128; cv=none; d=google.com; s=arc-20160816; b=F6m6RjElcL++r+iO34zquzsX7jOaX1nr7Dxx+S1B38EpSURBkGtqqcF6HdhaJXYKlP +ToIQake98cw27D9BIq7mPJVjnmlzwLApZ94hnnI1cttoqKSY8WGc1sqdVX1mfGgV/rr R1uE5pcb/VKU9c+eJkHQ/f1MZcoTIfhB1pGDbleBJvFvhiMRfY8KU84S53yTNbd3CC10 7sM5VxahwmnimtZjeUc4gJ+lYf2GKZj91PcKb2S0BOE4xpRp2Si1YpxCgFLG6X90VrOP AYCNyjZPkhe/dfBW7k9OvMbkhsysB68A+Jo1F3cqtVYlX7QZNWULWkhaSAA+BDYt4WDR nWdw== 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 :dkim-signature; bh=TR3cC+AByvGn3JshaPXKc+3rxof2L0xMPbaiJBaNE0A=; b=Xe0oIle6wCD3KDvNIiqNTDnFf+tiwPSmo2R5eoDrt/FLkTo24IGLxVZyVGZMOXpB33 e5GEpoZv6QU79ZG3vJquxiT6cFOhDLH+A3sOKwRvGy7dD3rGcybxT7H3xovSQEVp2pg6 Y+Ry13gcRvCtHCtxZLBFvSoJVfG9v/nZf24nTc1jVR3W4APWmWqg6usxHRsMKWyTDcq9 IfPhergoJR3E2ZOuP0KzTxV9VRHtrZ/A3FPW4NIEhXiFF/PsCIP9pi9/Fa/uSG06Ow3/ 40eNIx9tt8mcN6GvSmWonvw38RfeTT8gYh7YiWTGodJ35g0xGc6quXuTVzevjoTXhczG N7eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PwcAOe4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q5si6188981ejr.681.2020.12.07.03.38.26; Mon, 07 Dec 2020 03:38:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PwcAOe4h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727242AbgLGLfS (ORCPT + 99 others); Mon, 7 Dec 2020 06:35:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbgLGLfO (ORCPT ); Mon, 7 Dec 2020 06:35:14 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D76C0613D2; Mon, 7 Dec 2020 03:34:33 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id s21so9601217pfu.13; Mon, 07 Dec 2020 03:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TR3cC+AByvGn3JshaPXKc+3rxof2L0xMPbaiJBaNE0A=; b=PwcAOe4heCxF7XTuomjeUtwKezkdJmM0HmTX1yw4AeADa+3Z5jYH2gnncSNx6tF/dK nqc3OY3XklNb6fsWrMNV9SLhYauoxenHh7jF/LUEVNXitOpU59OZoN9JC+QCR46jU/Ns sBCj+XDvRx916ayOQcnxhHqZ/yh9ih/c9sVknDZkZs/LBEO/v5jpO2wZ1oEm3FfjX0hE TbWTBt9N8W/HGCkWK2IvBBhkklXYtf5Ke1t4gjU8zkkB1O5YL8vGHwUoJwXrPE3CU4Q8 1EfVWBeVZsU6g44z81Jf/b0p33RSG/Hwm+qr6c5NqBuzkeVYX26s7OBZzLc31WX/Gbiy jVjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TR3cC+AByvGn3JshaPXKc+3rxof2L0xMPbaiJBaNE0A=; b=UPfisDrJQYj2PhVclw+UNTNBs7Zg/k0g8ZWOLVPrdXoAgkKDWs2e1mzjOwxtyPINcI S5DWvvCkUAhUKcJOXn4kDDNhGt8o3xruXpmNqcGMlItO9Zejm6GXgyNfxveqIsAuglRD mKMNuxbg9asxxkGsIV/fuvZoUoQVAfDZqhcZfr1hiSHTImdBtMe37j83j7zapNvkZ4Gw c0LP0MG2cshqszEV+/5kTQf6YrGv8KEyiBnEVQ53wzXXei1Qi8JUf/qdyi/oCrvGvMHA MFcRhPiqFswuiF78nCT70zu33SkHKtl0X3axh6FZjX7YlAAXAQbXak2KRsj9ian6V1ku VzsA== X-Gm-Message-State: AOAM531cGx60hY4bYmmm3usdZClEazgnEz7UiBUGh6iKWTeQ+RzRkF+F QYSmZBLB+DA7ycuX+7Q1ajk= X-Received: by 2002:a63:e20:: with SMTP id d32mr18339042pgl.94.1607340873505; Mon, 07 Dec 2020 03:34:33 -0800 (PST) Received: from localhost.localdomain ([203.205.141.39]) by smtp.gmail.com with ESMTPSA id d4sm14219822pfo.127.2020.12.07.03.34.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2020 03:34:32 -0800 (PST) From: yulei.kernel@gmail.com X-Google-Original-From: yuleixzhang@tencent.com To: linux-mm@kvack.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, naoya.horiguchi@nec.com, viro@zeniv.linux.org.uk, pbonzini@redhat.com Cc: joao.m.martins@oracle.com, rdunlap@infradead.org, sean.j.christopherson@intel.com, xiaoguangrong.eric@gmail.com, kernellwp@gmail.com, lihaiwei.kernel@gmail.com, Yulei Zhang , Chen Zhuo Subject: [RFC V2 16/37] dmemfs: introduce ->split() to dmemfs_vm_ops Date: Mon, 7 Dec 2020 19:31:09 +0800 Message-Id: <6b3c166a8d5827a1f6f2a33d85feae1c1633a45d.1607332046.git.yuleixzhang@tencent.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yulei Zhang It is required by __split_vma() to adjust vma. munmap() which create hole unaligned to pagesize in dmemfs-mapping should be forbidden. Signed-off-by: Chen Zhuo Signed-off-by: Yulei Zhang --- fs/dmemfs/inode.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/dmemfs/inode.c b/fs/dmemfs/inode.c index 443f2e1..ab6a492 100644 --- a/fs/dmemfs/inode.c +++ b/fs/dmemfs/inode.c @@ -450,6 +450,13 @@ static bool check_vma_access(struct vm_area_struct *vma, int write) return len; } +static int dmemfs_split(struct vm_area_struct *vma, unsigned long addr) +{ + if (addr & (dmem_page_size(file_inode(vma->vm_file)) - 1)) + return -EINVAL; + return 0; +} + static vm_fault_t dmemfs_fault(struct vm_fault *vmf) { struct vm_area_struct *vma = vmf->vma; @@ -484,6 +491,7 @@ static unsigned long dmemfs_pagesize(struct vm_area_struct *vma) } static const struct vm_operations_struct dmemfs_vm_ops = { + .split = dmemfs_split, .fault = dmemfs_fault, .pagesize = dmemfs_pagesize, .access = dmemfs_access_dmem, -- 1.8.3.1