Page MenuHomeFreeBSD

kern: factor `do_execve()` into small helper functions
Needs ReviewPublic

Authored by inquire_JohnEricson.me on Thu, Aug 6, 4:06 AM.

Details

Reviewers
markj
glebius
kib
Summary

Pure refactor, no functional change. Factor shared logic out of
do_execve into small functions:

  • exec_activate: credential setup + image activator loop
  • exec_install_setid: set-id policy after activation
  • exec_fgetvp: fd-based executable lookup
  • exec_prepare_image: permission check + first page mapping
  • exec_copyout_stack: string copyout + stack setup
  • exec_set_comm: process naming
  • exec_cache_args: ps(1) argument caching
  • exec_finalize: textvp/regs/knote installation
  • exec_cleanup_imgp: image_params resource cleanup
  • exec_cleanup_cred: credential/MAC/args cleanup
  • exec_interpreter_cleanup: interpreter loop image teardown
  • exec_interpreter_vp: interpreter vnode resolution
  • exec_interpreter_namei: interpreter pathname resolution

This is preparation for adding a second consumer of this logic: the
pdnew family of syscalls implementing the process creation model
proposed in
https://lists.freebsd.org/archives/freebsd-arch/2022-January/000140.html

Note: This patch series overall is very big, more than I feel competent
reviewing, so I feel a bit ill-mannered submitting it yet. Certainly,
everyone should feel free to ignore it until my "unix socket connectat"
series is landed. I am submitting it now anyway simply because I think
the end functionality is very cool, and I don't want it to grow dusty on
my machine.

Assisted-by: Claude Code (Claude Opus 4.8/5 and Fable 5)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75407
Build 72290: arc lint + arc unit