Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 1 May 2021 12:29:26 +0300
From:      =?UTF-8?Q?Ionu=C8=9B_Mihalache?= <ionut.mihalache1506@gmail.com>
To:        Mark Johnston <markj@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: cap_sysctlbyname for hw.vmm.destroy
Message-ID:  <CAOxbktYgis0tq2yTp-7bwZCH01M0UDXhsgL%2Bf%2BEJtJX8BcxWyA@mail.gmail.com>
In-Reply-To: <YImCHsL3lVN3HAWo@nuc>
References:  <CAOxbktY6GZY2rfyYMoTquyn04rM2GB5S2opAF1gDxh2177frLg@mail.gmail.com> <YIb66AlmFG0DPn%2BG@nuc> <CAOxbktbsOGAEHZHEuHNrzP9ToyJVN0MvhqfRX_M-kxNOChD2Gw@mail.gmail.com> <YIlot3y9aJ5cSB9H@nuc> <CAOxbktYCDEotQE%2BE3SHAkw_FCBui80xoAoWBbau9APb1M5=d6w@mail.gmail.com> <YIl0L5Wrm8YwpXWr@nuc> <CAOxbktazHmPtHjkkD6Hh7=1O5KW5N%2Bcu-5=WfC6GmKPut4K7yQ@mail.gmail.com> <YImCHsL3lVN3HAWo@nuc>

next in thread | previous in thread | raw e-mail | index | archive | help
I did a clean buildworld with -DWITH_CASPER and -DHAVE_CASPER and now there
is a linking problem. Here [1] I have the includes to test the example and
here [2] I have the code. When trying to link there is a problem with
cap_sysctl_limit_init,
cap_sysctl_limit_name, cap_sysctl_limit, cap_sysctlbyname; the symbols are
not found. If I comment those lines though, cap_service_open fails(this
happens in bhyverun.c). When using the API here [3] there are no linking
problems and cap_service_open works, but cap_sysctlbyname returns EPERM(I
have here [4] the includes that I used).


[1] -
https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790=
17c025cbaf243/usr.sbin/bhyve/bhyverun.c#L36
[2] -
https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790=
17c025cbaf243/usr.sbin/bhyve/bhyverun.c#L1569
[3] -
https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790=
17c025cbaf243/lib/libvmmapi/vmmapi.c#L141
[4] -
https://github.com/FreeBSD-UPB/freebsd-src/blob/2373ecaa6dea4f0491a3ccc6790=
17c025cbaf243/lib/libvmmapi/vmmapi.h#L38

=C3=8En mie., 28 apr. 2021 la 18:41, Mark Johnston <markj@freebsd.org> a sc=
ris:

> On Wed, Apr 28, 2021 at 06:19:09PM +0300, Ionu=C8=9B Mihalache wrote:
> > Even with the fixes cap_sysctl still returns EPERM for that simple
> example.
>
> Are you sure that libcap_sysctl is actually being used?  In other words,
> are you compiling with -DWITH_CASPER?  If not, the program will call
> cap_enter() and then try to read the sysctl directly, since
> cap_sysctlbyname() will be a simple wrapper for sysctlbyname().
>
> >
> > =C3=8En mie., 28 apr. 2021 la 17:41, Mark Johnston <markj@freebsd.org> =
a
> scris:
> >
> > > There are two bugs in the example, also present in your WIP.  I fixed
> > > them here:
> > >
> > >
> https://cgit.freebsd.org/src/commit/?id=3D44bbda649dc6c1cdc5a99641e14c771=
57967e140
> > >
> > > On Wed, Apr 28, 2021 at 05:22:22PM +0300, Ionu=C8=9B Mihalache wrote:
> > > > I update the code now [1] but still the same error. Even without an=
y
> > > limits
> > > > the cap_sysctlbyname fails after using cap_enter.
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOxbktYgis0tq2yTp-7bwZCH01M0UDXhsgL%2Bf%2BEJtJX8BcxWyA>