Page MenuHomeFreeBSD

init: build dynamically
Needs ReviewPublic

Authored by kib on Mon, Apr 20, 6:08 PM.
Tags
None
Referenced Files
F153894645: D56536.diff
Fri, Apr 24, 2:37 PM
Unknown Object (File)
Fri, Apr 24, 5:20 AM
Unknown Object (File)
Thu, Apr 23, 6:08 AM
Unknown Object (File)
Tue, Apr 21, 7:21 PM
Unknown Object (File)
Tue, Apr 21, 4:11 PM
Subscribers

Details

Summary

Also, as a safety and convenience aid:

bin/sh: make it possible to use as interactive init

If the /sbin/init binary is broken somehow, the way out is to set the
loader environment variable init_path to something else.  The most
natural choice would be either /bin/sh or /rescue/sh.  Unfortunately,
this does not work because the init process starts withoud stdin/out
descriptors.

Make it nicer to users by teaching /bin/sh startup code to open standard
descriptors on /dev/console if the shell is run as init.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Mon, Apr 20, 6:08 PM
zlei added inline comments.
sbin/init/Makefile
13

The init(8) is so important that it should be as strong as possible. Will this introduce more chances to break it ?

% ls -llh /sbin/init
-r-xr-xr-x  1 root wheel  1.2M Mar 30 17:43 /sbin/init

It occupies a lot more disk spaces compared to other dynamically utilities. Is that the main reason to make it dynamically ?

sbin/init/Makefile
13

I am not sure what it mean for init to be strong.

An issue with the statically linked binaries comes when somebody has to downgrade kernel, and older kernel does not have some syscall that is needed for libc startup. In this case user has to downgrade libc as well anyway, but with static init he must also downgrade init, which is currently problematic.

The two changes from this review easier the situation:

  • sh change makes it possible to use /bin/sh without init, by specifying init_path in loader to /bin/sh
  • init dyn linking allows only to downgrade libc and get init working.