Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Mar 2021 08:24:30 -0800
From:      Chuck Tuffli <chuck@freebsd.org>
To:        Mark Johnston <markj@freebsd.org>
Cc:        FreeBSD-Current <freebsd-current@freebsd.org>
Subject:   Re: bhyve fopen failure
Message-ID:  <CAKAYmMKcPY5uRtJJ7oS04U6XsDGD3nEKKGiDaBfXMF%2B0BT%2BgmQ@mail.gmail.com>
In-Reply-To: <YD6APEMT0KFDbtZM@nuc>
References:  <CAKAYmMK1b_9ShNFQm3HP--_F=dmWh_XR54PxF7Qbg2og0AgthA@mail.gmail.com> <YD6APEMT0KFDbtZM@nuc>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Mar 2, 2021 at 10:13 AM Mark Johnston <markj@freebsd.org> wrote:
>
> 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.

Thanks to you both; that did the trick. I was confused as other
emulated devices are doing the same thing, but there must be an
ordering difference that allows them to work (I assume).

--chuck



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAKAYmMKcPY5uRtJJ7oS04U6XsDGD3nEKKGiDaBfXMF%2B0BT%2BgmQ>