The patch titled Subject: kselftest: vm: check errnos in mdwe_test has been added to the -mm mm-unstable branch. Its filename is kselftest-vm-check-errnos-in-mdwe_test.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/kselftest-vm-check-errnos-in-mdwe_test.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Florent Revest <revest@xxxxxxxxxxxx> Subject: kselftest: vm: check errnos in mdwe_test Date: Mon, 28 Aug 2023 17:08:55 +0200 Invalid prctls return a negative code and set errno. It's good practice to check that errno is set as expected. Link: https://lkml.kernel.org/r/20230828150858.393570-4-revest@xxxxxxxxxxxx Signed-off-by: Florent Revest <revest@xxxxxxxxxxxx> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx> Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: Alexey Izbyshev <izbyshev@xxxxxxxxx> Cc: Anshuman Khandual <anshuman.khandual@xxxxxxx> Cc: Ayush Jain <ayush.jain3@xxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Greg Thelen <gthelen@xxxxxxxxxx> Cc: Joey Gouly <joey.gouly@xxxxxxx> Cc: KP Singh <kpsingh@xxxxxxxxxx> Cc: Mark Brown <broonie@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Peter Xu <peterx@xxxxxxxxxx> Cc: Ryan Roberts <ryan.roberts@xxxxxxx> Cc: Szabolcs Nagy <Szabolcs.Nagy@xxxxxxx> Cc: Topi Miettinen <toiwoton@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/mm/mdwe_test.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/tools/testing/selftests/mm/mdwe_test.c~kselftest-vm-check-errnos-in-mdwe_test +++ a/tools/testing/selftests/mm/mdwe_test.c @@ -23,14 +23,22 @@ TEST(prctl_flags) { EXPECT_LT(prctl(PR_SET_MDWE, 7L, 0L, 0L, 0L), 0); + EXPECT_EQ(errno, EINVAL); EXPECT_LT(prctl(PR_SET_MDWE, 0L, 7L, 0L, 0L), 0); + EXPECT_EQ(errno, EINVAL); EXPECT_LT(prctl(PR_SET_MDWE, 0L, 0L, 7L, 0L), 0); + EXPECT_EQ(errno, EINVAL); EXPECT_LT(prctl(PR_SET_MDWE, 0L, 0L, 0L, 7L), 0); + EXPECT_EQ(errno, EINVAL); EXPECT_LT(prctl(PR_GET_MDWE, 7L, 0L, 0L, 0L), 0); + EXPECT_EQ(errno, EINVAL); EXPECT_LT(prctl(PR_GET_MDWE, 0L, 7L, 0L, 0L), 0); + EXPECT_EQ(errno, EINVAL); EXPECT_LT(prctl(PR_GET_MDWE, 0L, 0L, 7L, 0L), 0); + EXPECT_EQ(errno, EINVAL); EXPECT_LT(prctl(PR_GET_MDWE, 0L, 0L, 0L, 7L), 0); + EXPECT_EQ(errno, EINVAL); } FIXTURE(mdwe) _ Patches currently in -mm which might be from revest@xxxxxxxxxxxx are kselftest-vm-fix-tabs-spaces-inconsistency-in-the-mdwe-test.patch kselftest-vm-fix-mdwes-mmap_fixed-test-case.patch kselftest-vm-check-errnos-in-mdwe_test.patch mm-make-pr_mdwe_refuse_exec_gain-an-unsigned-long.patch mm-add-a-no_inherit-flag-to-the-pr_set_mdwe-prctl.patch kselftest-vm-add-tests-for-no-inherit-memory-deny-write-execute.patch