git: 83958173eb7d - main - fasttrap: Assert that fasttrap_fork() successfully unmaps scratch space

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 01 Mar 2022 17:41:56 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=83958173eb7d3f9d402e6dc81e66d179a808dd63

commit 83958173eb7d3f9d402e6dc81e66d179a808dd63
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-01 16:52:39 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-01 17:40:35 +0000

    fasttrap: Assert that fasttrap_fork() successfully unmaps scratch space
    
    No functional change intended.
    
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
---
 sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
index 4771a67a9f09..d96d3f44182e 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
@@ -588,7 +588,7 @@ fasttrap_fork(proc_t *p, proc_t *cp)
 	fasttrap_proc_t *fprc = NULL;
 #endif
 	pid_t ppid = p->p_pid;
-	int i;
+	int error, i;
 
 	ASSERT(curproc == p);
 #ifdef illumos
@@ -678,9 +678,10 @@ fasttrap_fork(proc_t *p, proc_t *cp)
 		if (fprc != NULL) {
 			mutex_enter(&fprc->ftpc_mtx);
 			LIST_FOREACH(scrblk, &fprc->ftpc_scrblks, ftsb_next) {
-				vm_map_remove(&cp->p_vmspace->vm_map,
+				error = vm_map_remove(&cp->p_vmspace->vm_map,
 				    scrblk->ftsb_addr,
 				    scrblk->ftsb_addr + FASTTRAP_SCRBLOCK_SIZE);
+				ASSERT(error == KERN_SUCCESS);
 			}
 			mutex_exit(&fprc->ftpc_mtx);
 		}