From patchwork Thu Jan 20 14:31:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1582155 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=H+OE4F1A; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JflTj5FFRz9sXM for ; Fri, 21 Jan 2022 01:37:29 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1nAYZ2-0005dC-Rg; Thu, 20 Jan 2022 14:37:24 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1nAYZ0-0005d5-R7 for kernel-team@lists.ubuntu.com; Thu, 20 Jan 2022 14:37:22 +0000 Received: from localhost.localdomain (1.general.cascardo.us.vpn [10.172.70.58]) (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 smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id EC86B3F336 for ; Thu, 20 Jan 2022 14:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1642689442; bh=k3IiwKKVJulTIADZXQCyibRi0cu8dkUhjtrdK1/BDiQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=H+OE4F1ALQuEfqApx7TixxtAvRYTekKs0sl6coebn49Z7p366d2rDt3vcS6e9/6wA QdFs4fqGGN/l8i0OqLqak0liKLr+bB3Kgfe0hijmFBexpVPqiiFhTjfStYoVIm1fTC GpoOpa43QNACFHkXj+zXrid8lLbLmDPcbiEOP1/g9x/kAkW+yMOl9Uq3Pu2lTacSiU qFKHyYN5aaq2jy2lvfjZ9Y4sH0jZiHZq21jr5WFBhjP99doVU0wRjb9EtbtOF1m1WE EdioHoXVhXZD/5pj1rnQLEqRZsiLksMrMDkaWTtOqvegsskSzi+fHbqmlq+BqcMF+a QN7zz7mUZPlcA== From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [SRU Impish, Hirsute, HWE-5.11, OEM-5.10] xfs: map unwritten blocks in XFS_IOC_{ALLOC, FREE}SP just like fallocate Date: Thu, 20 Jan 2022 11:31:28 -0300 Message-Id: <20220120143129.118237-2-cascardo@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220120143129.118237-1-cascardo@canonical.com> References: <20220120143129.118237-1-cascardo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: "Darrick J. Wong" The old ALLOCSP/FREESP ioctls in XFS can be used to preallocate space at the end of files, just like fallocate and RESVSP. Make the behavior consistent with the other ioctls. Reported-by: Kirill Tkhai Signed-off-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Reviewed-by: Eric Sandeen (cherry picked from commit 983d8e60f50806f90534cc5373d0ce867e5aaf79) CVE-2021-4155 Signed-off-by: Thadeu Lima de Souza Cascardo --- fs/xfs/xfs_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 1fe4c1fc0aea..feebc9c2c2aa 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -687,7 +687,8 @@ xfs_ioc_space( if (bf->l_start > XFS_ISIZE(ip)) { error = xfs_alloc_file_space(ip, XFS_ISIZE(ip), - bf->l_start - XFS_ISIZE(ip), 0); + bf->l_start - XFS_ISIZE(ip), + XFS_BMAPI_PREALLOC); if (error) goto out_unlock; }