From patchwork Thu Jan 2 19:04:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Nelissen X-Patchwork-Id: 13924888 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52702E77188 for ; Thu, 2 Jan 2025 19:06:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC8B16B00FB; Thu, 2 Jan 2025 14:06:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D796C6B00FC; Thu, 2 Jan 2025 14:06:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C419F6B00FD; Thu, 2 Jan 2025 14:06:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A488A6B00FB for ; Thu, 2 Jan 2025 14:06:05 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6E3411402A3 for ; Thu, 2 Jan 2025 19:06:05 +0000 (UTC) X-FDA: 82963440378.24.CE1573F Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf27.hostedemail.com (Postfix) with ESMTP id 3F7A34000A for ; Thu, 2 Jan 2025 19:05:09 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=dAU635I7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of marco.nelissen@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=marco.nelissen@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1735844716; a=rsa-sha256; cv=none; b=tN85BsK4B3+FHZYXE4tpqMFojdU0QqAUlJeo+eum6Bdsn1bglEsZPN/adlgDGzUVfLFxW/ KE/tKvfGvnFJIeiTulktiDlK97z4aAxpzuOcmgvEIPpJIC1jwy/qPh3nnoQrEXwPsoGZRQ IJCq/IzqZujIi3JQTFmv9Ykby4HYE0o= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=dAU635I7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of marco.nelissen@gmail.com designates 209.85.214.177 as permitted sender) smtp.mailfrom=marco.nelissen@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1735844716; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=vxuW0cgSEfBWMH2lV5SJSiaf6CcTpbxwJndRWFEJY/4=; b=nsmpv4cPHMPpU65IsYOakAPK5Lo2IpSym/pa5ebpFd8coC71T23M151Dq0eMPSyJX0Qdi8 bAaByfnpVUuY5ogPhw24A7ei/g79UlJzpvLCl9neJYZvfanHhPOFNsoTvUUXU7qGPM47al 7BNcNUUFyA2Yznw/2Uwyk5ZV+MNBFQk= Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-2167141dfa1so155959965ad.1 for ; Thu, 02 Jan 2025 11:06:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735844762; x=1736449562; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vxuW0cgSEfBWMH2lV5SJSiaf6CcTpbxwJndRWFEJY/4=; b=dAU635I7lkzkM6rnAYn6/6Y3ONqpVEDnKeEeY9z1OQKHQ5l2F5kJNBD0vhgyEmt7h9 U2HWdGL/wRoDdBiwYwxbuLgjApO/0DmJFvyLXxiWWlNDI/opmm9QeoEM3wboOhvRf7sL ZCvkSnfVl1no3JzFtd4Dki8bEk6PFcCO86hylgszWI4m5N+EdJg3OaNF989YDNUM92PM MGP2z99MurHeJnUaEjK05e+5KMuMN5EtGeHNNn5LF2tRHz7ghhhNz5pX1ultMiweU9On ybFnPqw03MNe4UNffyIoVDoVHO5b7zwyeNJp7a12HMlMhnciqC6PgmfyGyCJxutrvrh5 VeFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735844762; x=1736449562; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vxuW0cgSEfBWMH2lV5SJSiaf6CcTpbxwJndRWFEJY/4=; b=ALbRNGwffL2935P8a2JeAquqsK1Ath3H/+3iPaG2bV6eVhchGmgZ6MyXYXFZaksZAm mnBGKYM3uK6x7LMAggLwoRtRRvZyv/6OMHyrr9Hk+dYffFHkqSnnMvnTy9mf1IfbiToS Z/57XoRNp0fCMCNTH9zyypZDQliYak4iuGDcUg4RNmJinm/21V0MU3gcIGUrHWctn5Ex Adn0MftQ+A25dgtOxwAKkjP1bYkGRhOMh3sYfF2vYz2GOeg8mYstmf9xOCexDfVVUKuH hf3aK02HmnRFpN+/JDTtyGJMX0yoZtesEqG2v2rcaFe1URmi96x0rkMM/qRDgn+6hmfO /HXQ== X-Forwarded-Encrypted: i=1; AJvYcCUXj1cgcwjHvVrRkKaXkqWNvrBU8lLYG9qHBsuu89gkmgG9A4XPsPTkSV9rJcsNEMeODwsXvF5WtQ==@kvack.org X-Gm-Message-State: AOJu0YyqkLMdu70li/0TxiarsDpIb3uxoTu3yirDkkYItX6Pon7zCXRp RmbvXlT4EpCYmbkpmRRtZuPY3uv4TCWeFKWkPkPRP3HL5yDl2lPr X-Gm-Gg: ASbGncviVLbFC5IylhXs4OT503zEXpNw6pfsDgd3D1sOnVt6fo/7CojEVJ30tlC470N mDmF61AZaC/8l/DAz5OSmJ51DB7IsI1+TMEAqOLOdjW5XvSQd+pFGP2E4uZZQ5gMMY1tkNXy2p0 KG0lRvS0Ilj7rCBlInwJJ4+hBfaX6jOLLjzI8YzvBc4YDp4xi04AoGRStApFrNAJhkpKZ8PwGJC A03N/xGRjbG0E1AyKvvQKIb+JtyzMy33cQBYPYEyowgrHHblrp4nQlr/1XmIM7qQEGaukUB5Evr AitBeovF7D1Gh2cuhMb0zB0= X-Google-Smtp-Source: AGHT+IFgSN9UePaqEwcS7Xh91XACZd/nc8+4GtjpV3DisyOIYhd1B+z+3CyATnEhABGNEeP3/Knj+g== X-Received: by 2002:a17:903:2ac3:b0:215:9eac:1857 with SMTP id d9443c01a7336-219da5b9caemr676513085ad.5.1735844762049; Thu, 02 Jan 2025 11:06:02 -0800 (PST) Received: from perforce2 (75-4-202-173.lightspeed.sntcca.sbcglobal.net. [75.4.202.173]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9cde5bsm231464325ad.116.2025.01.02.11.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jan 2025 11:06:01 -0800 (PST) Received: by perforce2 (sSMTP sendmail emulation); Thu, 02 Jan 2025 11:05:59 -0800 From: Marco Nelissen To: "Matthew Wilcox (Oracle)" , Andrew Morton , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-xfs@vger.kernel.org Cc: Marco Nelissen Subject: [PATCH] filemap: avoid truncating 64-bit offset to 32 bits Date: Thu, 2 Jan 2025 11:04:11 -0800 Message-ID: <20250102190540.1356838-1-marco.nelissen@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 3F7A34000A X-Stat-Signature: jeei33tmbfunnuzj1cke8x916y3ygn7c X-Rspam-User: X-HE-Tag: 1735844709-92238 X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KbX7kCsZlqnH+XAw/yhyEqIGzXu8tu0mSN5dPJG+Qxw7zN5e7UjyXxTXj/MGBh606+TVo1jCkikNrTFnYU8yRNFTml11kiDXWuvlC/QqsPkCUGMXa4ZG19GWKgjUO6bDYS7CRESyM84CtWrVqVO4cJI4uc/Yt9NfpyZX+sDN1oqm9PmnzJkmWTTNx+omKEDPFvv7/ZHZC1Zl93LTcLQyEnvPSsJSwns9zkXLhmascZ/tJL8P146TwRgEb4mwyudlGtF5e76JFLoiansrCQBvIHuH0uhBYi/v66a0SLms02d2sSdaaq/yEhVfgaetaO9+y8UXHxiLoEEaMPN1Y0ijFCLMhe/O/dp9Of2ASwYIZlaURAcl517cBHG8Cz100ROmF2VwPifChZR X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: on 32-bit kernels, folio_seek_hole_data() was inadvertently truncating a 64-bit value to 32 bits, leading to a possible infinite loop when writing to an xfs filesystem. Signed-off-by: Marco Nelissen --- mm/filemap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/filemap.c b/mm/filemap.c index f61cf51c2238..f5c93683dbcf 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3005,7 +3005,7 @@ static inline loff_t folio_seek_hole_data(struct xa_state *xas, if (ops->is_partially_uptodate(folio, offset, bsz) == seek_data) break; - start = (start + bsz) & ~(bsz - 1); + start = (start + bsz) & ~((u64)bsz - 1); offset += bsz; } while (offset < folio_size(folio)); unlock: