From patchwork Mon Jan 13 13:15:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 13937332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 035ADE7719F for ; Mon, 13 Jan 2025 13:17:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 874246B009E; Mon, 13 Jan 2025 08:17:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CAE66B009F; Mon, 13 Jan 2025 08:17:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64DC06B00A0; Mon, 13 Jan 2025 08:17:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 456B36B009D for ; Mon, 13 Jan 2025 08:17:15 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id F1F66160213 for ; Mon, 13 Jan 2025 13:17:14 +0000 (UTC) X-FDA: 83002479588.22.5CCBE72 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf11.hostedemail.com (Postfix) with ESMTP id 1705540010 for ; Mon, 13 Jan 2025 13:17:12 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=fGH5LhPL; dkim=pass header.d=linutronix.de header.s=2020e header.b="Wh/rLWoy"; spf=pass (imf11.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736774233; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=nXUVqotOwksrgtObQJbhIdeITzwigDuITzq7I8OaDiY=; b=rtWWN72s4xSzgCepRzEI7aFVRXr7rZejrP94iKDvZ7Y1Pb6ZVyAwwQ/bHrmu7XnMCnsCZ4 L4yBP6zZ2mATkF3+TEfBXlaS5obiyZ3lFTm8xu3UpI/ec0ygnQmHCnrirPyZJty3Qeossl uOvD/8aB78zKDTx5KHaSCN2/50N5Hv8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736774233; a=rsa-sha256; cv=none; b=QL6BuAYOytdK/r9RMWzexru2WWlJIGnmFxV2i6+XowMZpqhkrHxZqPt/4L5vw63FNiO9Hw FEpylIwHfIl45VEYRkwWeq24EIGmXKkI6GFXbYbYoKnS3b9XKh8lTVuciK6xl/EEM9Q/qu Gc/a1fjFZ458qP266qYoRCsd8qRutxw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=fGH5LhPL; dkim=pass header.d=linutronix.de header.s=2020e header.b="Wh/rLWoy"; spf=pass (imf11.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1736774231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nXUVqotOwksrgtObQJbhIdeITzwigDuITzq7I8OaDiY=; b=fGH5LhPLbxJ0Iq+16N4pLYnNpVcIgofwYRD98RxBnRtYphMiJYKJuxlo1Hrg5uSOnvUeTM 9TrylLx4K+iB3rfsM6cE4LDqeiAoBytxVU1DjS0n1z9WvGj9+n/HWJCRj73IssfsyQMV4Q x0VHxyDz5DyQoZs5jWQWWylXpeWmvIC4HCPtiJyZWLId4kr0CoIJJszHLddy64W53jnCF8 ilcGOuSn82g147LQS7zKjULC+bOYyJBm7RpscqMhvE7rM79v3WQ6HPI/G1eiIAsUoLX9kq Us3T2QpUeTpkg11IRKLQOQ5k//TTyt6RdD+PoHXq7WmfvEKFCCjqM16A7aKq3g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736774231; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nXUVqotOwksrgtObQJbhIdeITzwigDuITzq7I8OaDiY=; b=Wh/rLWoySnbsESvYzcaLXyIcCBn9BBgs0DqghRiOoH2KXlfHzzAVZWYpATDDTQBV9Tf4xW DONDrWrWceEu0SAg== Date: Mon, 13 Jan 2025 14:15:35 +0100 Subject: [PATCH v3 1/4] selftests/mm: virtual_address_range: mmap() without PROT_WRITE MIME-Version: 1.0 Message-Id: <20250113-virtual_address_range-tests-v3-1-f4a8e6b7feed@linutronix.de> References: <20250113-virtual_address_range-tests-v3-0-f4a8e6b7feed@linutronix.de> In-Reply-To: <20250113-virtual_address_range-tests-v3-0-f4a8e6b7feed@linutronix.de> To: Andrew Morton , Shuah Khan , Dev Jain , Thomas Gleixner , David Hildenbrand Cc: linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1736774229; l=1698; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=cUBEfQwiMoC+IN0PqoM+iEVxivVSJV0lgRrH9DVIFOs=; b=XD9wdAETA3CT+EKMf87OQ9yWUi7VjDLtiEEwegZyI5XtmEZYGy8kMRXOBy4T1pXRpbRFmtcRp tHC2yAZ4j+XDY3smjIklkGtqgVOg08vf//ARADirDthzh7UIJGJiRx6 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= X-Rspamd-Queue-Id: 1705540010 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: n7auyc8bij53w6h8nfxk4uqrwrj6eiuc X-HE-Tag: 1736774232-613072 X-HE-Meta: U2FsdGVkX18v6AaGlYOujup+GW5fo1nUceOODGsAcTy9HYu39dpfzI2ZnkeZKTvFeVY6C8ERdK/ivzfSRcRywXFKNca/WdogrOVu+FpQljjc2ut2IDAubcpNazwr0+CM6qH+hj33xlRpeMZqkFFshmqKN67YAbXiw/QfPN67leDRNfeqURAAQFRiBz+QuBhGPLLZwNU8+DnCMrukVvCW+ZqupiJpp1gNYQeeaBlYhE2/5SxV1/bsrCjvP/e6bPI/wpdN305plhcmcvqRxo8Bh3thjYhmDACc/YEE0uBqK/xuXoHUFyz8mXJfgjLu+7Va0cRZOYnB+3oEETEjNwrdac9dB3SjZHtMbD3JMSqg6hLz7UIqc1y1IDrZkqYLFw1YeE1lb222C1U/8VJQjmEr9GBYxY03DjOSAShfWRR+8GVJOgWN67TX3iJUhq70Z6xTi5i0qP4+BgWVvmnsmTwzlTdb1vqbCrVLTVwovLc06WeI4XxWN8nmxaUQPGT8bfEalg3H+V2Us1gThVjP2qnVy3pv+DO2ngfCRXxqsoN1Lj6KZEO7ebv9l1oqJln/w8Hw3qP22OKBBjO9wyT9gnh0q+igYm7BfEokhPI0fwqXT51AMUGICVPpOx3K8GNvUOGE7tHPuzFQGv58RVE5sHLAP4ZlvKM8CqxYr9Icye515INScPoG57xapu0NDOMU2G4WVqjvhs+iMaVIOWnAoS1AeASJG3jeiEOtV9uozyAievekUj9Bar23/bs6ULpEGZp226coIAudR8BJDbWspraF9RPULetbvbxcG/6joi9lI4I0SZWuITCtuKF8ibDcxlfKZloDMA8bCHOp7wxp0B4Oxu5888Sx7FKsLS3MYPjsMSyaUbcKDcypHFzqkp2TVc2RsSxSXFlbV/bXpeJKsqOiNNlc5EZCEeoCk//jmvdjjPdErITLJFRWNTyXC5ZolWzbWZHdhNwJeMKvHi9VzOY ru6mUVCw yX7fvyI/Lff+SCMg2fjiJsxvltMbvmG4ZmX3Dms7llHNxkkbJM7WQoMEFXgD/7FvoqI9/PdN0O1nWA9FSbtKuiXwwpLX0q4ZEiCbsSKhpVyZYeNZf0qr0pJu8A7I4CGQSfDAFOHz9ysGRqwgJ+nZM4MY7OUBPSuI2VODQfZmOTUVsJqRT1j2pHUCO2kQyeGHQ4JkBJm6RF2zCVZbs5Y6JZTbKOsGrpIOBz1MKSGCJcpoaOwscFcyLYkmEVxk4KHSZkY1fFeKUJJmccY2EqVR7KnrA47UjKfuApnobp15KkI4s/hsec6s4J/Xpc0c+2lVjRI+dyu773DXetp7O+lfNrF2NgInQQaiAY6YjTzGNFgfu8QKYaliqQlFCIRLaC/CQSNKmuVSEm7rpV6qFo2XFdd6KDI8sTGjg1iHNEYssNReLnQF5gZ2/pmoJzaNtnS6CQWcq/f8O6nTtbXzUvn8TvRTv77ELt8m68DcZv8PCy/tLO9CRgdXOgYEpcwYDiYL4KGTMtVJl5wpgaiqMnX66e9sadw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: When mapping a larger chunk than physical memory is available with PROT_WRITE and overcommit is disabled, the mapping will fail. This will prevent the test from running on systems with less then ~1GiB of memory and triggering an inscrutinable test failure. As the mappings are never written to anyways, the flag can be removed. Fixes: 010409649885 ("selftests/mm: confirm VA exhaustion without reliance on correctness of mmap()") Signed-off-by: Thomas Weißschuh Acked-by: David Hildenbrand Acked-by: Dev Jain --- tools/testing/selftests/mm/virtual_address_range.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index 2a2b69e91950a37999f606847c9c8328d79890c2..ea6ccf49ef4c552f26317c2a40b09bca1a677f8f 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -166,7 +166,7 @@ int main(int argc, char *argv[]) ksft_set_plan(1); for (i = 0; i < NR_CHUNKS_LOW; i++) { - ptr[i] = mmap(NULL, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE, + ptr[i] = mmap(NULL, MAP_CHUNK_SIZE, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr[i] == MAP_FAILED) { @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) for (i = 0; i < NR_CHUNKS_HIGH; i++) { hint = hint_addr(); - hptr[i] = mmap(hint, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE, + hptr[i] = mmap(hint, MAP_CHUNK_SIZE, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (hptr[i] == MAP_FAILED)