Page MenuHomeFreeBSD

D62096.1795753997.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D62096.1795753997.diff

diff --git a/share/man/man7/secureboot.7 b/share/man/man7/secureboot.7
--- a/share/man/man7/secureboot.7
+++ b/share/man/man7/secureboot.7
@@ -75,6 +75,30 @@
In lockdown, the loader enforces the following policies:
.Bl -bullet
.It
+Restricted variables may not be set or unset at the loader prompt, from the
+loader's command line, or from the
+.Va LoaderEnv
+and
+.Va NextLoaderEnv
+EFI variables.
+Restricted variables are those with names beginning with
+.Dq boot ,
+.Dq init ,
+.Dq loader.ve. ,
+.Dq rootfs ,
+.Dq secur ,
+or
+.Dq vfs. ,
+except for
+.Va boot_lockdown ,
+.Va boot_multicons ,
+.Va boot_mutemsgs ,
+.Va boot_safe ,
+.Va boot_serial ,
+.Va boot_single ,
+and
+.Va boot_verbose .
+.It
The device tree may only be changed by loading a verified
.Dq dtb
or
diff --git a/stand/common/commands.c b/stand/common/commands.c
--- a/stand/common/commands.c
+++ b/stand/common/commands.c
@@ -314,7 +314,12 @@
int ves;
ves = ve_status_get(-1);
- if (ves == VE_UNVERIFIED_OK) {
+ /*
+ * If we aren't verifying, then nothing vouches for this either
+ * way, and lockdown decides as it would without veriexec.
+ */
+ if (ves == VE_UNVERIFIED_OK ||
+ (ves == VE_NOT_VERIFYING && loader_in_lockdown())) {
#ifdef LOADER_VERIEXEC_TESTING
printf("Checking: %s\n", argv[1]);
#endif
@@ -324,6 +329,12 @@
return (CMD_OK);
}
}
+#else
+ if (loader_in_lockdown() && is_restricted_var(argv[1])) {
+ printf("Ignoring restricted variable: %s\n",
+ argv[1]);
+ return (CMD_OK);
+ }
#endif
if ((err = putenv(argv[1])) != 0) {
command_errmsg = strerror(err);
@@ -353,13 +364,20 @@
int ves;
ves = ve_status_get(-1);
- if (ves == VE_UNVERIFIED_OK) {
+ if (ves == VE_UNVERIFIED_OK ||
+ (ves == VE_NOT_VERIFYING && loader_in_lockdown())) {
if (is_restricted_var(argv[1])) {
printf("Ignoring restricted variable: %s\n",
argv[1]);
return (CMD_OK);
}
}
+#else
+ if (loader_in_lockdown() && is_restricted_var(argv[1])) {
+ printf("Ignoring restricted variable: %s\n",
+ argv[1]);
+ return (CMD_OK);
+ }
#endif
if ((err = unsetenv(argv[1])) != 0) {
command_errmsg = strerror(err);
diff --git a/stand/common/misc.c b/stand/common/misc.c
--- a/stand/common/misc.c
+++ b/stand/common/misc.c
@@ -246,6 +246,8 @@
loader_latch_lockdown(void)
{
boot_lockdown = true;
+ /* Start restricting env vars, too. */
+ set_check_restricted(true);
}
static int
diff --git a/stand/libsa/environment.c b/stand/libsa/environment.c
--- a/stand/libsa/environment.c
+++ b/stand/libsa/environment.c
@@ -292,6 +292,7 @@
boot_setenv(const char *name, const char *value)
{
if (check_restricted && is_restricted_var(name)) {
+ printf("Ignoring restricted variable: %s\n", name);
errno = EPERM;
return -1;
}

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 27, 4:33 AM (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42035104
Default Alt Text
D62096.1795753997.diff (2 KB)

Event Timeline