From patchwork Mon Feb 18 10:04:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chandan Rajendra X-Patchwork-Id: 1043874 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 442zxX6FPTz9sBZ for ; Mon, 18 Feb 2019 21:04:48 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729249AbfBRKEs (ORCPT ); Mon, 18 Feb 2019 05:04:48 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50972 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729242AbfBRKEs (ORCPT ); Mon, 18 Feb 2019 05:04:48 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1IA3u3v069949 for ; Mon, 18 Feb 2019 05:04:46 -0500 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qqrc5e744-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 18 Feb 2019 05:04:39 -0500 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 18 Feb 2019 10:04:38 -0000 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e33.co.us.ibm.com (192.168.1.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 18 Feb 2019 10:04:35 -0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1IA4YP033554490 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 18 Feb 2019 10:04:34 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2DF3D136055; Mon, 18 Feb 2019 10:04:34 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A6070136051; Mon, 18 Feb 2019 10:04:31 +0000 (GMT) Received: from localhost.in.ibm.com (unknown [9.124.35.115]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Mon, 18 Feb 2019 10:04:31 +0000 (GMT) From: Chandan Rajendra To: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org Cc: Chandan Rajendra , tytso@mit.edu, adilger.kernel@dilger.ca, ebiggers@kernel.org, jaegeuk@kernel.org, yuchao0@huawei.com Subject: [RFC PATCH 08/10] fsverity: Add call back to verify file holes Date: Mon, 18 Feb 2019 15:34:31 +0530 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190218100433.20048-1-chandan@linux.ibm.com> References: <20190218100433.20048-1-chandan@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19021810-0036-0000-0000-00000A8DD191 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010619; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000280; SDB=6.01162773; UDB=6.00607075; IPR=6.00943349; MB=3.00025633; MTD=3.00000008; XFM=3.00000015; UTC=2019-02-18 10:04:37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19021810-0037-0000-0000-00004AC4D0C5 Message-Id: <20190218100433.20048-9-chandan@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-02-18_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902180077 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org readpage() implmentations zero out part of the page-cache page mapping a file hole. This commit adds a call back to "struct fsverity_operations" which readpage() can invoke to verify the file hole. Signed-off-by: Chandan Rajendra --- fs/ext4/super.c | 1 + include/linux/fsverity.h | 1 + 2 files changed, 2 insertions(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4493ddc357c6..94e0d4b56653 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1459,6 +1459,7 @@ static const struct fsverity_operations ext4_verityops = { .read_metadata_page = ext4_read_verity_metadata_page, .verity_required = ext4_verity_required, .readpage_limit = ext4_readpage_limit, + .check_hole = fsverity_check_hole, }; #endif /* CONFIG_FS_VERITY */ diff --git a/include/linux/fsverity.h b/include/linux/fsverity.h index fc8113acbbfe..8bc28b07d550 100644 --- a/include/linux/fsverity.h +++ b/include/linux/fsverity.h @@ -20,6 +20,7 @@ struct fsverity_operations { struct page *(*read_metadata_page)(struct inode *inode, pgoff_t index); bool (*verity_required)(struct inode *inode, pgoff_t index); loff_t (*readpage_limit)(struct inode *inode); + bool (*check_hole)(struct inode *inode, struct page *page); }; #ifdef CONFIG_FS_VERITY