From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 4259D409624 for ; Thu, 16 Jul 2026 10:20:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784197213; cv=none; b=ULmg9QBJUPhllKo+EwBzncNH22njZmBaXaXVxXX08kKQNtJBdfED9+8RRWryMD0z12KoyDx3CYZk8pE3rDQkT+4Hv2LvL+KU568skb9ZKSrERIQrqGor2h/Zx6gDLQPw4S45SkfNAhuqX4OWgzBDys9aAUzUKXpAsEDzMJL0RNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784197213; c=relaxed/simple; bh=hPajYToChXHmmsnIQqNBjP2ZbXJsgnS8L+SUazQ6Jac=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uhrlSpTA/L2t3hrHNEA0nOEi814bk5Q+O15G+13fm5ncLp+j9OBxVVzirOqQMIUzt0CK+zFzl1k3dPBC1S2rnpo/OrLTHhg5mffxIgAz/Og2TeNT2S8wGffk8O09I+qgs0eheKpz7dTXphWcGsuutwAePDGsPTqxagmVsUQzAh0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ga5SgRPx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ga5SgRPx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BED41F000E9; Thu, 16 Jul 2026 10:20:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784197211; bh=vgyrL5JBRK3YnhPC8j7kzqE9gJIcaaze0qv3DmUN1oY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Ga5SgRPxQL2h4GYR/O/ZoFbcsjKNk5hTcFNlc1fZqcCxdowYl8gGI+1NzdMxAb8aT kQ7+//++Tv/abFHCjLltL+gAjmpAe1RabXfKDqrp8Yt1IqxuUTD2UX4m5hqfNAZuV0 7drtbRTOnhzcNw3+qMhrf9TXZ8b3mxMPAt5q/Shv4rEfZaRxgIt9+iqstgvoVsoHBz He+mqYHDsko9vNZh/kGko74lKtyqFJMc86xe8bjdMg5CO+DGq36KDzvdOrjP4RHQO1 zOP+egR0BBcXc0O8YiXCXt5ULcP9devn56qW8OJGSij535qUo/doncmHJIM30PTbKB y5g6TDIX44kcA== Date: Thu, 16 Jul 2026 11:19:58 +0100 From: "Lorenzo Stoakes (ARM)" To: Hongfu Li Cc: akpm@linux-foundation.org, liam@infradead.org, vbabka@kernel.org, jannh@google.com, pfalcato@suse.de, david@kernel.org, jeffxu@chromium.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hongfu Li Subject: Re: [PATCH] mm/mseal: Fix range_contains_unmapped() ignoring its mm argument Message-ID: References: <20260716093347.75055-1-hongfu.li@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260716093347.75055-1-hongfu.li@linux.dev> On Thu, Jul 16, 2026 at 05:33:47PM +0800, Hongfu Li wrote: > From: Hongfu Li > > range_contains_unmapped() accepts an explicit struct mm_struct *mm > argument, yet hardcodes current->mm inside VMA_ITERATOR(), ignoring > the passed address space. > > Its only caller do_mseal() currently passes current->mm, so the bug > does not manifest right now. However this mismatch between prototype > and implementation is a latent bug. > > Replace current->mm with the passed mm parameter to match the > function prototype. > > Fixes: 530e09096413 ("mm/mseal: simplify and rename VMA gap check") There's no point in a Fixes tag for something that's not a bug. > Signed-off-by: Hongfu Li > --- > mm/mseal.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/mseal.c b/mm/mseal.c > index 9781647483d1..8d82e50900ba 100644 > --- a/mm/mseal.c > +++ b/mm/mseal.c > @@ -41,7 +41,7 @@ static bool range_contains_unmapped(struct mm_struct *mm, > { > struct vm_area_struct *vma; > unsigned long prev_end = start; > - VMA_ITERATOR(vmi, current->mm, start); > + VMA_ITERATOR(vmi, mm, start); We're never going to sensibly allow a remote mm here, and even suggesting so is problematic. Sorry but I think it's just easier if I send a broader cleanup patch to fix things up here more clearly. > > for_each_vma_range(vmi, vma, end) { > if (vma->vm_start > prev_end) > -- > 2.54.0 > Thanks, Lorenzo