Re: [PATCH v1 2/2] kselftest: vm: add tests for memory-deny-write-execute

From: Kees Cook
Date: Fri Oct 28 2022 - 16:19:10 EST


On Wed, Oct 26, 2022 at 04:04:57PM +0100, Joey Gouly wrote:
> [...]
> +# define PR_MDWE_FLAG_MMAP 1
> [...]
> + // Enable MDWE and then run the tests again.
> + ret = prctl(PR_SET_MDWE, PR_MDWE_FLAG_MMAP, 0, 0, 0);
> + if (ret < 0) {
> + ksft_print_msg("PR_SET_MDWE failed or unsupported!\n");
> + goto exit;
> + }
> +
> + ret = prctl(PR_GET_MDWE, PR_MDWE_FLAG_MMAP, 0, 0, 0);
> + if (ret == 0)
> + ksft_exit_fail_msg("PR_GET_MDWE failed!");

This flag (PR_MDWE_FLAG_MMAP), while defined in uapi, wasn't actually
being used in the proposed prctl() api. :)

--
Kees Cook