From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.146 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793786167; b=agUdFJRqIJdkzDPeiNvWe3+NiSM+6VoXel87Nyn+L7JSOAlplex43skfASvUke1Y1QMY vcG18JLlcfye+Vnsq8BoSlzKIm2n9BIYKOACgDhij32JBfpwCcHbpfoAZyCLCbLeiBRUi I7F+BkVfofC42KnU4KeEl1oR+o01HWF3Xe5EmJ+7kOQJc6Gi8HGh57ojEDQEvCf+NlH+o nDdHBYh235FEU7r3ieW0OqzdlRvmxWnsIiASwA5dgDqXN+Ll8Sag5Coe/i3q4RZdPvlmq RMu3ypa/C9r95zoHxCbqp2NYfN6gRiaU0dRnEfU3WCuuU6Q+WoqPfpqs8p/sJ9fTtww== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793786167; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Content-Type:Mime-Version:Subject:From: In-Reply-To:Date:Cc:Content-Transfer-Encoding:Message-Id:References: To:X-Mailer; bh=pUBQPp4DgGesu/zc45i1HHgbshamqgArN5rt8GOl5tk=; b=2R1dt5Z28DdPGu+2Rj6mBKRcZFrih1pGhAYuM4fKiWEK4xuj6yjNwQy3dkEUYCvfLB3w HBsQN34pD50pEK1KnKgGDloD9Chjbn6WHUFeZqgnMFx8KTy6yrlOCXQNVTT697sFjhv6s BGXCahdkbWlGCTSKZ9wR/rRHTHxKFeOEPB2mK9Jzw0dke6ah2hD8dUrc2WJVM86WQXECw k+AEvYcLnr5gZBVtGg1drMzE83GPNQT5cKQIvAFERhEdqz2IepX+SL8eVdkwFOmHlPH0N 0cTiKcgaC/EXZAk2Yxj+gB8mo+UUKdAmHYHx/3NGq0Cv0TZIQ+BWBltXT39QQHaWT7A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; arc=none smtp.remote-ip=95.215.58.146 Received: from mta1.migadu.com (out-146.mta1.migadu.com [95.215.58.146]) (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 91235606A32F for ; Wed, 4 Nov 2026 09:56:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 91235606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=pUBQPp4DgGesu/zc45i1HHgbshamqgArN5rt8GOl5tk=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1793786163; v=1; x=1794390963; b=uUMXzD5u9LbfomWLcrC2JIgPQCBBTO3LbzHp+2JUyWLJ6xQdE2ZY1BMAOjdbQnBuSYP1qFjF 1kVjlex4v2hhEIm4aXGxezQoohio+Baq+fuznIdzLaWT6CPUvg34hb8PWHYCrHxsPlWU02MiA01 gVFlQhnLVU61YtHNeRs2gfcA= X-Envelope-To: linux-kernel@vger.kernel.org Received: by mta12.migadu.com with ESMTPS id c43ff3afd577f723; Wed, 04 Nov 2026 09:56:02 +0000 X-Mizu-Trace-ID: c43ff3afd577f723 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=us-ascii 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 (Mac OS X Mail 16.0 \(3901.200.71.1.16\)) Subject: Re: [PATCH 11/15] hugetlbfs: do not grow a sealed file in mmap() From: Muchun Song In-Reply-To: <20261028-fixes_hugetlb-v1-11-a0a033db180f@kernel.org> Date: Wed, 4 Nov 2026 17:55:32 +0800 Cc: Oscar Salvador , Naoya Horiguchi , Andrew Morton , Mel Gorman , Andy Whitcroft , Miaohe Lin , Michal Hocko , Rik van Riel , Hugh Dickins , Baolin Wang , Vivek Kasireddy , Dave Airlie , Jason Gunthorpe , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Jonathan Corbet , Shuah Khan , Randy Dunlap , Peter Xu , Breno Leitao , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Arnd Bergmann , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Gerd Hoffmann , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Chris Mason , stable@kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <140D6576-3DB1-464D-8934-6857B84EA784@linux.dev> References: <20261028-fixes_hugetlb-v1-0-a0a033db180f@kernel.org> <20261028-fixes_hugetlb-v1-11-a0a033db180f@kernel.org> To: "David Hildenbrand (Arm)" X-Mailer: Apple Mail (2.3901.200.71.1.16) > On Oct 29, 2026, at 04:13, David Hildenbrand (Arm) = wrote: >=20 > From: Chris Mason >=20 > hugetlbfs_file_mmap() grows a file when a writable mapping extends = beyond > EOF. We are missing seal checks similar to hugetlbfs_setattr() and > hugetlbfs_fallocate(), allowing a user to grow a file that has = F_SEAL_GROW > set. >=20 > To fix it, skip the resize when F_SEAL_GROW is set; mmap() still = succeeds > without growing the file. >=20 > We currently also allow CoW mappings to grow a file. Disallowing this, > maybe even only for read-only file descriptors, could break existing > userspace, so we have to be more careful. QEMU's file backend is an > example user that might rely on such things, and would suddenly start > getting SIGBUS when faulting in memory outside EOF. >=20 > So be careful and focus on F_SEAL_GROW for now. >=20 > Fix generated by an LLM and sent by Chris Mason in private. >=20 > Fixes: ff62a3421044 ("hugetlb: implement memfd sealing") > Cc: stable@kernel.org > Signed-off-by: Chris Mason > [ david: drop comment; simplify+extend description ] > Signed-off-by: David Hildenbrand (Arm) Acked-by: Muchun Song Thanks.