From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 518153BED44 for ; Thu, 2 Apr 2026 11:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775127987; cv=none; b=EgLqdRvSdp0dhsBiwK19FGWJ9r0K98Vhx63wjbKvEQGIyKzLAzfcTF0uBXiLSgpEOQ+Pp1uhjSEwY+IrzuZQMzkz4tn4kldWiKBTQJRFff1/HNEMu6PmiMpKAc/cxzwo4d1nt2N1+11CzrWGwiOjzbLlZ25Nsh9VXvlbP+hs6m4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775127987; c=relaxed/simple; bh=tsBXonxD8VPFQ/seZUZthS5OGTJWUNF8u5V2lMIyKs4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AqC66igui31PkNVl3DXK9ngxK2lK/KraeJ7Zxfx/o1GKKXTRcbrFXcavAWrUrgaLVCkSYfE2aaJTKmn0ynzmfbICe2PWUNmObt4AmfzR+tMR9R5MyYNKNDfmCMkQYjrn4vyNAqPND6fl2IkwO/fy4KOP3k7MO7IphUXO6kFl0dE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mepq+1tw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mepq+1tw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5D28C116C6; Thu, 2 Apr 2026 11:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775127986; bh=tsBXonxD8VPFQ/seZUZthS5OGTJWUNF8u5V2lMIyKs4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mepq+1tw4dehbvThxacvebLDkSLxeMiLdGmS5dsQIQZ/di9vk5nOtxBo9cPlgkb1y 8zIzszO1DyPVyuMmPlk1AqyDfADbPFThwF908JdOGKd/XEFFuq18b4m4T2mUrKS9oD kSGIYkyLxsy9IVqq5m607wnc4AQImMAl1DzOt3Q44Zvyeqcb+oWvC2UwKJG0SgQC8j Ls7p6Y/XL8BoPe2x6XlZMIin7z6/PtYOoOaaijmw2GAWp8wbAAMdGvboIlXI0Nn9BV Jc8UCj8RNZdWhUqOUtIki9hdOkom66bJ/aeXJqJUe31Wa6rwUKkHY31D2VjctzkfJe UWO1WX1qxGTrA== From: Pratyush Yadav To: Chenghao Duan Cc: pasha.tatashin@soleen.com, rppt@kernel.org, pratyush@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, jianghaoran@kylinos.cn Subject: Re: [PATCH v3 5/7] mm/memfd_luo: fix physical address conversion in put_folios cleanup In-Reply-To: <20260326084727.118437-6-duanchenghao@kylinos.cn> (Chenghao Duan's message of "Thu, 26 Mar 2026 16:47:25 +0800") References: <20260326084727.118437-1-duanchenghao@kylinos.cn> <20260326084727.118437-6-duanchenghao@kylinos.cn> Date: Thu, 02 Apr 2026 11:06:23 +0000 Message-ID: <2vxz4ilthb9s.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Thu, Mar 26 2026, Chenghao Duan wrote: > In memfd_luo_retrieve_folios()'s put_folios cleanup path: > > 1. kho_restore_folio() expects a phys_addr_t (physical address) but > receives a raw PFN (pfolio->pfn). This causes kho_restore_page() to > check the wrong physical address (pfn << PAGE_SHIFT instead of the > actual physical address). > > 2. This loop lacks the !pfolio->pfn check that exists in the main > retrieval loop and memfd_luo_discard_folios(), which could > incorrectly process sparse file holes where pfn=0. > > Fix by converting PFN to physical address with PFN_PHYS() and adding > the !pfolio->pfn check, matching the pattern used elsewhere in this file. > > This issue was identified by the AI review. > https://sashiko.dev/#/patchset/20260323110747.193569-1-duanchenghao@kylinos.cn > > Signed-off-by: Chenghao Duan Reviewed-by: Pratyush Yadav Andrew, can you please add: Fixes: b3749f174d68 ("mm: memfd_luo: allow preserving memfd") Cc: stable@vger.kernel.org [...] -- Regards, Pratyush Yadav