From patchwork Fri Jan 10 13:05:52 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: 13934561 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 EE1C3E77188 for ; Fri, 10 Jan 2025 13:06:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 307F76B00AC; Fri, 10 Jan 2025 08:06:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 21B586B00AB; Fri, 10 Jan 2025 08:06:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC50B6B00A8; Fri, 10 Jan 2025 08:06:19 -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 CDDDD6B00A0 for ; Fri, 10 Jan 2025 08:06:19 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5F97544A23 for ; Fri, 10 Jan 2025 13:06:19 +0000 (UTC) X-FDA: 82991565678.04.AF68D9F Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf26.hostedemail.com (Postfix) with ESMTP id 7B1EA14000E for ; Fri, 10 Jan 2025 13:06:17 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=cgMVMM0X; dkim=pass header.d=linutronix.de header.s=2020e header.b=vnqKOQqc; spf=pass (imf26.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=1736514377; 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=7/HpKeU3nB17qCbgw45LzfDStDcTMTxJdySqt4LT06I=; b=dmwM+Q4sHZXG/hkDQPRlm4wrWBtCe0c0jo7yE5l6QSYIx5rV37W/LTZpZUy+3svynT3ZvV xdZFnG12P8bI08NNJYtSXJNP/Qc9b1qc6CTSbrkYIKjD6MXLIVonXHjdNlkKl9FxfOtofE k8hQooHPvZ4hTWf4fO4EEvF3MpNQKsY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736514377; a=rsa-sha256; cv=none; b=kfuHLc1+TbiePuS2+OCBSBiYYYG8OF+74KjYOc4shlULHKLma3X93Spcj1YJKN6k6l/jMg EvxwK3lcrqp8xQ9/C5eFwwYsvFBXxi7ir/jySy29Mzk/HB1ErQhWc5FKIXA1NJn2b1806K MBu5tnl5F5wz39EWl72gm0B9m1QW250= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=cgMVMM0X; dkim=pass header.d=linutronix.de header.s=2020e header.b=vnqKOQqc; spf=pass (imf26.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=1736514376; 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=7/HpKeU3nB17qCbgw45LzfDStDcTMTxJdySqt4LT06I=; b=cgMVMM0XMvPpgk7LQVls0/NjZqULU4tlyO7mR7tS+j2wRjYSlSDJj1NU5zpG7j3eU2jJG0 RFR31a/9lS28uHmr5fDEca2yBUHlNtFks2HYxvKM9igXsAHf6VSe8gonN3qjICvqN6jeGv xqos6rZYmqHPdEixvDMfQdTPfVrFKQVEweEvgBMcnCOWHBzuI4IvcXz8ilknht6CFNqYbz rLVx5bNwFeFRmrti2Rkzn0CANvENJNbfUGCNDj4uAG3PEQd7rrtqgn7qx0kKr3OlcNGsKm 8l2FXpnZyu5HLbFzfwPIGMNVChguSF/0q2e65AzVHOYHrfL7CVpcZ4EstcnZsA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1736514376; 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=7/HpKeU3nB17qCbgw45LzfDStDcTMTxJdySqt4LT06I=; b=vnqKOQqcnyThrY7uwgt10ODiZAJvUV1j7RK4XfnLpFpnSDHBblD4BPTaFhJM6d71HmumZy r3TkoT027CrLHjDg== Date: Fri, 10 Jan 2025 14:05:52 +0100 Subject: [PATCH v2 3/3] selftests/mm: virtual_address_range: Avoid reading VVAR mappings MIME-Version: 1.0 Message-Id: <20250110-virtual_address_range-tests-v2-3-262a2bf3c3d0@linutronix.de> References: <20250110-virtual_address_range-tests-v2-0-262a2bf3c3d0@linutronix.de> In-Reply-To: <20250110-virtual_address_range-tests-v2-0-262a2bf3c3d0@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?= , kernel test robot X-Developer-Signature: v=1; a=ed25519-sha256; t=1736514373; l=1931; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=bdSDA3kxsRphOJAe1hxQQ4SiKiKcoohRKkjKfuCnFKc=; b=gKZeKPISRJ9eyZV3iQPMGCo8+Fm6utfH+O07hIoYZsNN5ZCKnoVoHyndhFCIolHxljj1aIu4l qp0SJjbKI5LBX7Q3yIWHuSlRgoFOxhE/K020QA06NXrxEPE/bZTtSOY X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 7B1EA14000E X-Stat-Signature: qim1ner71ppkc5m9uz6n34u4yw1xz7fw X-Rspam-User: X-HE-Tag: 1736514377-786503 X-HE-Meta: U2FsdGVkX18Pn7b1uCxvZ4ev4jwRY/9vJuwFo+PEImMU2qtceepcnsxP5AkWmN86oWQuRQtPMB+FbFPNHXPf59vAuAnG4gjeMzdI9nVGuKwhtQ8UbM4J9Zki7BknmiG4lxVSeH3Fxt/sBrwN/+S1NcwKzwfAJzNCgi3eFDDkDqHD0HYIbd+6Y2OTfscdtiwsGROqAWB7W795msSItpmsgN3572Cypk6Lb/vw0yYe12rWMfuECplV6MTYQ3WQA0uXlGcoCmp2itYeajA2GAOOOjR9nHZ4mV1z6Jl8A5a7fGn+NTjkALoH6o9141K95j6wWZ7kq7vITp7JCUvegHjiAFvNO8MutYLIPhFsnMhRsgwKPRJpMyuDCGJB5u4sQuYNcA2nhv1Y707f4egphxD4kp4hXounNGtgU+tS0fa7NmQY7UDAknx/KTp6nkpqVU7zPgkKaBG1bWQFz++P7zMuBP2CE8adFrcmV2xRhW6d656Vm0s7vYUKERiFLPVijye8hhJFeRn2XA6EFIk8bnuhWxWpwPbuNlcm5y/iA7oAWk1wCGjyW96QccI2vce7UGXIqieECel6h+xedQgXs1KBtUIFagtpvz3Hlv71carHeoEk/oMyxoOvmUag51UFAT+jx2oP8Ff02lJ6mhMEtVaWiUxotMaNEicK3vXe9Y7YJGMdSPEKZ49/xvWv9DIThO0sTfpZtB6Lph3R9n/q8dRsdkTZ78enGvYYL2mpSIMjibl4m4FrUcQyDHD4/QmMT+K81EKQ+N/fUAFa/LEqzXsLz70hBHdgNpbBTFrGGGzMQ+GlLOuP/XcSwJg+7zHJ3G49yhKyLlfQDx6AGe5GRcAxjkrmQk6v8hjftnIRhgFkOU90kn7tkYxBfHcJ41dtZiax3ksMhsr9z1tjqbTlgVuveF3Afm37h4bXyUCS+8uDvyg/rM7owhvJdNtB8l/SAb/4kvm3F6UWuFayN5XD1Ol noH6pNAE sRwFkeY0K5GRbWfaCIP+TVf37tdPUVMBFyM+X6KmfkJBCtgv4woT4lQ1LdAKhukPJhTjkS/RmkytVxog78dpduIo0/ndWQJz1rZDs74A6lFHQWcqAhYHt7VLekeoSnO3MISu7CPTWN7IqJ0p0817PBdo0fjzXHlpGlqU8UN4vLMZGYNbPbSYxnMj7MmNQSkzK5uvGvIFrWhrIw71ztq7IKNQv10Vi7nPxyM4ELrXxb8sec66YCCNmR2KUWH1AhGUIP89w7q5SUpPOx6zJ9/GqgBE3MnewgB5TAVKgW80Mg79aNg0MnIBiqz68ln+RUpKU9Pe+e8H3cSASkXNJAEzWaG83y4na/Vul8n9PSU1cChPRlXqmQy9G3YSj001EoCYCGjtRe/d37AnKpwLdT6jqs6i3HYbj1cgfshuvY1sSEONyGfLRpkGSRKWz0WQs/2nTJeGAzw3/PBl1Qkh3H+ggKSXgJp4+t6ak373whG2ImO+HL9l9ChNcD8/4Vw== 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: The virtual_address_range selftest reads from the start of each mapping listed in /proc/self/maps. However not all mappings are valid to be arbitrarily accessed. For example the vvar data used for virtual clocks on x86 [vvar_vclock] can only be accessed if 1) the kernel configuration enables virtual clocks and 2) the hypervisor provided the data for it. Only the VDSO itself has the necessary information to know this. Since commit e93d2521b27f ("x86/vdso: Split virtual clock pages into dedicated mapping") the virtual clock data was split out into its own mapping, leading to EFAULT from read() during the validation. Skip the various vvar mappings in virtual_address_range to avoid the issue. Fixes: e93d2521b27f ("x86/vdso: Split virtual clock pages into dedicated mapping") Fixes: 010409649885 ("selftests/mm: confirm VA exhaustion without reliance on correctness of mmap()") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-lkp/202412271148.2656e485-lkp@intel.com Signed-off-by: Thomas Weißschuh --- tools/testing/selftests/mm/virtual_address_range.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index 4fc1c21a5e218eaec4d059b75c31a21dd4e8a215..993990aba56fc986c42084ffa91973558aa07e87 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -152,6 +152,10 @@ static int validate_complete_va_space(void) if (prot[0] != 'r') continue; + /* Only the VDSO can know if a VVAR mapping is really readable */ + if (vma_name && !strncmp(vma_name, "[vvar", 5)) + continue; + /* * Confirm whether MAP_CHUNK_SIZE chunk can be found or not. * If write succeeds, no need to check MAP_CHUNK_SIZE - 1