bhyve fopen failure

Mark Johnston markj at freebsd.org
Tue Mar 2 18:13:18 UTC 2021


On Tue, Mar 02, 2021 at 09:31:22AM -0800, Chuck Tuffli wrote:
> I'm porting some code to bhyve and am getting a failure I don't
> understand. This is git as of af11c2029006 FWIW.
> 
> The code in question is for an emulated device and looks like:
>     dbg = fopen("/tmp/bhyve_ata.log", "w+");
>     if (dbg == NULL)
>         perror("fopen");
> 
> Running this fails with:
>     fopen: Not permitted in capability mode
> Googling suggests this might be capsicum related. If so, what do I
> need to change to allow writes to a debug file?

You would need to either open the file in the driver's initialization
routine, which I believe is executed before bhyve enters capability
mode, or add -DWITHOUT_CAPSICUM to the bhyve CFLAGS and recompile.


More information about the freebsd-current mailing list