From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.193 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796437286; b=VfxUp7pKEZDWS382qn2RadJuazYXR6f2AB9642qy7MCWeMR5y+t4YIBkJR9VCagOL+As 5NtyNltHw7u5QL4k8g4Ah8gedufNWW9Jh4Qij0HT0uSPAV2m6CRNjFwxi/uPUqogdGgSW u6/4qYrD0B8072xJt6m0lsdlv6ks/acofxbQpDG1OF76xj64/b6V1yN/3jJrW2fbos6vA 8q0DXihoFADUIJSP6MxaXy+vmk9lmXfAC8niUpGlkheMVIZKUmxWV46kBBlYe8T9iyF2D oO85a0LdSj0fd1bbjTBayt2RNehuY033nbv1dFtWwpLnS2WaJHxKYRV5t5PPTh/jTsg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796437286; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=VR0XAYrfDxKA7e/SrQ0DBIo7TRr1djCG5AdLvIaATK4=; b=tmGt0N/aAY2xSW+b2okVlZxF2fqyn+/vnFtmver8QpQb6D7eI9lUYoxxqnHGULyDhoQ2 yN/PKRQQBWnAuM55mGGldn/z0ocj1oG/mWk0bqfAWmPHBY1U7hyeF8oHpiTw18yeaxwOY SifFoeg0B6O8lLhAeiGSL9gpznmFfHzX0SYdx4omcGyYwtA0wyxWqKbqTbtgvn7CUVghF U9qLnM4nPuFK3I2PpwUNarLlIEvDFL1di39/ufK2yjkTbaq+QO7Qj9EyGGaxjnuR6Dlcr 7JKk4FcWKtzsxoNGyQNX0CQ3B6ZJJXKt7i7a0n5aTNqiYuqEvSusrh/6XTAHFODOryg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="Np5Fwe/F"; arc=none smtp.remote-ip=74.125.82.193 Received: from mail-dy1-f193.google.com (mail-dy1-f193.google.com [74.125.82.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0FA66606A32D for ; Sat, 5 Dec 2026 02:21:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0FA66606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Np5Fwe/F Received: by mail-dy1-f193.google.com with SMTP id 5a478bee46e88-3869f03af6aso1953966eec.1 for ; Fri, 04 Dec 2026 18:21:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796437285; x=1797042085; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=VR0XAYrfDxKA7e/SrQ0DBIo7TRr1djCG5AdLvIaATK4=; b=Np5Fwe/FnqrUsiat4e044jULjmvyhRV9bOgQRJQcoW6ddENRDwljGixJcq5L9G264t 2rgLu6/238IkhzEF1kECdC0Ej/gyfrd2ZGq3vEjKxHWawlvOYuWXXhNG1MVoygMD0TVX 6PduAm06jkt7Zvk4/bmr/eBun+uWRSxcr7tXVlxhmAKLRI07a17yE+SxR38RGKlxAa/n KQHH4qsZlcV+8tV+Kdkbl7j6oBsZLOk+j3FmVJ0D3nV/D3QDRFk28UGXa4uJjKv4P630 lkS0vuVK1Gdrwhm2ux71vtftpyV7mS7sDLq0anG/D7pfarFDzntWDpJuicACXiXG4wxn muog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796437285; x=1797042085; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=VR0XAYrfDxKA7e/SrQ0DBIo7TRr1djCG5AdLvIaATK4=; b=o2VKCUS3Mz/BsBQWGmijDTc9yQZL1Eudg82zW7+N7KbB4K2dLBSWmxc3h0SG8g2NHy Bm07XXCbAiWA7DH2y+7FglUYZkoCmjS0i6VoMIqeFZXIj7wlIBPm5xPV2/A128jxAyNo /5UajsPjJRLvKs3ycKyKqrmblxFQR7SW6QpMxtILqSZI00h2ck1mNJBgOn9wGBpBeHs6 7TkMNVgzdGoBkrIvEW7FuBTogcrJTADZefiuOYPwGy3/nmDt+l5l4RCfBe45FXFc17SX 9EFl8tERzvHYGP5rMgGB9Ly7y6AcDGcaPwYEcZ2lmS2yrA7uxsxNuqrFTPh34r6+NBdC PpxQ== X-Forwarded-Encrypted: i=1; AL+hErHA2vcdN/ZKN5Qr5oQa4xxcP/yUTYR0z9b1j6aVm6xD+rKUNzMvNYv2XViprVOCEeDe/NqY0EUIiQ/vt8Q=@vger.kernel.org X-Gm-Message-State: AB4q+uFNTaA5iJjpSDZ7VL94wqZSBKYFXc6S5UgBZ3rdZ3ykOneUKnjh zWy8FyqZpAzi6m83K/SmAAZ7x2rbABp0HJ3aUuMi9PzrT9QWOd2ZnSQB X-Gm-Gg: AZFdTZfsad0YTVOIFDR/7q2PuJ0+y+oITObv16rnUHLeCcqQ0GolRDkQOTR4cC42gny w2//fAc1ZN03qAOzzUCiLHI8iH46pyO2VQKyckAHnyIJNvdvpKSOEKDgti5YSFKpzHW7b/crOVf ojW9YUqFZ1rickUa4RrgDMPCxKSShJjYsIb4hfz+XF8Rlf0MsKxsD0pPSzecJh3N3kwKFRDd1j0 yqHZbetwUOzxfGcebmiDgyofz2makKl1L0VGjQQvIZVx5yAno9+m1kVCWNBtzitNOBoyVrffzS3 z1szKanIRhPKyZZq7rdv17Ez7psGN5kGhhQLHxlsbedAyx1c8szk7I5xXl7fHOYeETcOrEHAbJQ o3M1eriWO4yM8kMU+6wN62ya7bpk5czSwqX10VaBqRRlgHTaiwxXTNXeCaHja2eWSXYTXiXNNJK hEki/U0yddAHAqzjitX2T8egrhl7Yadj9bJ91q2fL6EjZoVbbEilIwdFHtVR7/HLFLf0FKF9AJQ HRhaNIYVtESJOWDTtvJgs7fHd/T0DPVvjibI1kOCtHHbIIKy6aDunrLvk1PRwxy7BTL3gVk/5La 6lnPrF354o9/CA8xQgKGsCMSyQAA3GABoG+h+U+1CdSfQrWGghbX4Zyf0disRLuu64Our0Bomvu OIos4lvD3QNRX1qHCmvRhLZCwZyQV4KHSE5wFcHqK X-Received: by 2002:a05:693c:8212:b0:386:a75c:4a78 with SMTP id 5a478bee46e88-38742d6a693mr6764269eec.15.1796437284951; Fri, 04 Dec 2026 18:21:24 -0800 (PST) Received: from localhost.localdomain ([76.33.234.50]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521c17a3sm15373886eec.11.2026.12.04.18.21.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 18:21:24 -0800 (PST) From: Hungyu Lin To: jaegeuk@kernel.org, chao@kernel.org Cc: lizhijun3@xiaomi.com, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, dennylin0707@gmail.com Subject: [PATCH v2 0/2] f2fs: zero preallocated blocks of pinned files for unprivileged users Date: Sat, 5 Dec 2026 02:21:09 +0000 Message-ID: <20261205022111.49900-1-dennylin0707@gmail.com> X-Mailer: git-send-email 2.43.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit fallocate() on a pinned file hands out blocks without zeroing them, and any user can pin a file, so any user can read back data of files that other users have deleted. v1 required CAP_SYS_ADMIN for fallocate() on a pinned file. This version zeroes the blocks for callers without CAP_SYS_ADMIN instead, so that they can still preallocate. Patch 1 keeps the pinned log from switching to SSR while checkpoint is disabled. It is a fix on its own, and patch 2 needs it: the blocks are zeroed one section at a time before they are allocated, which relies on the pinned log staying in its section. Patch 2 zeroes the free blocks of the pinning section. f2fs_secure_erase() is not used, as it works on blocks which are already mapped to the file. The blocks are zeroed on the device, so an encrypted pinned file reads them back as the decryption of zeroes. Changes since v1: - Zero the blocks for callers without CAP_SYS_ADMIN instead of refusing fallocate(), as suggested by Chao Yu. They are zeroed before the allocation rather than after it, so that a concurrent read cannot see the old data and the blocks which the file already had are kept. - Add patch 1. v1: https://lore.kernel.org/all/20261108075357.43331-1-dennylin0707@gmail.com/ Hungyu Lin (2): f2fs: fix to avoid pinfile fragment on checkpoint=disable mode f2fs: zero preallocated blocks of pinned files for unprivileged users fs/f2fs/f2fs.h | 1 + fs/f2fs/file.c | 3 +++ fs/f2fs/segment.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) base-commit: 029b14ff22f28fddba992d58a216d30bda45586a -- 2.43.0