Skip to contentSkip to conversation

Add missing attributes to EFI variable attribute print out from sysfs

PATCH Superseded Khalid Aziz 4 participants 12 messages Jul 13, 2012 – Sep 10, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add missing attributes to EFI variable attribute print out from sysfs

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

---
 drivers/firmware/efivars.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +14 -3
index 47408e8..d10c987 100644
@@ -435,12 +435,23 @@ efivar_attr_read(struct efivar_entry *entry, char *buf)
 	if (status != EFI_SUCCESS)
 		return -EIO;
 
-	if (var->Attributes & 0x1)
+	if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
 		str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n");
-	if (var->Attributes & 0x2)
+	if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n");
-	if (var->Attributes & 0x4)
+	if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+		str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n");
+	if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes &
+			EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_APPEND_WRITE)
+		str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n");
 	return str - buf;
 }
 
Signature · 5 lines
1.7.9.5

-- 
Khalid Aziz
[email protected]
#2 lore raw
Quoted 9 lines · Matthew Garrett
Quoted 7 lines · Khalid Aziz

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

I have not seen this patch show up in linux-next or 3.6-rc*. Do I need to do anything more to get this patch integrated?

Thanks

Signature · 1 line
Khalid Aziz <[email protected]>
#3 lore raw
In reply to Khalid Aziz

Greg,

Can you please pick this patch up in one of your trees?

Thanks!

Mike Waychison

Quoted 48 lines · Khalid Aziz

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

---
 drivers/firmware/efivars.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +14 -4
index 47408e8..d10c987 100644
@@ -435,12 +435,23 @@ efivar_attr_read(struct efivar_entry *entry, char *buf)
        if (status != EFI_SUCCESS)
                return -EIO;
 
-       if (var->Attributes & 0x1)
+       if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
                str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n");
-       if (var->Attributes & 0x2)
+       if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)
                str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n");
-       if (var->Attributes & 0x4)
+       if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)
                str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n");
+       if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+               str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n");
+       if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
+               str += sprintf(str,
+                       "EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n");
+       if (var->Attributes &
+                       EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
+               str += sprintf(str,
+                       "EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n");
+       if (var->Attributes & EFI_VARIABLE_APPEND_WRITE)
+               str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n");
        return str - buf;
 }
 
--

1.7.9.5

--
Khalid Aziz
[email protected]

#4 lore raw
Quoted 3 lines · Mike Waychison

Greg,

Can you please pick this patch up in one of your trees?

Resend using a good email addy for gregkh :)

Quoted 54 lines

Thanks!

Mike Waychison

Quoted 48 lines · Khalid Aziz

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

---
 drivers/firmware/efivars.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +14 -4
index 47408e8..d10c987 100644
@@ -435,12 +435,23 @@ efivar_attr_read(struct efivar_entry *entry, char *buf)
        if (status != EFI_SUCCESS)
                return -EIO;
 
-       if (var->Attributes & 0x1)
+       if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
                str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n");
-       if (var->Attributes & 0x2)
+       if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)
                str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n");
-       if (var->Attributes & 0x4)
+       if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)
                str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n");
+       if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+               str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n");
+       if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
+               str += sprintf(str,
+                       "EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n");
+       if (var->Attributes &
+                       EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
+               str += sprintf(str,
+                       "EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n");
+       if (var->Attributes & EFI_VARIABLE_APPEND_WRITE)
+               str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n");
        return str - buf;
 }
 
--

1.7.9.5

--
Khalid Aziz
[email protected]

#5 lore raw
Quoted 6 lines · Mike Waychison
Quoted 3 lines · Mike Waychison

Greg,

Can you please pick this patch up in one of your trees?

Resend using a good email addy for gregkh :)

Can someone resend it in a format that I can apply it in? I can't find the original anymore, sorry.

greg k-h

#6 lore raw
Quoted 4 lines · Greg KH
Quoted 3 lines · Mike Waychison
Quoted 2 lines · Mike Waychison

Greg,

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Can you please pick this patch up in one of your trees?

Resend using a good email addy for gregkh :)

Can someone resend it in a format that I can apply it in? I can't find the original anymore, sorry.

greg k-h

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

drivers/firmware/efivars.c +14 -3
index 47408e8..d10c987 100644
@@ -435,12 +435,23 @@ efivar_attr_read(struct efivar_entry *entry, char *buf)
 	if (status != EFI_SUCCESS)
 		return -EIO;
 
-	if (var->Attributes & 0x1)
+	if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
 		str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n");
-	if (var->Attributes & 0x2)
+	if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n");
-	if (var->Attributes & 0x4)
+	if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+		str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n");
+	if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes &
+			EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_APPEND_WRITE)
+		str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n");
 	return str - buf;
 }
 

--
1.7.9.5

Signature · 1 line
Khalid Aziz <[email protected]>
#7 lore raw

drivers/firmware/efivars.c

Quoted 22 lines · Khalid Aziz
Quoted 4 lines · Greg KH
Quoted 3 lines · Mike Waychison
Quoted 2 lines · Mike Waychison

Greg,

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Can you please pick this patch up in one of your trees?

Resend using a good email addy for gregkh :)

Can someone resend it in a format that I can apply it in? I can't find the original anymore, sorry.

greg k-h

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

drivers/firmware/efivars.c +0 -0
index 47408e8..d10c987 100644

This isn't in a format I can apply it in, without having to edit the heck out of the email by hand :(

Care to try it again, adding the different acks it picked up along the review way, and send it, again as I asked for, in a format I can apply it in?

greg k-h

author Reviewed-by Kees Cook Acked-by Matthew Garrett
#8 lore raw

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

---
 drivers/firmware/efivars.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +14 -3
index 47408e8..d10c987 100644
@@ -435,12 +435,23 @@ efivar_attr_read(struct efivar_entry *entry, char *buf)
 	if (status != EFI_SUCCESS)
 		return -EIO;
 
-	if (var->Attributes & 0x1)
+	if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
 		str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n");
-	if (var->Attributes & 0x2)
+	if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n");
-	if (var->Attributes & 0x4)
+	if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+		str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n");
+	if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes &
+			EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_APPEND_WRITE)
+		str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n");
 	return str - buf;
 }
 

--
1.7.9.5

#9 lore raw

drivers/firmware/efivars.c

Quoted 14 lines · Khalid Aziz

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

---
 drivers/firmware/efivars.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +0 -0
index 47408e8..d10c987 100644

Ah, so close...

What's with the "Re:" in the Subject"?

And what happened to the extra line that should be after the diffstat and before the "diff --" line?

Third time's a charm?

greg k-h

#10 lore raw

PATCH RESEND v2 1/1 Add missing attributes to EFI variable attribute print out from sysfs

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

---
 drivers/firmware/efivars.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +14 -3
index 47408e8..d10c987 100644
@@ -435,12 +435,23 @@ efivar_attr_read(struct efivar_entry *entry, char *buf)
 	if (status != EFI_SUCCESS)
 		return -EIO;
 
-	if (var->Attributes & 0x1)
+	if (var->Attributes & EFI_VARIABLE_NON_VOLATILE)
 		str += sprintf(str, "EFI_VARIABLE_NON_VOLATILE\n");
-	if (var->Attributes & 0x2)
+	if (var->Attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_BOOTSERVICE_ACCESS\n");
-	if (var->Attributes & 0x4)
+	if (var->Attributes & EFI_VARIABLE_RUNTIME_ACCESS)
 		str += sprintf(str, "EFI_VARIABLE_RUNTIME_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD)
+		str += sprintf(str, "EFI_VARIABLE_HARDWARE_ERROR_RECORD\n");
+	if (var->Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes &
+			EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)
+		str += sprintf(str,
+			"EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS\n");
+	if (var->Attributes & EFI_VARIABLE_APPEND_WRITE)
+		str += sprintf(str, "EFI_VARIABLE_APPEND_WRITE\n");
 	return str - buf;
 }
 

--
1.7.9.5

#11 lore raw
In reply to Greg KH
Quoted 18 lines · Greg KH

drivers/firmware/efivars.c

Quoted 14 lines · Khalid Aziz

Some of the EFI variable attributes are missing from print out from /sys/firmware/efi/vars/*/attributes. This patch adds those in. It also updates code to use pre-defined constants for masking current value of attributes.

---
 drivers/firmware/efivars.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/firmware/efivars.c +0 -0
index 47408e8..d10c987 100644

Ah, so close...

Quoted 6 lines

What's with the "Re:" in the Subject"?

And what happened to the extra line that should be after the diffstat and before the "diff --" line?

Third time's a charm?

Sorry, Greg. I screwed up. I need to pay closer attention. Hopefully the one I just sent out does the job.

Signature · 1 line
Khalid Aziz <[email protected]>