Skip to content

Commit 7c5e8d2

Browse files
musamaanjumakpm00
authored andcommitted
selftests: memfd_secret: don't build memfd_secret test on unsupported arches
[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. Link: https://lkml.kernel.org/r/20240812061522.1933054-1-usama.anjum@collabora.com Link: https://lore.kernel.org/all/20210518072034.31572-7-rppt@kernel.org/ [1] Link: https://lkml.kernel.org/r/20240809075642.403247-1-usama.anjum@collabora.com Fixes: 76fe17e ("secretmem: test: add basic selftest for memfd_secret(2)") Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org> Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 807174a commit 7c5e8d2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tools/testing/selftests/mm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ TEST_GEN_FILES += madv_populate
5353
TEST_GEN_FILES += map_fixed_noreplace
5454
TEST_GEN_FILES += map_hugetlb
5555
TEST_GEN_FILES += map_populate
56+
ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64))
5657
TEST_GEN_FILES += memfd_secret
58+
endif
5759
TEST_GEN_FILES += migration
5860
TEST_GEN_FILES += mkdirty
5961
TEST_GEN_FILES += mlock-random-test

tools/testing/selftests/mm/run_vmtests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,11 @@ CATEGORY="hmm" run_test bash ./test_hmm.sh smoke
374374
# MADV_POPULATE_READ and MADV_POPULATE_WRITE tests
375375
CATEGORY="madv_populate" run_test ./madv_populate
376376

377+
if [ -x ./memfd_secret ]
378+
then
377379
(echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope 2>&1) | tap_prefix
378380
CATEGORY="memfd_secret" run_test ./memfd_secret
381+
fi
379382

380383
# KSM KSM_MERGE_TIME_HUGE_PAGES test with size of 100
381384
CATEGORY="ksm" run_test ./ksm_tests -H -s 100

0 commit comments

Comments
 (0)