Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3191435pxb; Sun, 7 Feb 2021 00:38:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyQvpWAYIs0r1olwkSdQ3xkZYcR+N1bZCVq+arOjzzYOOGUL24Wh/nn+oOfKUaKjmf9/7t X-Received: by 2002:a05:6402:524f:: with SMTP id t15mr11554932edd.158.1612687117263; Sun, 07 Feb 2021 00:38:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612687117; cv=none; d=google.com; s=arc-20160816; b=eaLo5GFYgKxewCPHml1Nz6zafZlnAKycuhgdvLtFSd9uZyvWVf6qFaQDR0ZYTBrCfo sEUXEWtNFeHHxDwMtyYSDnZUIUcjdaXEhvnc5KOH8eNzCQz5g23kSAU2DjXhhNFFjEjx oFjJhjYi/LfJsyzzvWfDKrZ/ZQmTz7cnfDPTbtHEOCfSQ75v0e8+vOYLSD4Mlp7iKc4s hcaCQftdCtVRvy3LXiWjOa4lsPLmhbFnGT/fBXMqZ6b3DAcKUrd6XeRqxul9LdcehQ4k gtGizO9hvGkZ8ExdngAU+2tejYa3xNbUlGajlIulZ5gQ32w4R8uiELApitnoOh/tnEOi 8iEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=WXOS1nV7vBv7T/lTaCzQAtJbWPUenAuqIvW3qVy9XFk=; b=hxtBaoy2Yqu58tGA4HFfCKTtv/LP7+JSMFP5Zh0B5ieGBWgXXOqCJJzyAKhTlbPNbi nd3jsdDeJZ7HdwPp4kcIbbzxirgIKA5ZjDhzLnJ+octIGhcKbcA5pIQeIdu2QU3yLQmf duu1yjYrLo3B75WlOt4L/B+1+sGch5o8GpeFyFg3ymrJwF+cj7AyG8slvjuWU55y5kYc H+2BkELLu7MSsiNZV41M+nGD7lEUlViUOfoHoj9va6hCoAAJi1f6QTwIHY6NvZzE4pKT hrq7kMrG291aLjPDdmHlLKCNER1wWjWZFWQhLmLtM/afy4//a9K4cFxfGIwO3F8RRH26 umdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb8si11026829edb.535.2021.02.07.00.38.09; Sun, 07 Feb 2021 00:38:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230010AbhBGIfH (ORCPT + 99 others); Sun, 7 Feb 2021 03:35:07 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:12142 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbhBGIdH (ORCPT ); Sun, 7 Feb 2021 03:33:07 -0500 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4DYMmx4fsHz164sT; Sun, 7 Feb 2021 16:30:57 +0800 (CST) Received: from [10.136.110.154] (10.136.110.154) by smtp.huawei.com (10.3.19.213) with Microsoft SMTP Server (TLS) id 14.3.498.0; Sun, 7 Feb 2021 16:32:18 +0800 Subject: Re: [PATCH 3/6] fs-verity: add FS_IOC_READ_VERITY_METADATA ioctl To: Eric Biggers CC: , Theodore Ts'o , , , , Jaegeuk Kim , , Victor Hsieh References: <20210115181819.34732-1-ebiggers@kernel.org> <20210115181819.34732-4-ebiggers@kernel.org> <107cf2f2-a6fe-57c2-d17d-57679d7c612d@huawei.com> From: Chao Yu Message-ID: Date: Sun, 7 Feb 2021 16:32:17 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.136.110.154] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2021/2/7 16:01, Eric Biggers wrote: > On Sun, Feb 07, 2021 at 03:46:43PM +0800, Chao Yu wrote: >> Hi Eric, >> >> On 2021/1/16 2:18, Eric Biggers wrote: >>> +static int f2fs_ioc_read_verity_metadata(struct file *filp, unsigned long arg) >>> +{ >>> + if (!f2fs_sb_has_verity(F2FS_I_SB(file_inode(filp)))) >>> + return -EOPNOTSUPP; >> >> One case is after we update kernel image, f2fs module may no longer support >> compress algorithm which current file was compressed with, to avoid triggering >> IO with empty compress engine (struct f2fs_compress_ops pointer): >> >> It needs to add f2fs_is_compress_backend_ready() check condition here? >> >> Thanks, >> >>> + >>> + return fsverity_ioctl_read_metadata(filp, (const void __user *)arg); >>> +} > > In that case it wouldn't have been possible to open the file, because > f2fs_file_open() checks for it. So it's not necessary to repeat the same check > in every operation on the file descriptor. Oh, yes, it's safe now. I'm thinking we need to remove the check in f2fs_file_open(), because the check will fail metadata access/update (via f{g,s}etxattr/ioctl), however original intention of that check is only to avoid syscalls to touch compressed data w/o the engine, anyway this is another topic. The whole patchset looks fine to me, feel free to add: Reviewed-by: Chao Yu Thanks, > > - Eric > . >