Page MenuHomeFreeBSD

nanobsd: Remove chflags call in install_world()
Needs ReviewPublic

Authored by senguptaangshuman17_gmail.com on Wed, Aug 19, 10:19 AM.
Tags
None
Referenced Files
F168210723: D58957.id184967.diff
Wed, Aug 26, 10:14 PM
F168209960: D58957.id184598.diff
Wed, Aug 26, 10:09 PM
F168203864: D58957.id184457.diff
Wed, Aug 26, 9:15 PM
Unknown Object (File)
Wed, Aug 26, 10:17 AM
Unknown Object (File)
Wed, Aug 26, 8:22 AM
Unknown Object (File)
Wed, Aug 26, 7:10 AM
Unknown Object (File)
Tue, Aug 25, 12:57 PM
Unknown Object (File)
Tue, Aug 25, 5:49 AM
Subscribers

Details

Reviewers
jlduran
jrm
ashish
Summary

clean_world() wipes NANO_WORLDDIR before install_world() runs, and
installworld itself never sets schg on installed files. Nothing
ever needs clearing, so the chflags -R noschg is dead code on both
privileged and unprivileged builds.

Sponsored by: Google LLC (GSoC 2026)

Diff Detail

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

Event Timeline

I would recommend squashing the majority of this commit with D58931, as the changes are mostly NFC (the leftovers).

tools/tools/nanobsd/defaults.sh
1017–1018

This is a "functional" change and should be submitted separately.

Isolate functional change (disable chflags in install_world) and normalize comments

senguptaangshuman17_gmail.com retitled this revision from nanobsd: Cleanup common functions to nanobsd: Disable chflags call in install_world().Thu, Aug 20, 7:04 PM

Commit message needs a why.

senguptaangshuman17_gmail.com retitled this revision from nanobsd: Disable chflags call in install_world() to nanobsd: Remove chflags call in install_world().Tue, Aug 25, 6:13 AM

While I do agree with the change, I do not fully agree with the commit message.
For me, the reason we want to remove this step is because we want to ship a NanoBSD image with the flags set just like a normal FreeBSD installation (/var/empty for instance).

While I do agree with the change, I do not fully agree with the commit message.
For me, the reason we want to remove this step is because we want to ship a NanoBSD image with the flags set just like a normal FreeBSD installation (/var/empty for instance).

will this work?

nanobsd: Remove chflags call in install_world()
     
NanoBSD images should retain file flags set by the installation process
(such as the schg flag on /var/empty) to match a standard FreeBSD
installation. Unconditionally stripping system flags with chflags -R noschg
after installworld removes these expected security flags.
    
clean_world() already takes care of clearing noschg when wiping
NANO_WORLDDIR and NANO_OBJ during clean builds.
     
Sponsored by:   Google LLC (GSoC 2026)
Differential Revision:  https://reviews.freebsd.org/D58957

While I do agree with the change, I do not fully agree with the commit message.
For me, the reason we want to remove this step is because we want to ship a NanoBSD image with the flags set just like a normal FreeBSD installation (/var/empty for instance).

will this work?

nanobsd: Remove chflags call in install_world()
     
NanoBSD images should retain file flags set by the installation process
(such as the schg flag on /var/empty) to match a standard FreeBSD
installation. Unconditionally stripping system flags with chflags -R noschg
after installworld removes these expected security flags.
    
clean_world() already takes care of clearing noschg when wiping
NANO_WORLDDIR and NANO_OBJ during clean builds.
     
Sponsored by:   Google LLC (GSoC 2026)
Differential Revision:  https://reviews.freebsd.org/D58957

Sure!