Page MenuHomeFreeBSD

Add boot_setenv
ClosedPublic

Authored by sjg on Apr 7 2026, 12:01 AM.
Tags
None
Referenced Files
F168812549: D56287.diff
Sun, Aug 30, 6:52 AM
F168783738: D56287.id175014.diff
Sun, Aug 30, 3:31 AM
F168703247: D56287.id175056.diff
Sat, Aug 29, 5:32 PM
Unknown Object (File)
Thu, Aug 27, 8:20 AM
Unknown Object (File)
Thu, Aug 27, 5:22 AM
Unknown Object (File)
Thu, Aug 27, 3:41 AM
Unknown Object (File)
Sun, Aug 16, 5:30 PM
Unknown Object (File)
Wed, Aug 12, 3:07 PM
Subscribers

Details

Summary

Move is_restricted_var() to libsa/environment.c so it can be leveraged
by boot_setenv called from subr_boot with not truted input.

Also, allow for local tuning via ENV_IS_RESTRICTED_ALLOWED_LIST and
ENV_IS_RESTRICTED_LIST

Sponsored by: Hewlett Packard Enterprise Development LP.

Diff Detail

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

Event Timeline

sjg requested review of this revision.Apr 7 2026, 12:01 AM

I think the concept is fine, my main nit is: do we want to call this secure_setenv for symmetry with the secure_getenv name we use in libc, for use in security-sensitive getenv() calls?

I think the concept is fine, my main nit is: do we want to call this secure_setenv for symmetry with the secure_getenv name we use in libc, for use in security-sensitive getenv() calls?

Good question, I chose boot_setenv to as that seemed to fit with what subr_boot.c looked like, but I'm not wedded to any name

I like this, and also @kevans 's suggestion.

This revision is now accepted and ready to land.Apr 7 2026, 1:54 AM
In D56287#1287811, @imp wrote:

I like this, and also @kevans 's suggestion.

So rename it to secure_setenv ?

In D56287#1287814, @sjg wrote:
In D56287#1287811, @imp wrote:

I like this, and also @kevans 's suggestion.

So rename it to secure_setenv ?

Actually I'm not sure that's a good idea, boot_setenv makes no promise about any care it might take, and if check_restricted is false it just calls setenv.
secure_setenv might be appropriate if it for example forced check_restricted true, but that could easily be a POLA violation.

This revision was automatically updated to reflect the committed changes.