Re: [LTP] [PATCH v2] security/dirtyc0w_shmem: Add new test for CVE-2022-2590

Martin Doucha
2022-11-25T09:53:34Z

Hi,

On 23. 11. 22 11:35, David Hildenbrand wrote:
> + pid = SAFE_FORK();
> + if (!pid) {
> + SAFE_SETGID(nobody_gid);
> + SAFE_SETUID(nobody_uid);
> + SAFE_EXECLP("dirtyc0w_shmem_child", "dirtyc0w_shmem_child", NULL);

Manpage says that the last argument of execlp() must be (char*)NULL,
including the explicit typecast.

> +#else /* UFFD_FEATURE_MINOR_SHMEM */
> +#include "tst_test.h"
> +TST_TEST_TCONF("System does not have userfaultfd minor fault support for shmem");
> +#endif /* UFFD_FEATURE_MINOR_SHMEM */

When the child exits through this TST_TEST_TCONF(), the
TST_CHECKPOINT_WAIT() in parent will fail. The parent process should not
even fork() when UFFD_FEATURE_MINOR_SHMEM is not defined in config.h.

--
Martin Doucha mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic