From patchwork Mon Aug 12 06:15:22 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: 13760165 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 5202DC52D7C for ; Mon, 12 Aug 2024 06:16:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E24A36B0082; Mon, 12 Aug 2024 02:15:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD46F6B0092; Mon, 12 Aug 2024 02:15:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C75756B0098; Mon, 12 Aug 2024 02:15:59 -0400 (EDT) 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 A83B66B0082 for ; Mon, 12 Aug 2024 02:15:59 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 64C501C22A7 for ; Mon, 12 Aug 2024 06:15:59 +0000 (UTC) X-FDA: 82442582838.18.CDD9C8E Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by imf03.hostedemail.com (Postfix) with ESMTP id 5908720004 for ; Mon, 12 Aug 2024 06:15:57 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=YDW8AKyK; spf=pass (imf03.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=none) header.from=collabora.com; arc=pass ("zohomail.com:s=zohoarc:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723443303; 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=LBR+TP/pJVKC9tpDa3zweS1u2fInPYeCnYBagTK31PI=; b=CGHFnBXnGlkz980DQxEhh+KTqXZ74cOKdN7PTDV8nSA7w+ZS5sbDjvH7+0PKS+xIBBGXwY k8eA+nnzfGX2UguklZYFRIxBcppJgB5BwwQG2kqe0+d2xAJsT3xrvQPll7UTCu8dJfpjNf RmDZ3LANOvE+eNZRmRbv6mQzjZ8K4sI= ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=collabora.com header.s=zohomail header.b=YDW8AKyK; spf=pass (imf03.hostedemail.com: domain of usama.anjum@collabora.com designates 136.143.188.112 as permitted sender) smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass (policy=none) header.from=collabora.com; arc=pass ("zohomail.com:s=zohoarc:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1723443303; a=rsa-sha256; cv=pass; b=teCb1cIuAZLQnhpf+Y85SE/kGfb6O1qMjP+1yVfVnnKh16imQZKIghrmycut/YUvBvPzUr /AByT2PwVHOwIxa/+vSDQ8pcQ6HbgH7eDFAazk9F8H8+jpBrcjWnsvXdKhf4+SuvQg+TXK bVhq9nFqmp78mACqrqwgUj1JCtJG1UM= ARC-Seal: i=1; a=rsa-sha256; t=1723443340; cv=none; d=zohomail.com; s=zohoarc; b=SHyNfYppBl/+V0ObUII2nRZCKWvu6876axI196r1vH8Jbb5OLLXK3OgOY68BU6XSpeE9mhEsBytXDQZUEkIbZ8ruL5RtqnWlxFjL9I/K/FVnKHI0/69T2FI/5aunQWfS7P6/TZ4lgU/WVFGeuQddUmESRRV+nBONHByqIiv0Wmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723443340; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=LBR+TP/pJVKC9tpDa3zweS1u2fInPYeCnYBagTK31PI=; b=bQS0HSDAotKeUXo1MhYtwkqxkDSVEdU/QKiPZS387fKDohKJl3mbluKnKh3RR5FWL+lVeZXG1ks+MB1FuV/ZAvkRIY5LFANMWRUrqiYhRidBsC3TUisxkh6/bCG2LtB2kxviV1gRCGBPd6LCsatd6SzCWWtZqEorL8CE6cOFSIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=usama.anjum@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1723443340; s=zohomail; d=collabora.com; i=usama.anjum@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=LBR+TP/pJVKC9tpDa3zweS1u2fInPYeCnYBagTK31PI=; b=YDW8AKyKZ5UF/sQ7Ty/MR2YXXNUzW0al3MnD3Rg72PRa4RiMnQBU73N7xRlTIkSb 7Gfm3WC2UhQNwyXPUhV+jEE9+an7z5xo7iGXZyAOsI8mr1zlFaIeLt+X7k1n3+/xDyW 9jUv9PrQKoXs1+sZkCGLKcMFyHlO+CMB17k9nSI4= Received: by mx.zohomail.com with SMTPS id 1723443338838423.1852483816655; Sun, 11 Aug 2024 23:15:38 -0700 (PDT) From: Muhammad Usama Anjum To: Andrew Morton , Shuah Khan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Mike Rapoport , James Bottomley Cc: Muhammad Usama Anjum , kernel@collabora.com, stable@vger.kernel.org, Shuah Khan , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v2] selftests: memfd_secret: don't build memfd_secret test on unsupported arches Date: Mon, 12 Aug 2024 11:15:22 +0500 Message-Id: <20240812061522.1933054-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-ZohoMailClient: External X-Stat-Signature: uefhhsks4qh7k3stiubjw9qeq8smfjao X-Rspam-User: X-Rspamd-Queue-Id: 5908720004 X-Rspamd-Server: rspam02 X-HE-Tag: 1723443357-952167 X-HE-Meta: U2FsdGVkX18gqwWatvsbGCXN7Aok/CIc8ZqDJXDsKCMQj7FEPKoJqQrHc0D2IElICRL9ql1aAiiSoxr/ZWMqdsAV/+oeNryFZO6QcigH7oKkpzqpXxXHmis2ApM+IMPZp5zi+GesEPiJiM475tEdrBO6HpjLFqwJSb3F9kNacGGjfvQFglmUMLZ4ZMHv8pQ6ZMEfRjjHTvCjNJ2rFdlI20XDmbTCadmRiGIj5Wmtydw0v9UPtqhO8aPdvEyI3cXFH3F1vDdLk3NLZmfTNMKanbXSmfDnMNQeUKqgffywmTewdC9ZKy5Vffu0XrTVfddsdapC7eWH1DaQeg1tIVOD/9J9gREZLB/I1FRVKgk5z+ai6oMqhXUGm1H2fUbYOmXDS9xqmOM+xjIhynPL8U+wONvq1Dhv0cO6CmjLRJ4y37elNoZpjBVlCW7+IyFqg/+gsmu+wGxDbmG87wCvxzAoS0C0TqIVibzoqJNPIh0soKG31okpImntbwk/rGrVlTvL+Z94CiVuFloEOiX3aTjW0zP3ltCqjngUCv8HX2mv3g5ifcV+I+NRTr9OubDMuSHMXhzgtHgoy7+BQQK7whH25N4N39EA4FXQO+JyUlm/eCW66pFoOSwQBav9vhIePSjC6DrFVdlpx8CKEGNynUgw3uD7sU7RrLqe6R3FrPPQP9WQFS5DTHvuPH+M6x31cHrilOy0VrULbhMBdDEI1QkO2N4Fe7+iUTKY/y3TeNd2ZRP0DzoR9fwHbaO04Z+e8TFzJEf0Yp3XwRxWoGQb3bWMhiQNGVrvkBZlkHijCSXbTBXY/U3tCci2EQOlnM2Aw2eDVivhH3a+rC/eBPnVd7n2yxdgF0Z5lgi06/bBl7TJRusR9DxjWO8KDwzXO4gikW7e1hBsQybFU/hrsahBha8rHt8LzrzsKXtePJ44pzKWncfX6ZWCdUC96RDSHtG4/fPuelILHsMfLIjlA5n2Epu ExNoZmaL QSVYRP+wZeOKu9U+crPxhWaM0d+er/boa++sh66sPabjTuevdEMR95AXJEGdhCEWhpRVxsQ+nAQR8OyKl3McJTFq+ZoLjjYuNTaRJLK03sVuRh3WPQUSFsl/mzHLZGQSK3k4vmzEJgd5v1P4owf/5ccnE5O6h6fopUxYPZhkbh8srULa2GLpJ9sNc1PZm2swOHXvbLLSmYeGhn1UG47McdJZILo/xk2VFMMMGqYIeKjzrx7qMBGcbU3olMpU4sMTmqOiZktp/d7PrhIrIsGK1djpGE3trpaH+bDNLBvuc9wGSCTL3wrF7CPTwAD+QiFlNt5aKsovDpzp0dNEv4vxrGxn+H6dRRLK1VRXrDGaM7Y7dezALGIEeQSg1xUV41hHHj8ddJdHdvvzwJz4zmFUn8P0D//i3xIYJyWzKPFUYs+qvGuESOMy/fbY2R6LM/wz30Mig+gVPcxv4vKKePioOsLwGUg== 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: [1] mentions that memfd_secret is only supported on arm64, riscv, x86 and x86_64 for now. It doesn't support other architectures. I found the build error on arm and decided to send the fix as it was creating noise on KernelCI: memfd_secret.c: In function 'memfd_secret': memfd_secret.c:42:24: error: '__NR_memfd_secret' undeclared (first use in this function); did you mean 'memfd_secret'? 42 | return syscall(__NR_memfd_secret, flags); | ^~~~~~~~~~~~~~~~~ | memfd_secret Hence I'm adding condition that memfd_secret should only be compiled on supported architectures. Also check in run_vmtests script if memfd_secret binary is present before executing it. [1] https://lore.kernel.org/all/20210518072034.31572-7-rppt@kernel.org/ Cc: stable@vger.kernel.org Fixes: 76fe17ef588a ("secretmem: test: add basic selftest for memfd_secret(2)") Reviewed-by: Shuah Khan Acked-by: Mike Rapoport (Microsoft) Signed-off-by: Muhammad Usama Anjum --- Changes since v1: - Add error message to the patch and reviewed-by tags --- tools/testing/selftests/mm/Makefile | 2 ++ tools/testing/selftests/mm/run_vmtests.sh | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 1a83b70e84535..4ea188be0588a 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -53,7 +53,9 @@ TEST_GEN_FILES += madv_populate TEST_GEN_FILES += map_fixed_noreplace TEST_GEN_FILES += map_hugetlb TEST_GEN_FILES += map_populate +ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64)) TEST_GEN_FILES += memfd_secret +endif TEST_GEN_FILES += migration TEST_GEN_FILES += mkdirty TEST_GEN_FILES += mlock-random-test diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 03ac4f2e1cce6..36045edb10dea 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -374,8 +374,11 @@ CATEGORY="hmm" run_test bash ./test_hmm.sh smoke # MADV_POPULATE_READ and MADV_POPULATE_WRITE tests CATEGORY="madv_populate" run_test ./madv_populate +if [ -x ./memfd_secret ] +then (echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 2>&1) | tap_prefix CATEGORY="memfd_secret" run_test ./memfd_secret +fi # KSM KSM_MERGE_TIME_HUGE_PAGES test with size of 100 CATEGORY="ksm" run_test ./ksm_tests -H -s 100