Skip to content

Commit 63ffb57

Browse files
zx2c4ardbiesheuvel
authored andcommitted
efi: vars: prohibit reading random seed variables
In anticipation of putting random seeds in EFI variables, it's important that the random GUID namespace of variables remains hidden from userspace. We accomplish this by not populating efivarfs with entries from that GUID, as well as denying the creation of new ones in that GUID. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 196dff2 commit 63ffb57

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

fs/efivarfs/inode.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ static int efivarfs_create(struct user_namespace *mnt_userns, struct inode *dir,
9191
err = guid_parse(dentry->d_name.name + namelen + 1, &var->var.VendorGuid);
9292
if (err)
9393
goto out;
94+
if (guid_equal(&var->var.VendorGuid, &LINUX_EFI_RANDOM_SEED_TABLE_GUID)) {
95+
err = -EPERM;
96+
goto out;
97+
}
9498

9599
if (efivar_variable_is_removable(var->var.VendorGuid,
96100
dentry->d_name.name, namelen))

fs/efivarfs/super.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor,
116116
int err = -ENOMEM;
117117
bool is_removable = false;
118118

119+
if (guid_equal(&vendor, &LINUX_EFI_RANDOM_SEED_TABLE_GUID))
120+
return 0;
121+
119122
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
120123
if (!entry)
121124
return err;

0 commit comments

Comments
 (0)