From patchwork Thu Feb 1 13:05:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13541063 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 CE774C47DDF for ; Thu, 1 Feb 2024 13:05:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4480D6B0081; Thu, 1 Feb 2024 08:05:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F5056B0082; Thu, 1 Feb 2024 08:05:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BCAE6B0083; Thu, 1 Feb 2024 08:05:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 189956B0081 for ; Thu, 1 Feb 2024 08:05:39 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 76A72A05FE for ; Thu, 1 Feb 2024 13:05:38 +0000 (UTC) X-FDA: 81743256756.08.6AE8A09 Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf19.hostedemail.com (Postfix) with ESMTP id CF8021A0002 for ; Thu, 1 Feb 2024 13:05:36 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=bp06Xi6v; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf19.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706792737; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=7mcIanNF32GwazO1YeL2H9SsxSXNOFUxupp96fOV2YA=; b=iKG9bz31bt6w6iz33RJmYIhhW+H0sX2Gm1HK7VDoXGf9hsRcJOm/ZRXV7wg9l3Upj3t0cE z8gvLzaRz+uIRsrCePH6yGFkBBK8j6XZ3xVNDFWdsxYB3ITO5/V162stBxdKBlvIdAYBiw sTKCDlP//r6UBJLU2Bjf2EMAnLoJHUc= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b=bp06Xi6v; dmarc=pass (policy=quarantine) header.from=collabora.com; spf=pass (imf19.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706792737; a=rsa-sha256; cv=none; b=EDWqgxU6ebUGAehThp4TBUC8FNgEYiGTNViElrguTSik10rxfIApMoU4UCCFYgEa8tgDKu LWzokbar0UOND8tamWewkWpqKFVNsgKW8vQg8UoeIdNVDkhLwYMll8UF1VPkXN2DUernDO 969wOY7cGprDQ6DuiE5puCKNmaGcOnk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706792735; bh=s4vhoRvfEvFZwOisdM2aMqjEVJFakRY46t1Nik7WI30=; h=From:To:Cc:Subject:Date:From; b=bp06Xi6v1KuIBWxidHRBmia8CUyfh5utC2lT8FJaXct0Fy0lE4hde7U/u7qCBDaYS 7oCMDDSOfk1vufGTLTFHBPVmHchkvHGHijgXWkKvfL/XT+/4o3dYq1X+5ZsJQU/15U wTJnPZ45xte/wvW1KTIwQU6+oWZdAvbmR9od12+3tLz8gdg2ZGmaw54726qxjRhBY8 YZQ5feLlratEx4yb2lh/SVs4wBEFkAKF5I+R+Z+hZBCaRj8boGPQcN5ttyHYCOt7E+ yEduhbGfhMSjG13psjRBy4M+6lRSuxiviI/uM2EK3CSeTCaZQT5Dl/Qw95CgMUHneE rNVJJQRP9RZqg== Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id D56C0378047F; Thu, 1 Feb 2024 13:05:32 +0000 (UTC) From: Muhammad Usama Anjum To: Andrew Morton , Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, ryan.roberts@arm.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] selftests/mm: on-fault-limit: run test without root privileges otherwise skip Date: Thu, 1 Feb 2024 18:05:36 +0500 Message-ID: <20240201130538.1404897-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: CF8021A0002 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: g6ckbm7odtjh4c1sp47b4pufsc9nn81i X-HE-Tag: 1706792736-118782 X-HE-Meta: U2FsdGVkX19kQLRGx+eTXvKtwRxq9dgGxhMbWucL+R4LHed5HZ1+r4Vwe/M0t5lj9ZD2O17RlqyiLKMML93+aiip7z1j24bCdcO8m0ei9xZ37k0J4gUXDWR1MQj/kP+Lw/cYA6TNASzNCkkz7YxbjOJFHhlaYXk8q345OwUtl2Z2OsLgwNPSxzDtHF1QbGGaFB1h61+UQ6RmgPYcNIkpS5PoRnnrDic7Cza//hOkfmyQ9zfOsftljm7KJwUAflmZ12ZWahIptAXRWGVjmtwU7/aV5Ku3qJ1S9uR/pGoGF22yo991LsnczigDHzifHmXOsvusYc1M7e/YFF7dsBmu1HQ+KS2ZldYr+I4BI2iEvNX4bGQUYXOdPQpQqZY5gXwM2wqqb700WVhMtwuBTWuKnRj2kDiqmcjKNWlWZ3hsQ0oR9JgmYgmLCvbgdGBURcyfUXYzlPlIyBjl7EZ/YWwIptsuL8qILid7IvAP7Q+3fT4C5zQQ0pmPu0pBqVcxqm48Ye7sB83CEKIV0KPm+ipl5nUcGObr2vpkHNgWLt+mAGaZmB+urFSiN1Lm3qRVxtkzjjJnDhLGpp+j63xGVyUXR1CZ59OYpxbKO6XSqtAVQBcy7P9budgPg+rbHuMW0a3DCraRyLLXSHHuQm3OYLBnVCh/5oBWxQIYBsMuVmGpi3lXbk0+dcStOCQTqBxcntOYSu22/Le7hADsbppqESzZ9sYwClTuXTKLgF1Tnx3S3VP3GRDnaMLAxZKTLr2MuzT6B8XoJKV8dU8gZWPODxebIU+GgxvQTqowhgnheDfsZ7sBexofStzlYQqD6+c1jHHhncYYVN+THsc0atFZ1ViEjORXOAGmObhSBc5oTAw/ykxzTh193q85uJ4EI/pgKRF+eeZojpDmPeK/nZtCWUES41ITWUhJuxvaXu4rll6m9pyM28kENyO+q5mh2Ssmb8i05bcFUqdgbw2A1KrsTa6 2NoyTwm5 1j7P1PLQhD3YYoJ6OMFyeTSnvk36Q85Uleb2Jf+07Ecg+AD6rT4u5Kl3s9kyUAWm5Lsq+L/d3pcdH34nRPLWK0WMQzIwMa8OLTDT2sJuSBUYHhGbOp/mr9Je7SaAnOa1Vaiav8dqY19gQgkJYwDvhaYIHWJ6gUtSinXxmzLfrDUClryw7HJ7yrv0PrdwUoijUKzM4fS6zXIZ8MeVtUI7ZIdJ/tY/JjM/J+En30aPGMq0pqdZzPdniN5zaRA== 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 mmap() respects rlimit only for normal users. This test should be run as normal user, without root privileges. Also add back the sudo -u nobody as run_vmtests.sh is run as root most of the times. Skip the test instead if sudo isn't present to lower the privileges. Fixes: b6221771d468 ("selftests/mm: run_vmtests: remove sudo and conform to tap") Signed-off-by: Muhammad Usama Anjum --- Please fold this patch in the Fixes patch if needed. --- tools/testing/selftests/mm/on-fault-limit.c | 6 +++--- tools/testing/selftests/mm/run_vmtests.sh | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/mm/on-fault-limit.c b/tools/testing/selftests/mm/on-fault-limit.c index 0ea98ffab3589..431c1277d83a1 100644 --- a/tools/testing/selftests/mm/on-fault-limit.c +++ b/tools/testing/selftests/mm/on-fault-limit.c @@ -21,7 +21,7 @@ static void test_limit(void) map = mmap(NULL, 2 * lims.rlim_max, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0); - ksft_test_result(map == MAP_FAILED, "Failed mmap\n"); + ksft_test_result(map == MAP_FAILED, "The map failed respecting mlock limits\n"); if (map != MAP_FAILED) munmap(map, 2 * lims.rlim_max); @@ -33,8 +33,8 @@ int main(int argc, char **argv) ksft_print_header(); ksft_set_plan(1); - if (getuid()) - ksft_test_result_skip("Require root privileges to run\n"); + if (!getuid()) + ksft_test_result_skip("The test must be run from a normal user\n"); else test_limit(); diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 55898d64e2ebf..edd73f871c79a 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -303,7 +303,12 @@ echo "$nr_hugepgs" > /proc/sys/vm/nr_hugepages CATEGORY="compaction" run_test ./compaction_test -CATEGORY="mlock" run_test ./on-fault-limit +if command -v sudo &> /dev/null; +then + CATEGORY="mlock" run_test sudo -u nobody ./on-fault-limit +else + echo "# SKIP ./on-fault-limit" +fi CATEGORY="mmap" run_test ./map_populate From patchwork Thu Feb 1 13:05:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 13541064 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 3CF08C47DDF for ; Thu, 1 Feb 2024 13:05:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C5B86B0083; Thu, 1 Feb 2024 08:05:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 972FE6B0085; Thu, 1 Feb 2024 08:05:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83FA86B0087; Thu, 1 Feb 2024 08:05:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 70CDD6B0083 for ; Thu, 1 Feb 2024 08:05:42 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 39306140E39 for ; Thu, 1 Feb 2024 13:05:42 +0000 (UTC) X-FDA: 81743256924.16.12739AE Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) by imf17.hostedemail.com (Postfix) with ESMTP id 52D3340009 for ; Thu, 1 Feb 2024 13:05:40 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="Jt/4NHVe"; spf=pass (imf17.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706792740; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OmcWedgI6vL0s9TBJYhBtMazBK8p03I37fcI2TMKGUA=; b=K6hMR3LTAy0eD9RUnsAgc0wCvrIjmWg2/Pi1e/yC/VbSr9ICW3n9HpUFfzhv/jIzl8UJF1 KvumIDXcQzBHzXildrV5WqCPQEtoD9xK5bivpm+Wp/P/s6Wn7VE1xoxoepKh2nm26zqeTU B2aYKgTkh5unNL2ls7Y5tj+IWsKPXJ4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706792740; a=rsa-sha256; cv=none; b=ezzYyy2FV0FgfD0ET0uNnWujrqcF+cQ6v5VC9GzyoQJiS90IdzJOeRTq2/BJ4A/EBEVXT9 ZsHA3tcmNB5ZBeWYLDJev9GKXxhyphLibW2U9XoFhG1eil3SJyjbwSM+gtDkcZWyjmVacq WLQJsKBNRPolxDDFIRH/QHVN6hNj6Tc= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=collabora.com header.s=mail header.b="Jt/4NHVe"; spf=pass (imf17.hostedemail.com: domain of usama.anjum@collabora.com designates 46.235.227.194 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=quarantine) header.from=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706792739; bh=/MVnfk7AH4h6a4QWSYQJHX+ejX6+Vh4/dMORXjSgQU0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jt/4NHVe/eHjQOovfkzSj8baPCTpY78dmgFcjqjUcSXuiP6HHE06v7rm8fAbqxHKg 5k41CAryBdxKya+QjkFmLw7IWZoD70GoqbS7b9dV11H0yUoVTiKENm+Dyu1AV/z1jt wzKOcJmb0RF94Sr1VANtHgYPr62sdIlk2OVYjC+6NQYoz3kW2oafxwXMd4Oxpj5xIT A4Xe8Nf9KpJCe/HVG8td8Y6EReEUgF1gBXcSn+j1gJB7oeZJrU0VGXela+rwJIB3+0 T1NkLdmn7k0ljjHI0ezSUpbtn+Z4j0J3KsT1XBVwAzu758rLHJ0Jmnu1wodLbYgG31 AyLGaaIqrgiWg== Received: from localhost.localdomain (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 577DF378208C; Thu, 1 Feb 2024 13:05:36 +0000 (UTC) From: Muhammad Usama Anjum To: Andrew Morton , Shuah Khan , Muhammad Usama Anjum Cc: kernel@collabora.com, ryan.roberts@arm.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] selftests/mm: run_vmtests: Use correct flag in the code Date: Thu, 1 Feb 2024 18:05:37 +0500 Message-ID: <20240201130538.1404897-2-usama.anjum@collabora.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240201130538.1404897-1-usama.anjum@collabora.com> References: <20240201130538.1404897-1-usama.anjum@collabora.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 52D3340009 X-Rspam-User: X-Stat-Signature: qmwfm9wj3dqrqay8fybaymfbpk9ybade X-Rspamd-Server: rspam03 X-HE-Tag: 1706792740-321660 X-HE-Meta: U2FsdGVkX19KsvELPgyW3gKJ58dbSlxs0qd0EXokninfhzBpOn24D37C2z0NhqEo8KZo0rvooPjzVSGHS7oZ0faa5iTrwrLmf/+y3wDkEVI97qt5wg2QJ12JcYJ+2p0x7KY4qESFqYkV/YsDyaGbOKdM4/3PIItKkKjeWzG+nGVjxjgVa6sw5r0cC1vsqHnpuqfWZ8kFNud05yvqkdp+u1U0l4zLkilevZH5AIrIEStI5FKy/GplM2VBkTCLYw2TkUV3LuE1pWG+j951v4Pec+5FmhsY29yNb4rJwo3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Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Use correct -d flag as mentioned in comments for destructive tests. Rename variable and update comment for some clarification. Fixes: cc7b9955344c ("selftests/mm: run_vmtests.sh: add missing tests") Signed-off-by: Muhammad Usama Anjum --- Please fold this patch in the Fixes patch if needed. --- tools/testing/selftests/mm/run_vmtests.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index edd73f871c79a..99734a2a091b3 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -15,7 +15,7 @@ usage() { cat <