From patchwork Tue Nov 26 15:23:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Allison Karlitskaya X-Patchwork-Id: 13886111 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 157A41D47C1 for ; Tue, 26 Nov 2024 15:24:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732634669; cv=none; b=NNj6Y+JkvEXInwXEOTlGufEbIlM/kS9gjuHq+SNBpJcypD9eEvzDmSwP05Tuntgy8RtupSBq+fDiTlmeX7uEHShbxwugXZk0JBedUrGtoyVSyaS5LfBeus8vasp9bRzR+COaMweNkgoA+Id9Ca92yQP7YF5zVDpqIIOIoXDvI5A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732634669; c=relaxed/simple; bh=0nft9+2InSXfMNHbACxebYYRMVsPma/YV3+FO83lLFI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g/6j/h88RhayvnEU8rAv+CU0J2av8UOXj6g4uWzGzb8F9fxYA0XQ8almgL8ECaHr/HCdnIYVXm0U+VIjF4d/rJQJeESbPIkhdAn2bj2veo1r9Zs81a1Kz9Eow3MdNSIvYmVU+TnTm3Z5EQ1IvJg999JsZqdMwV+2JdWrNBfJb5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XD0kxN6g; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XD0kxN6g" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732634667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BjDx8OlXD2/WfS8jDjPYSgHlVJb6xQJh3y8DAKeGSnE=; b=XD0kxN6gZAnOsb9hmSsZ7TdYFq91sNk2fJrk4WKfzWActgDoWU1v7HfW/rzmQ3pyqZfISc LaaO66UEjKGKWIQdPnUXcWIdeLjXywZWIbzYS1v79i7kLceOtQ/EaaV7TNnQI9TZGrPYeV tIPYVv3rJpeHNGbJ4tJdo9lFpQBY4g0= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-146-ThjAZ9pfNomGLp6x-Xjb_Q-1; Tue, 26 Nov 2024 10:24:23 -0500 X-MC-Unique: ThjAZ9pfNomGLp6x-Xjb_Q-1 X-Mimecast-MFC-AGG-ID: ThjAZ9pfNomGLp6x-Xjb_Q Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D825419560B8; Tue, 26 Nov 2024 15:24:21 +0000 (UTC) Received: from toolbx.fritz.box (unknown [10.39.193.176]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8B4A01955F67; Tue, 26 Nov 2024 15:24:19 +0000 (UTC) From: Allison Karlitskaya To: dsterba@suse.cz Cc: allison.karlitskaya@redhat.com, ebiggers@kernel.org, fsverity@lists.linux.dev, linux-btrfs@vger.kernel.org, tytso@mit.edu Subject: [PATCH] btrfs: add FS_IOC_READ_VERITY_METADATA ioctl Date: Tue, 26 Nov 2024 16:23:31 +0100 Message-ID: <20241126152331.90434-1-allison.karlitskaya@redhat.com> In-Reply-To: <20241126151123.GF31418@twin.jikos.cz> References: <20241126151123.GF31418@twin.jikos.cz> Precedence: bulk X-Mailing-List: fsverity@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 146054090b085 introduced fs-verity support for btrfs, but didn't add support for FS_IOC_READ_VERITY_METADATA to directly query the Merkle tree, descriptor and signature blocks for fs-verity enabled files. Add the (trival) implementation: we just need to wire it through to the fs-verity code, the same way as is done in the other two filesystems which support this ioctl (ext4, f2fs). The fs-verity code already has access to the required data. Signed-off-by: Allison Karlitskaya --- fs/btrfs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c9302d193187..392322a70ce8 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -5290,6 +5290,8 @@ long btrfs_ioctl(struct file *file, unsigned int return fsverity_ioctl_enable(file, (const void __user *)argp); case FS_IOC_MEASURE_VERITY: return fsverity_ioctl_measure(file, argp); + case FS_IOC_READ_VERITY_METADATA: + return fsverity_ioctl_read_metadata(file, argp); case BTRFS_IOC_ENCODED_READ: return btrfs_ioctl_encoded_read(file, argp, false); case BTRFS_IOC_ENCODED_WRITE: