Page MenuHomeFreeBSD

Add boot_setenv
ClosedPublic

Authored by sjg on Apr 7 2026, 12:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, May 12, 10:40 AM
Unknown Object (File)
Sat, May 9, 9:25 PM
Unknown Object (File)
Sat, May 9, 9:19 PM
Unknown Object (File)
Sat, May 9, 6:15 PM
Unknown Object (File)
Sat, May 9, 6:09 PM
Unknown Object (File)
Thu, Apr 30, 2:21 PM
Unknown Object (File)
Wed, Apr 29, 8:22 PM
Unknown Object (File)
Wed, Apr 29, 8:15 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 Not Applicable
Unit
Tests Not Applicable

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.