Date: Mon, 16 Feb 2026 17:58:15 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 44843695bc4e - main - pdrfork(2) tests: catch runaway child for EFAULT test Message-ID: <69935ab7.369ec.59c8421d@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=44843695bc4e36abd15835d627da7d38c06f2219 commit 44843695bc4e36abd15835d627da7d38c06f2219 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-02-16 10:04:26 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-02-16 17:57:52 +0000 pdrfork(2) tests: catch runaway child for EFAULT test Reported and tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55306 --- tests/sys/kern/pdrfork.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/sys/kern/pdrfork.c b/tests/sys/kern/pdrfork.c index 1003ad9dc746..943e7fde835a 100644 --- a/tests/sys/kern/pdrfork.c +++ b/tests/sys/kern/pdrfork.c @@ -95,11 +95,21 @@ ATF_TC_WITHOUT_HEAD(efault); ATF_TC_BODY(efault, tc) { void *unmapped; + pid_t my_pid; unmapped = mmap(NULL, PAGE_SIZE, PROT_NONE, MAP_GUARD, -1, 0); ATF_REQUIRE(unmapped != MAP_FAILED); + my_pid = getpid(); ATF_REQUIRE_ERRNO(EFAULT, pdrfork(unmapped, 0, RFPROC | RFPROCDESC) < 0); + + /* + * EFAULT only means that the copyout of the procdesc failed. + * The runaway child was created anyway. Prevent + * double-destruction of the atf stuff. + */ + if (my_pid != getpid()) + _exit(0); } /* Invalid combinations of flags should return EINVAL */home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69935ab7.369ec.59c8421d>
