Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1356039lqp; Fri, 22 Mar 2024 12:19:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWV9PAw6ES1u+aRpGW2Amy2IHgKaaR1QSJD7Ptw2h1InU6G8DYXe8Bt182NEP0DxKBpCv5F/vylAiAA+jUz5vjK1okmgf6hWs+OfXc7JQ== X-Google-Smtp-Source: AGHT+IEdtjSxnogdQY6b0cEaLQVhYjLmoo0b3vuzWde6pTZU0nYkNZBuT++XBoRluGr0GbodTI+E X-Received: by 2002:ad4:5f8c:0:b0:696:5d5a:4614 with SMTP id jp12-20020ad45f8c000000b006965d5a4614mr276059qvb.38.1711135158577; Fri, 22 Mar 2024 12:19:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711135158; cv=pass; d=google.com; s=arc-20160816; b=oWpbXD+ZCwYmr8EvO39dFfdl76TApPZtFvXVomu3PgmDDN6eZFGsiNUnADrlbd3Lvv XxfKkNmLK0P+wosmz3f7Bv7IDNBad1WSfzGgbjJn4r/ibI58y4t7Od308kgfgpWFJc/t +ahjF1pmPsajU9i0Ak//tdxY5ZA2uKR2s7ZEdCKvjqJVOQZ6dls3VrUNRJLx5SKZxkx0 CTq/mPHJPtz1CcsCuwF8u1e8s1Kc41i6eFkaf0JT0udSBwGCAn5Lviw7pltIaLIS3QOo HaYsHXII/3jY8VvVFttVRh2PLmwKB/b5BeWx/3CLzo+zG9JKLXzGkUHchxVUU8xRQdEU UCgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=YvVGwdIENmNvc+fSSjJevZd89jG5ncO+/fYdRY2m3oU=; fh=Uhsy1YrsOQWZzqCJ9BuDKi+kuPfisR108gbmrR6ZuSY=; b=HXvDcybRyNN+z2HWBSJsMsgwQ/WZp0hnRNXFk9TnJ5UOs+UoH0zjoBsEu/InYFhZ98 SkOH2iuxzwaek7wF4p+ouJxM154GD8zLDVfvfArhKeykqeS0lKP1IqFSVkEI+X0BjUQf pXU4addFDDjjZIugLDrfKfFh8wV7+MxORp32IsJd7Y3deyN4IyhRjLBQFpcwzh6o6dOa Hd3YA6YlPWJWF99gNrt1ixUxSekqHpDcfNvBDaVLxcrLH74Rdxt91+dgrGyEUTjWa/qD 9BcgyRe1a89/5PHeJsLab/dzAIwYzLkq+6GXObxBS7cdbRwvF4xjA1BaIKWIVutQTyde XgSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=g4iiwuWL; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-111985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111985-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o6-20020a0562140e4600b00690b92e28cbsi2536906qvc.278.2024.03.22.12.19.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 12:19:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=g4iiwuWL; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-111985-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111985-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4D9B51C22A49 for ; Fri, 22 Mar 2024 19:19:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ADFA778B5D; Fri, 22 Mar 2024 19:19:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="g4iiwuWL" 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 C450078B4C; Fri, 22 Mar 2024 19:19:13 +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=1711135153; cv=none; b=ZpZs/qRYXRNUXaS0weijh+2YhDiHGbvYgUV74KsvkqQ2N0ur1H0YLKZshWp/rRvHgXhOTZqrcAgheUPCqHDnVk8jH6b9VoDv1WPVkpnEMpbssoXy8johywd16QDJhEInBs5EaVAbUh56FyyXmTjVawI0zyltnkvylmmkwkX55mM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711135153; c=relaxed/simple; bh=UG0sBGKvrAEfQYFFsmXHb+05v3Y/kIQQfgrsER2wBIs=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=OLopPVKZQdhdJ0kKkVNG8z+vLaxIMudnPFqa2rJwanvuj/QFihvbkqW18I1oIxxq6Ouxstnq4y+4WMQguZtT7FRJGraaVzCpgrUPect6fPrfGSdn0AIeBq8pogJAEYKmAgTscMu2J5ozIQUmw2356EV6ZZB3hMpb9iraf2/7lX0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=g4iiwuWL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46402C43390; Fri, 22 Mar 2024 19:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1711135153; bh=UG0sBGKvrAEfQYFFsmXHb+05v3Y/kIQQfgrsER2wBIs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=g4iiwuWLrGSjXEtWYWuaR5z8kdipiKfD/181Dnwfo23bc19dVMarrZMhO3XiNbnCw Xd387VjPuHN2tdpcmDxrzhir90mPqHX/fPx2UuVB0LY3xhTCOQwf2p5L9vUgnK9wIh entr4Pvh6UALQgn42mLEO0GU9gR6yhezMYWXAxQk= Date: Fri, 22 Mar 2024 12:19:12 -0700 From: Andrew Morton To: Dev Jain Cc: shuah@kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Anshuman.Khandual@arm.com Subject: Re: [PATCH] selftests/mm: Confirm VA exhaustion without reliance on correctness of mmap() Message-Id: <20240322121912.3bc9e58cfda1b7c92aac9c4f@linux-foundation.org> In-Reply-To: References: <20240321103522.516097-1-dev.jain@arm.com> <20240321145146.a3ce8a1e247371e33a437978@linux-foundation.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, 22 Mar 2024 10:42:47 +0530 Dev Jain wrote: >=20 > On 3/22/24 03:21, Andrew Morton wrote: > > On Thu, 21 Mar 2024 16:05:22 +0530 Dev Jain wrote: > > > >> Currently, VA exhaustion is being checked by passing a hint to mmap() = and > >> expecting it to fail. This patch makes a stricter test by successful w= rite() > >> calls from /proc/self/maps to a dump file, confirming that a free chun= k is > >> indeed not available. > > What's wrong with the current approach? > While populating the lower VA space, mmap() fails because we have=20 > exhausted the space. >=20 > Then, in validate_lower_address_hint(), because mmap() fails, we confirm= =20 > that we have >=20 > indeed exhausted the space. There is a circular logic involved here. >=20 > Assume that there is a bug in mmap(), also assume that it exists=20 > independent of whether >=20 > you pass a hint address or not; that for some reason it is not able to=20 > find a 1GB chunk. >=20 > My idea is to assert the exhaustion against some other method. Thanks. I added the above to the changelog. >=20 > Also, in the following line in validate_complete_va_space(): >=20 > =A0=A0=A0 =A0=A0=A0 if (start_addr - prev_end_addr >=3D SZ_1GB) >=20 > I made a small error, I forgot to use MAP_CHUNK_SIZE instead of SZ_1GB. And the preceding comment might need an edit. Please send an updated patch?