cap_sysctlbyname for hw.vmm.destroy

Mark Johnston markj at freebsd.org
Sat May 1 13:29:31 UTC 2021


On Sat, May 01, 2021 at 12:29:26PM +0300, Ionuț Mihalache wrote:
> 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).

- You do not need to do a full buildworld.  It is sufficient to rebuild
  bhyve itself with -DWITH_CASPER.  Note that the bhyve Makefile does
  not define WITH_CASPER when snapshot support is enabled.
- You need to add cap_sysctl to the list of libraries linked into bhyve,
  same as it currently links cap_pwd and cap_grp.

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


More information about the freebsd-hackers mailing list