Re: Anyone using binmiscctl for interesting things?

Meowthink <[email protected]> Sun, 28 Jun 2026 20:30:30 +0800
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <CABnABoaeumSt9Z5U=1r5RYni-j8iZ3t3sFxeQmsSidoqWwLmDg@mail.gmail.com>
I think cosmopolitan[0] binaries can be users of binmisc, though they
can be done by shebang magic[1].
```
binmiscctl add ape --interpreter /usr/local/bin/ape --magic MZqFpD --size 6
binmiscctl enable ape
```
[0] https://github.com/jart/cosmopolitan
[1] https://justine.lol/ape.html

On Sun, Jun 21, 2026 at 12:08 AM Adrian Chadd <[email protected]> wrote:
>
> (top posting because I've only had one coffee so far)
>
> I like it!
>
>
> -a
>
> On Thu, 18 Jun 2026 at 06:56, Kyle Evans <[email protected]> wrote:
> >
> > Hi,
> >
> > I was chatting with Warner about this last night and he received it positively, so wider audience: I'd like to rewrite the binmiscctl interface into the kernel to allow scoping activator rules and that could have broader impact, so I'd like to hear about any uses that *aren't* qemu-user-static.
> >
> > Background: in today's world, imgact_binmisc.c exposes a sysctl that's only usable in prison0, and it registers interpreters for the whole system. I think that's suboptimal for $reasons that I'm happy to expand on, but the short version is that I'd like to replace the sysctl interface with a cdev/ioctl that can optionally be revealed in a child devfs, so that we can delegate control *and* implement per-jail activators.
> >
> > binmiscctl would likely grow a pair of flags, --inherit/--no-inherit, so that today's usage could still work just fine by using --inherit'ed rules in prison0.  Eventually --no-inherit would become the default, but we'd probably want to first teach poudriere to stand-up binmiscctl rules in a jail as needed; ideally, we'd probably take the current set of activators from the qemu_user_static rc script[0] and install config file(s) that describe how TARGET/TARGET_ARCH pairs map to binmiscctl params that poudriere can ingest to make that maintainable.  (CC'd bdrewery in case he already hates that idea just upon hearing it)
> >
> > The control interface will probably get split out to an imgact_binmisc_ctl.c at the start of this effort to try and clean some things up a little bit, since the sysctl interface should probably be retained in COMPAT_FREEBSD15- we could maybe debate later if the feature is niche enough that compatibility can drop once all supported releases have a binmiscctl(8) doing cdev things, but it's still worth making it maintainable up front.
> >
> > Thanks,
> >
> > Kyle Evans
> >
> > [0] https://cgit.freebsd.org/ports/tree/emulators/qemu-user-static/files/qemu_user_static.in
> >
>