Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp50328lqb; Thu, 14 Mar 2024 05:23:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWAILYXeSOaXJIUv9hZeyA1FYsWQai0wYYxn0U9xJp13HJUDO9yyw+UxGnXczZYZOC+oniMtY8Ko9T1dCC4gx4z9uIOVN+rD+UmybBJyg== X-Google-Smtp-Source: AGHT+IHCotLA7OkAB8RWkGSbSST87QHR1qt44bBq9OABA3YHt20Uu9/mqpa5Snfnvadz2FwvU1vo X-Received: by 2002:a25:9704:0:b0:dcc:fea7:7f7b with SMTP id d4-20020a259704000000b00dccfea77f7bmr1535181ybo.11.1710419029649; Thu, 14 Mar 2024 05:23:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710419029; cv=pass; d=google.com; s=arc-20160816; b=p92pdjGskXU6pXkagOkiJSmaBsjRaL2swaamYYKejOLbDVcELSU405qeK+PQDDGnoE QegMayEMD75cp8evQyGk36QGpNq79WTqxjtdvfUoPNYRoFd8t3G/OGGFTgF5P+fCR9YQ qyG+spXbu+TyKyOxDk7YOueE4/RiFadonYJG5Vz6sdgzuV6fYIOxQFATp5k2Rbr9MLtq hKe9cvYV9XphXCKD5unK7RjCjlCmAzgyp+gbRnRFDbG6ao21w3kC8DexYOsPMjnWzeUi m1znkTyTarmPKFvmwi/CP72JmpF4PaaTQi5Fzhop8ViJPwMdbo7jxhqQJ3mmIMspYKjW wKFg== 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 :date:subject:cc:to:from; bh=t9aH/D+HbTaaqeIXv0OnSSPSI+G66wksEk+Ix23UBFw=; fh=h7Dl1r0cbjGTZkO5hCUVY+nINWlq86Dgovfo9fe+sjo=; b=uCVuDIifbU0htWBGI/tBOY5CRonk2RGFMFMKc1YI4Pvj77tKGG6j7OMlUlYu3m6Foi Tkh919PaSHQh7EXyB/q6AOhENon6IwO/LTTBb7/+BVUF5DOsoah5I1k7Nc5tQ79eJgdp O8L+tyB68ayHmHVthpRDDvhhc5QfwICNtENHbibirlEbzr+yRcsxJojMQxDYEa/DiMpR 1URhREi5Qy40kX8V97iDCQ+i2hb987JAEpUrHazYoA1x+4i9MvtNqC5KMVAXLAFForRP vOHigWcVXWEnMNA1M1q2l2EfLIPcXUaepwOBqLj0U+mn5m0Ddv+gHZ8R2s7iMN1ZPqP1 XIXw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-103233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p12-20020a05622a13cc00b0042eed673e05si1391706qtk.564.2024.03.14.05.23.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 05:23:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-103233-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103233-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 5F60E1C2109D for ; Thu, 14 Mar 2024 12:23:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 429F36F533; Thu, 14 Mar 2024 12:23:42 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 783736F51A; Thu, 14 Mar 2024 12:23:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710419021; cv=none; b=StM5sF+j9h8u6CR4sWdUFuL6dOMqqUeS/wRD6D66nODKCbBkYvQVIFU833LfT8mzX8uCakXqEr9pksWAJaU5VujR+D4AAHh8SAVLN31r5Ni7N7eumXmv0GzZCHg1c1gguxjmy8VcWNdu5ckibOcUJwrjdTE+IC60Zrt3PLp7Shw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710419021; c=relaxed/simple; bh=lYUcSfHE+Q8ifZotzLipusX7K282QRZ2Go0JFtIPsJw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YJVKFBZaLUWupSGup6V+2QHSlzNSusrQZ74TZOtCq8bRYkF4tWaZ/5Z0mA0nQWZEvBtO1DLatD3uFWd+fPsK9X2qaew8EkiyVvpSHFxGYtFIJaHArAH6lhAL58DmSOJosxZGnhLlsaqUb2oNCk6by7UEdpg7xjK9nnMXK5p+4/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E187F1007; Thu, 14 Mar 2024 05:24:14 -0700 (PDT) Received: from e116581.blr.arm.com (e116581.arm.com [10.162.40.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E4F533F73F; Thu, 14 Mar 2024 05:23:35 -0700 (PDT) From: Dev Jain To: usama.anjum@collabora.com, akpm@linux-foundation.org, shuah@kernel.org Cc: dev.jain@arm.com, kernel@collabora.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Anshuman.Khandual@arm.com Subject: [PATCH] selftests/mm: virtual_address_range: Switch to ksft_exit_fail_msg Date: Thu, 14 Mar 2024 17:52:50 +0530 Message-Id: <20240314122250.68534-1-dev.jain@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <07e2e91b-7b0d-4810-a2a1-ed4654ecafb4@collabora.com> References: <07e2e91b-7b0d-4810-a2a1-ed4654ecafb4@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit mmap() must not succeed in validate_lower_address_hint(), for if it does, it is a bug in mmap() itself. Reflect this behaviour with ksft_exit_fail_msg(). While at it, do some formatting changes. Signed-off-by: Dev Jain --- tools/testing/selftests/mm/virtual_address_range.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/mm/virtual_address_range.c b/tools/testing/selftests/mm/virtual_address_range.c index 7bcf8d48256a..426ddfc345fb 100644 --- a/tools/testing/selftests/mm/virtual_address_range.c +++ b/tools/testing/selftests/mm/virtual_address_range.c @@ -85,7 +85,7 @@ static int validate_lower_address_hint(void) char *ptr; ptr = mmap((void *) (1UL << 45), MAP_CHUNK_SIZE, PROT_READ | - PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr == MAP_FAILED) return 0; @@ -105,13 +105,11 @@ int main(int argc, char *argv[]) for (i = 0; i < NR_CHUNKS_LOW; i++) { ptr[i] = mmap(NULL, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr[i] == MAP_FAILED) { - if (validate_lower_address_hint()) { - ksft_test_result_skip("Memory constraint not fulfilled\n"); - ksft_finished(); - } + if (validate_lower_address_hint()) + ksft_exit_fail_msg("mmap unexpectedly succeeded with hint\n"); break; } @@ -127,7 +125,7 @@ int main(int argc, char *argv[]) for (i = 0; i < NR_CHUNKS_HIGH; i++) { hint = hind_addr(); hptr[i] = mmap(hint, MAP_CHUNK_SIZE, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (hptr[i] == MAP_FAILED) break; -- 2.34.1