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
F168474162: D58957.id184322.diff
Fri, Aug 28, 2:05 PM
F168466033: D58957.id185262.diff
Fri, Aug 28, 1:15 PM
F168447065: D58957.id184832.diff
Fri, Aug 28, 10:15 AM
F168435637: D58957.diff
Fri, Aug 28, 8:15 AM
F168426487: D58957.id184995.diff
Fri, Aug 28, 6:29 AM
F168393179: D58957.id184832.diff
Thu, Aug 27, 11:54 PM
Unknown Object (File)
Thu, Aug 27, 8:31 PM
Unknown Object (File)
Thu, Aug 27, 8:29 PM
Subscribers

Details

Reviewers
jlduran
jrm
ashish
Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75912
Build 72795: 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
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!