Page MenuHomeFreeBSD

imgact_binmisc: Optionally pre-open the interpreter vnode
ClosedPublic

Authored by dfr on Nov 18 2022, 3:11 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 6:50 AM
Unknown Object (File)
Mon, Nov 4, 6:49 AM
Unknown Object (File)
Mon, Nov 4, 6:49 AM
Unknown Object (File)
Mon, Nov 4, 6:48 AM
Unknown Object (File)
Mon, Nov 4, 6:26 AM
Unknown Object (File)
Sep 30 2024, 2:27 AM
Unknown Object (File)
Sep 26 2024, 11:53 AM
Unknown Object (File)
Sep 26 2024, 9:55 AM
Subscribers
None

Details

Summary

This allows the use of chroot and/or jail environments which depend on
interpreters registed with imgact_binmisc.

Test Plan

Ad-hoc testing of arm64 chroot environments with qemu-user-static

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dfr requested review of this revision.Nov 18 2022, 3:11 PM
dfr created this revision.

I added a new field to struct image_args. Since this was added to the end of the structure, it should make it possible to MFC to stable/13 since the structure is owned and zeroed by do_execve and any imgact modules should not be affected.

I'm not 100% sure about the vnode protocols are right, but they seem fine.
Not sure if I reinstall qemu and its implications, but that aught to be documented if it doesn't just work.

sys/kern/imgact_binmisc.c
69

Having this in the middle is OK, right?
I believe so, since this is in the .c file so no other files can reference it...

179

What happens if I reinstall qemu?

sys/sys/imgact.h
97

This is good.

This revision is now accepted and ready to land.Dec 7 2022, 11:57 PM
dfr marked 3 inline comments as done.Dec 8 2022, 8:36 AM

Thanks for the review. I will follow up with a PR for qemu-bsd-user to remove the logic which adds the emulator binary to emulated execve calls and make a separate review for the qemu-user-static-devel port to enable pre-open and also remind users to 'service qemu_user_static restart' or something similar after an upgrade.

sys/kern/imgact_binmisc.c
69

Yes - nothing outside this file can depend on the layout of imgact_binmisc_entry

179

The kernel will continue to use the old qemu until binmiscctl refreshes the mapping.

This revision was automatically updated to reflect the committed changes.
dfr marked 2 inline comments as done.