Page MenuHomeFreeBSD

D62091.1795753380.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D62091.1795753380.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
@@ -72,9 +72,19 @@
.Va boot_lockdown
to be overridden or unset.
.Pp
-The are currently no policies enabled by
-.Xr loader.efi 8
-when secureboot is enforced.
+In lockdown, the loader enforces the following policies:
+.Bl -bullet
+.It
+The device tree may only be changed by loading a verified
+.Dq dtb
+or
+.Dq dtbo .
+The
+.Ic fdt
+subcommands that modify it
+.Pq Cm addr , alias , mknode , mkprop , rm , No and Cm prop No with a value
+are denied.
+.El
.Pp
Independent of secureboot, if the loader is built with
.Xr veriexec 8
diff --git a/stand/fdt/fdt_loader_cmd.c b/stand/fdt/fdt_loader_cmd.c
--- a/stand/fdt/fdt_loader_cmd.c
+++ b/stand/fdt/fdt_loader_cmd.c
@@ -54,6 +54,8 @@
#define FDT_STATIC_DTB_SYMBOL "fdt_static_dtb"
#define CMD_REQUIRES_BLOB 0x01
+/* Fail closed: subcommands that may modify the blob are denied in lockdown. */
+#define CMD_LOCKDOWN 0x02
/* Location of FDT yet to be loaded. */
/* This may be in read-only memory, so can't be manipulated directly. */
@@ -95,14 +97,15 @@
static const struct cmdtab commands[] = {
{ "addr", &fdt_cmd_addr, 0 },
{ "alias", &fdt_cmd_nyi, 0 },
- { "cd", &fdt_cmd_cd, CMD_REQUIRES_BLOB },
- { "header", &fdt_cmd_hdr, CMD_REQUIRES_BLOB },
- { "ls", &fdt_cmd_ls, CMD_REQUIRES_BLOB },
+ { "cd", &fdt_cmd_cd, CMD_REQUIRES_BLOB | CMD_LOCKDOWN },
+ { "header", &fdt_cmd_hdr, CMD_REQUIRES_BLOB | CMD_LOCKDOWN },
+ { "ls", &fdt_cmd_ls, CMD_REQUIRES_BLOB | CMD_LOCKDOWN },
{ "mknode", &fdt_cmd_mknode, CMD_REQUIRES_BLOB },
{ "mkprop", &fdt_cmd_mkprop, CMD_REQUIRES_BLOB },
- { "mres", &fdt_cmd_mres, CMD_REQUIRES_BLOB },
- { "prop", &fdt_cmd_prop, CMD_REQUIRES_BLOB },
- { "pwd", &fdt_cmd_pwd, CMD_REQUIRES_BLOB },
+ { "mres", &fdt_cmd_mres, CMD_REQUIRES_BLOB | CMD_LOCKDOWN },
+ /* prop checks lockdown itself, as it may either display or modify. */
+ { "prop", &fdt_cmd_prop, CMD_REQUIRES_BLOB | CMD_LOCKDOWN },
+ { "pwd", &fdt_cmd_pwd, CMD_REQUIRES_BLOB | CMD_LOCKDOWN },
{ "rm", &fdt_cmd_rm, CMD_REQUIRES_BLOB },
{ NULL, NULL }
};
@@ -1039,6 +1042,12 @@
return (CMD_ERROR);
}
+ if ((flags & CMD_LOCKDOWN) == 0 && loader_in_lockdown()) {
+ snprintf(command_errbuf, sizeof(command_errbuf),
+ "fdt %s is denied by security policy", argv[1]);
+ return (CMD_ERROR);
+ }
+
if (flags & CMD_REQUIRES_BLOB) {
/*
* Check if uboot env vars were parsed already. If not, do it now.
@@ -1681,6 +1690,13 @@
if (value) {
/* If value is specified -- try to modify prop. */
+ if (loader_in_lockdown()) {
+ free(value);
+ snprintf(command_errbuf, sizeof(command_errbuf),
+ "fdt %s: modification is denied by security policy",
+ argv[1]);
+ return (CMD_ERROR);
+ }
if (fdt_extract_nameloc(&path, &propname, &o) != 0)
return (CMD_ERROR);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 27, 4:23 AM (19 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42035118
Default Alt Text
D62091.1795753380.diff (2 KB)

Event Timeline