Skip to contentSkip to conversation

efi/esrt: Allow ESRT access without CAP_SYS_ADMIN

PATCH In review Nicholas Bishop 3 participants 4 messages May 12, 2023 – Jun 6, 2023 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efi/esrt: Allow ESRT access without CAP_SYS_ADMIN

Access to the files in /sys/firmware/efi/esrt has been restricted to CAP_SYS_ADMIN since support for ESRT was added, but this seems overly restrictive given that the files are read-only and just provide information about UEFI firmware updates.

Remove the CAP_SYS_ADMIN restriction so that a non-root process can read the files, provided a suitably-privileged process changes the file ownership first. The files are still read-only and still owned by root by default.

---
 drivers/firmware/efi/esrt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/firmware/efi/esrt.c +0 -4
index d5915272141f..aab96ab64a1a 100644
@@ -95,10 +95,6 @@ static ssize_t esre_attr_show(struct kobject *kobj,
 	struct esre_entry *entry = to_entry(kobj);
 	struct esre_attribute *attr = to_attr(_attr);
 
-	/* Don't tell normal users what firmware versions we've got... */
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
 	return attr->show(entry, buf);
 }
 
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
maintainer
#1 lore raw
Quoted 6 lines · Nicholas Bishop

Access to the files in /sys/firmware/efi/esrt has been restricted to CAP_SYS_ADMIN since support for ESRT was added, but this seems overly restrictive given that the files are read-only and just provide information about UEFI firmware updates.

Quoted 6 lines

Remove the CAP_SYS_ADMIN restriction so that a non-root process can read the files, provided a suitably-privileged process changes the file ownership first. The files are still read-only and still owned by root by default.

Seems reasonable to me. Peter?

Quoted 22 lines
---
 drivers/firmware/efi/esrt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/firmware/efi/esrt.c +0 -5
index d5915272141f..aab96ab64a1a 100644
@@ -95,10 +95,6 @@ static ssize_t esre_attr_show(struct kobject *kobj,
        struct esre_entry *entry = to_entry(kobj);
        struct esre_attribute *attr = to_attr(_attr);
 
-       /* Don't tell normal users what firmware versions we've got... */
-       if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
-
        return attr->show(entry, buf);
 }
 
--

2.40.1.606.ga4b1b128d6-goog

maintainer
#2 lore raw
Quoted 8 lines · Ard Biesheuvel
Quoted 6 lines · Nicholas Bishop

Access to the files in /sys/firmware/efi/esrt has been restricted to CAP_SYS_ADMIN since support for ESRT was added, but this seems overly restrictive given that the files are read-only and just provide information about UEFI firmware updates.

Quoted 9 lines
Quoted 6 lines

Remove the CAP_SYS_ADMIN restriction so that a non-root process can read the files, provided a suitably-privileged process changes the file ownership first. The files are still read-only and still owned by root by default.

Seems reasonable to me. Peter?

I've queued this up now.

Quoted 22 lines
Quoted 22 lines
---
 drivers/firmware/efi/esrt.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/firmware/efi/esrt.c +0 -5
index d5915272141f..aab96ab64a1a 100644
@@ -95,10 +95,6 @@ static ssize_t esre_attr_show(struct kobject *kobj,
        struct esre_entry *entry = to_entry(kobj);
        struct esre_attribute *attr = to_attr(_attr);
 
-       /* Don't tell normal users what firmware versions we've got... */
-       if (!capable(CAP_SYS_ADMIN))
-               return -EACCES;
-
        return attr->show(entry, buf);
 }
 
--

2.40.1.606.ga4b1b128d6-goog

#3 lore raw
In reply to Ard Biesheuvel
Quoted 8 lines · Ard Biesheuvel
Quoted 6 lines · Nicholas Bishop

Access to the files in /sys/firmware/efi/esrt has been restricted to CAP_SYS_ADMIN since support for ESRT was added, but this seems overly restrictive given that the files are read-only and just provide information about UEFI firmware updates.

Quoted 8 lines
Quoted 6 lines

Remove the CAP_SYS_ADMIN restriction so that a non-root process can read the files, provided a suitably-privileged process changes the file ownership first. The files are still read-only and still owned by root by default.

Seems reasonable to me. Peter?

Yeah, I don't think we had any specific reason to limit it.

-- Peter