From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795968088; b=OMbZUDq3U064nCWaJBwoa0Um33XRySJJwNs3qeDLGRFTN2ly+VtorbYDM5zTVMB6uZVP oN9sbZP2HBdo/KWhGRhq90wQxvkQKNoKHoM5Tqi7P1HU1eDlzF/NM6TeSyUwlBABvTByO K1IQ8povNRWa4dnIsjmjcmi8UkJj+1t7nq0YS6lSVlaiNX6cc8d2a+lRhUZEljOFQiQpR g8boL47pZxeCiZsqaP4NrboX1lRWYcAkEs1EcQwQ+0bpDCPU8Vsi//1AW56pNO6v020oA qLw0VYxXwB4hoBoGheuMG/TLHqJulJeLeAp0vRPybKU/Bazttk9JjfWj+s61xKsqiug== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795968088; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Z5E1p0flS/CzOycYL1FrYlvIQGhXkzurW4/0KGj9NL0=; b=tLDkkF6EO5e6fgzE9OhLa/G5e9C1KTY56h3tCKnE/2R718tZ9Q2waKw2lYwCPc2wjoHu nzocLQQ++mNZ07vYpMyitggo6UDIu+n6Euta2Semuf8s1jn5Vy/8jvCYUTMbW4gCs0FDR RCWzuQ8CNTEgV82bWjpsRRH2Z1cO6adqItn2m/5CzEzJgmFxA0JVFkwpkt1Q9XkBmD2j+ GM+7KRZxmKSns5VCgQBo7gqWFineG+5iQECni+pETUUeQ1h/BKBE35Fmp52DPlti7pNLV VIhBDqz6GvQtMhcddSrkLqFXOvVgek3FQcG2ToBX1QCrn8F/zPRvpRf682HbqlpJQlQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TS2bk4TW; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0750606A31C for ; Sun, 29 Nov 2026 16:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=TS2bk4TW Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13D3B1F00896; Sun, 29 Nov 2026 16:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795968088; bh=Z5E1p0flS/CzOycYL1FrYlvIQGhXkzurW4/0KGj9NL0=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=TS2bk4TWRcWRJypBLdBC1Dg117oirBl7eF9N+Q48GejpjfbNe3rVs63PY1GymJTpF 8ij7XmhvACbcRXmyOCyhQIDCKLCnK/dTjlgRYw46oV1vyFuRcD4Vt6wlC6vbSs+xlf kbim1UX5K/3iu3V7LJHBqbycfMv1ED8ziKsjUhXuvnHWTdZjJn3rV55GGsZL/dRrGI rhi1U6i9dT23z8cquVY6UOvT68f7QcVf6GEyB6dFUrDFWvCkHoJNWeE1eUyAkTsBTb bHVzzE+LBiCS6M50d0/lIyMbZlm/ZmSDIQwG/WGypEqjFXNGoO4KXWhQ+Csg88lvGE QPLTyaJ1yhuVw== Date: Sun, 29 Nov 2026 18:01:22 +0200 From: Mike Rapoport To: "David Hildenbrand (Arm)" Cc: Jason Gunthorpe , Leon Romanovsky , Andrew Morton , James Bottomley , Hagen Paul Pfeifer , linux-mm@kvack.org, Chris Mason , stable@vger.kernel.org Subject: Re: [PATCH] mm/hmm: refuse secretmem VMAs in hmm_range_fault() Message-ID: References: <20261129-hmm_secretmem-v1-1-113c4f5e18a1@kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261129-hmm_secretmem-v1-1-113c4f5e18a1@kernel.org> On Sun, Nov 29, 2026 at 09:47:02AM +0100, David Hildenbrand (Arm) wrote: > From: Chris Mason > > secretmem folios are removed from the directmap. GUP refuses secretmem Nit: usually direct map is two words :) > VMAs for that reason, but hmm_range_fault() hands out secretmem folios > to drivers. > > Consequently, drivers that are not aware of this might access these > folios through the directmap, resulting in a kernel page fault. For > example, the rxe ODP code accesses the folios through kmap_local_page() > when copying data or performing atomic operations on a memory region. > > Let's fix it by refusing secretmem VMAs in hmm_range_fault(), just like > GUP does. > > This has low urgency, as it requires registering secretmem with a driver > that uses hmm_range_fault(), such as rxe ODP. > > Fixes: 1507f51255c9 ("mm: introduce memfd_secret system call to create "secret" memory areas") > Cc: stable@vger.kernel.org > Signed-off-by: Chris Mason > [ david: adjust description and comment ] > Signed-off-by: David Hildenbrand (Arm) > --- > On top of akpm/mm-unstable. > > @@ -611,6 +612,9 @@ static int hmm_vma_walk_test(unsigned long start, unsigned long end, > * > * Devices must not gain ordinary write access to shadow stacks. > * > + * secretmem folios have no directmap and drivers are not aware of Ditto. I believe Andrew can fix it up while applying. Reviewed-by: Mike Rapoport (Microsoft) > + * that; refuse such mappings, just like GUP does. > + * > * If a fault is requested for an unsupported range then it is a hard > * failure. > */ -- Sincerely yours, Mike.