git: c6989de2e700 - stable/13 - bhyveload: enter capability mode after we setup the vcpu

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Mon, 22 Jan 2024 17:30:04 UTC
The branch stable/13 has been updated by kevans:

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

commit c6989de2e7007ab4ddca92bf4f3f8eca9c50c6b7
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-01-03 22:18:00 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-01-22 17:17:52 +0000

    bhyveload: enter capability mode after we setup the vcpu
    
    Reviewed by:    allanjude (earlier version), emaste, markj
    
    (cherry picked from commit 8bf0882e186effbd3d742ce17613cf9dfb81ce0c)
---
 usr.sbin/bhyveload/bhyveload.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/usr.sbin/bhyveload/bhyveload.c b/usr.sbin/bhyveload/bhyveload.c
index c11b1814cfc7..86f046a0a0c9 100644
--- a/usr.sbin/bhyveload/bhyveload.c
+++ b/usr.sbin/bhyveload/bhyveload.c
@@ -78,6 +78,7 @@
 #include <termios.h>
 #include <unistd.h>
 
+#include <capsicum_helpers.h>
 #include <vmmapi.h>
 
 #include "userboot.h"
@@ -863,6 +864,12 @@ main(int argc, char** argv)
 		}
 	}
 
+	caph_cache_catpages();
+	if (caph_enter() < 0) {
+		perror("caph_enter");
+		exit(1);
+	}
+
 	/*
 	 * setjmp in the case the guest wants to swap out interpreter,
 	 * cb_swap_interpreter will swap out loader as appropriate and set