From patchwork Tue Jan 14 16:06:45 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: 13938945 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 344B4E77188 for ; Tue, 14 Jan 2025 16:07:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD1726B0085; Tue, 14 Jan 2025 11:07:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AA8CC6B0088; Tue, 14 Jan 2025 11:07:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D3D7280001; Tue, 14 Jan 2025 11:07:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6DC106B0085 for ; Tue, 14 Jan 2025 11:07:13 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 1E28FAF963 for ; Tue, 14 Jan 2025 16:07:13 +0000 (UTC) X-FDA: 83006536746.05.3BC6985 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf16.hostedemail.com (Postfix) with ESMTP id 17C0D18000C for ; Tue, 14 Jan 2025 16:07:10 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="qIV/Sqi/"; dkim=pass header.d=linutronix.de header.s=2020e header.b=TODIgtjD; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf16.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736870831; a=rsa-sha256; cv=none; b=hlMvQuVaVI4zv6HrqTXimGKZJMSGqhGFRr6CWy2QGCZA0vfOyTizDL97aCS0a3YgPwwrdU YLHxL1Bj0nUVDwuxtPOv13XFCx8KxYrcRiaO8xLechJHoPpKPjIIV54Enq0+OaCbwFJN3C 4eOx46e8Irgm0dPGw/9HYlqX4WkWdSY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b="qIV/Sqi/"; dkim=pass header.d=linutronix.de header.s=2020e header.b=TODIgtjD; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf16.hostedemail.com: domain of t-8ch@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=t-8ch@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736870831; 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=WMw4Pqpozqcj+M46rlKOQ3x4xAheM6IvB7ridCkcbVk=; b=H96k9eVddUdgKJMOOB1uBEGcPQISmE4KIi6BUWyeWdC8mWdzACpkT1t62aUI/bk41e+7nx bzIRMkWnyDqHXYfn7gZaRrftTiYqsYykmiIsvmZu4/UO7CkznHUsZWNJRmuwS1PpbErG77 gfirxvHIqbusAHFiW9GrZ0TuA2GphF4= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1736870829; 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=WMw4Pqpozqcj+M46rlKOQ3x4xAheM6IvB7ridCkcbVk=; b=qIV/Sqi/Yoks2I8Nqn0d21+mfb/g+17wevTd7eWnB9iPPJgxpq/hvMWR4Cbcrtv3Ad9LKt rpHmgGdMS3mWZSlTBuJIfppw2+TmA0G0hkrFDpuRY0u0rrgAyfhuqS5vNbkM0FfR3Q4Q5k 2OBXZeTyiCU/hzd++lBA+X2QpAVp2fhYJPjpXzNx3JHRKjjoDhZ9rs29ROVEVKzwtF6k+e Yanq0CIZvkDJMrtPKQs0voJpfqzZ3brLHAeaEsr+Wjb/Mef7dzU+WIjQZXrzuS2hR4+HcM WF8mgBXS9+7jYWCODWyklQAvZCyt/2ymxndgYqyMG/hUWGRmV1/US3rFsJqwEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736870829; 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=WMw4Pqpozqcj+M46rlKOQ3x4xAheM6IvB7ridCkcbVk=; b=TODIgtjDbHTyshHRlgReOZN8Eur6i1Ig6fNAmzvJVWuIRBv56dUMgA9GNPCFURWWrKYHmh 1tnnWGa9evG4r7Cg== Date: Tue, 14 Jan 2025 17:06:45 +0100 Subject: [PATCH v4 1/4] selftests/mm: virtual_address_range: mmap() without PROT_WRITE MIME-Version: 1.0 Message-Id: <20250114-virtual_address_range-tests-v4-1-6fd7269934a5@linutronix.de> References: <20250114-virtual_address_range-tests-v4-0-6fd7269934a5@linutronix.de> In-Reply-To: <20250114-virtual_address_range-tests-v4-0-6fd7269934a5@linutronix.de> To: Andrew Morton , Shuah Khan , Dev Jain , Thomas Gleixner , David Hildenbrand , Anshuman Khandual 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=1736870827; l=1679; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=CZpuloUjytwkHL2aPWwv10o9ubxrDZ5i+6K2DZNoL+M=; b=GqgQ3xml2Bf4VP4ld+L2fBtKx7TbedcU6otFZT9oJT34c/htO60k0G8UfJ7KMpb3YK+QdSVhb 7XeerjJ2ST8BpBkEE9OUCb9tJz8Maa+jIEBAF1TCFkRLjAjlZP85Dy1 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= X-Stat-Signature: zyamn6iy1s8jtcuenfbb4rubi1rk1gc3 X-Rspam-User: X-Rspamd-Queue-Id: 17C0D18000C X-Rspamd-Server: rspam08 X-HE-Tag: 1736870830-999262 X-HE-Meta: U2FsdGVkX1/QBUlGv3mI9H+mcUKWfGg0YwtmzejjGFljwsLI8BxkOtXNnbINve6vBZ2iXykgaNMaYu2ctJYFzP/QTA1bMMKySizrbwFE3uVDeCjTkkCPDil3/G69EB0iidut1GhkzAH9o8a655SY/+IZ89BQpqEOvd8OgnPyaoVsdlRx+gPmhTc/UPaaWlFkJVrmMBSfZBmMwXivPkmF4sGIDSABSKJYmC/ZGbyulSUnIh2hYrtD3IYmDdi+xv2cm0BNFz7is7dsDzz6QdorIzSvNXFE9HCV5JgR+T4g20RY9z/LFbxls0v21NuCdR5ZCkJpnP9xMMDTDz8ty1rpyxzEA9V3kPmc/4nfvVt0OzXpJVP0ML3ScpSwF4Z28EMONO4TRmtM1dRveaMe3gbFzuQjBqAkhaxLB4eCUJQnMAipyCb28DL5xIBenWFH7uwf57jsLHE+af1DwqDOiqp3Jo51iBEoDuZgsJQ+G8GDFEKbXSLyPmy4LdIujo7eWRCZdEGo6BcwC81yKsQw1njjUyKFY6MAnvpkmz+Jk7udO4DQMAW5nn9I2FEfkZ1/X8upVZmJO65xNScdXFMbrVh1f2GJ4BsDTdZahNp4kzVZiXjLsFZODGPZ7rm1VMKFflueoj4dEhCQ9lHIchmW65Rkc4QUPdQNYDSbbaHXy74vITl04m249fEvG+gP3oOs/VZsohN22gb1tMn6OCSnvHsc6x/GEb65Sy3RBE4ZNToxd86GSMVgWNJ9qmvMMK5eNQoSXOEvd+DGGq5CKl4I5q+m6yEPeZMZcXe0HIy7mn/RiHEo+Xf/OfpMdCIA0PJg4zgZ+dtz9qumKLOcIJojjZehhJ+LbQRpHV9Vd3WHsdhB3zUdd3FnKtDCjBThtv+7peFLk98Tx36aVKbEpjd80epxw8Vas7dCb5mLVmdbrfixQsf2R5Av3YZ5g/QpCXKNuFIe5mL+uljAVmKGx/jSqUL iWDBH6+c zTEfNtn6ok+FFA3GCXtymJ7f1x/S7/BFIVH436bKn9g4qwyMyDVshwMcibrHh+Fn6L1QrBiuHnQQhcyNYZEgwl1/KeP6RV/sgZbIm08viT546pQCEBYU4/lmmyp2p8X/jOi2mc/tvcWmwXHmuTROL7UFqb4B4qpmU1R3cMT3Dn6koISPQFCPOen4NfU0rYxVXOblQ54TkgyedQnhqDSdbImQ6JTnr/EDMEeYXQH9Dnyn5mwnQYOahs5qW2LEELNl6D/s+m8+sRCmgI+hnFv+6jnFTTuTuyA4aOP6dQ1Pufcv32KVdlucxAEKC/XpaF31y/1bdMVrXw4Af8jwoyd5+RGlfIMT24JJs7uhDBqGyZltRbk7Omeq7psdnUXYL8FBZ7Q2jA3qgndrIN9pOK4jRzEkAhWP9fUpqfblufJKLjQeANT2rUfiNDSnFZyb4VGdexelsq838haVqB5bZahEdsFi0nGtPsUTt/bjuZ0NCIDR1r9tiH07J2ifsQtLnEGW9h+sFMQHR7XAeTabsNDpiciI/NQ== 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: 4e5ce33ceb32 ("selftests/vm: add a test for virtual address range mapping") 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)