Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5189120rdb; Sat, 16 Sep 2023 06:37:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGVUv89kRS7SSlccZcS705uMl3ZCr//zoyxbDCtgtYQLpqI4DpiIxgySYjDDEupbZlQSUie X-Received: by 2002:a17:90a:31c9:b0:274:8be8:f767 with SMTP id j9-20020a17090a31c900b002748be8f767mr3575759pjf.15.1694871448965; Sat, 16 Sep 2023 06:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694871448; cv=none; d=google.com; s=arc-20160816; b=s4WmnAc2EwJR6XskaMLufDYQf/MAG9e9PY4aICZi7nS1vC2ZSMBFulrl67E+IMUCF8 N+KQ1XQ48jQ06hFQXCFTt+24XH/KPEjolrO3JpQQ78ITm7tBnRraOk/Hd3jh7PgaIIcV EFQU+qrzSSETElCVTwJP0k9/f8iC9DtQp2dVXLmROGWVHHHOuHyZ28GaN5aTZM+a+SbB 8pifyaq7T3MJa1aXld8uqTPG3Bs3sYyga4/q07olltjXTXXUvZTEXSkqYz1ryIcog5H4 hkgCVnllpHfyLVvfANVDiZTfEWUebn8sd92UMuuyCQo2MhgIO8tXA8GBrftvI1KEB8vO FYvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=Sg89+tXih0SrhpwCy/YeRQLuBMFVPIf1pS98QJWGnvQ=; fh=PJMzc3Hp2p3Dvzr5TvkhdjVsfQ/xiDeCtVytQiIqKjY=; b=jX2EdKsjtDysUmAmNvzBzZATEmz2N5Bl5LZWeXb+Q5aJA9EbuPmohPLwTJwL6iz94C /T3xHhGT1OJcGcbRmeaHZ/pE6X6Jt4VI4Jqk5378tAssNhvQuJBeRXfI10QDDwXAgAPQ /tLWKDg3pcR9ALePDweYOH/ONniJwfAbgnLqtQgj4YSaRZVqxg0PCEaMnorrF2jmhOqT FW1HTBzch01vM2yc6mLcRorxwBtOSeh3WRFgtmzaBXgbTvs5Pc3e5hMjDTbVZiDTwSC0 etdQ+WtAa2FeTPx2rrrsxJ82npHO+lcssXd4AR4VvIINEz5OozwASNtGrBm0eB6Nefpk XMdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GfkrsQu7; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y15-20020a17090a784f00b002639394cfcdsi5074942pjl.145.2023.09.16.06.37.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 06:37:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=GfkrsQu7; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7A3E083EDDAB; Sat, 16 Sep 2023 04:10:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238371AbjIPKnO (ORCPT + 99 others); Sat, 16 Sep 2023 06:43:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229520AbjIPKmp (ORCPT ); Sat, 16 Sep 2023 06:42:45 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 391E7C7; Sat, 16 Sep 2023 03:42:40 -0700 (PDT) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38GAd7iI030767; Sat, 16 Sep 2023 10:42:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : content-transfer-encoding : mime-version; s=pp1; bh=Sg89+tXih0SrhpwCy/YeRQLuBMFVPIf1pS98QJWGnvQ=; b=GfkrsQu7DG3jjE1f7a/rxebuv0n4jEgBwg64s5V6lryL6bzPcIWFbFlF0wUvyYAui5I+ F8NgyOTZXz323DaAa4ecfB5psCI7hSESSryay6q1ygjEmygkafjaiOGYGy67Ccjw6DXx E25fZjIUTmTK+hSAVFoEGUi17J9wQfOIU0Ad57PGldLZphQ6vwuqteLMfX153j+YPD0L ENJ+eUB1fLhIIbLMVZcAxWZT13s6ZGlfEkUOv1MkQQGHblCYVCc0I3NemNKGH/0t79dE ejbo77hKN3T4be1WtEoKBMeTSAF/tp+qFuGfSa/Hj8rGGAOh2hqAnSR73qSUrkhWbg8j 1A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t58b1adpa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Sep 2023 10:42:30 +0000 Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38GAfjiW006090; Sat, 16 Sep 2023 10:42:30 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3t58b1adp5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Sep 2023 10:42:30 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 38GADbQ8011974; Sat, 16 Sep 2023 10:42:29 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3t15r3167e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 16 Sep 2023 10:42:29 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 38GAgRCV61473028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 16 Sep 2023 10:42:27 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AD83520040; Sat, 16 Sep 2023 10:42:27 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B69ED2004B; Sat, 16 Sep 2023 10:42:21 +0000 (GMT) Received: from li-bb2b2a4c-3307-11b2-a85c-8fa5c3a69313.ibm.com.com (unknown [9.43.102.18]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Sat, 16 Sep 2023 10:42:21 +0000 (GMT) From: Ojaswin Mujoo To: linux-ext4@vger.kernel.org, "Theodore Ts'o" Cc: Ritesh Harjani , linux-kernel@vger.kernel.org, Jan Kara Subject: [PATCH v2 0/1] ext4: Fix stale data exposure caused with dioread_nolock Date: Sat, 16 Sep 2023 16:12:12 +0530 Message-Id: X-Mailer: git-send-email 2.39.3 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: bxDIf8gA5RbLCJEhZV0n3_ZI_t1k7YgW X-Proofpoint-GUID: HTIv-RnJgcLpx4F4qYdE6vB4aPtXW703 Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-15_20,2023-09-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 phishscore=0 adultscore=0 spamscore=0 clxscore=1015 bulkscore=0 mlxscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=825 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309160091 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 16 Sep 2023 04:10:44 -0700 (PDT) ** Changes in v2 ** - Moved the logic to mark buffer as new in ext4_get_block_unwritten, as it is actually specific to this function, rather than _ext4_get_block which is a more generic function called from codepaths that dont need this logic - Tested with -g rw,quick as well as custom replication test (present in commit message). No issues with ps == bs as well as sub page size scenarios. - TODO: Add logic in ext4_block_zero_page_range() to ignore zeroing if the buffer is unwritten. This needs some review of the involved code paths hence sending the fix to stale data first right now and will get to this in a new patch. - v1: https://lore.kernel.org/linux-ext4/cover.1693909504.git.ojaswin@linux.ibm.com/ ** Original Cover ** The detailed report on the issues faced and the root cause can be found in the commit message. I've intentionally added all the details to commit message so that it can be tracked in the future, let me know if its too long and I can try stripping some info. For this particular fix, I've tested these patches with xfstests -g quick with: - 64k block size, 64k pagesize - 4k blocksize 64k pagesize - both with and without nodelalloc and I don't see any regressions. I'll plan to run more tests on this and report back if I notice anything. Suggestions or ideas are welcome. Regards, ojaswin Ojaswin Mujoo (1): ext4: Mark buffer new if it is unwritten to avoid stale data exposure fs/ext4/inode.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -- 2.39.3