Patchwork lib: fwts_uefi: make vars work on recent kernels

login
register
mail settings
Submitter Colin King
Date April 19, 2013, 2:42 p.m.
Message ID <1366382568-25888-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/238005/
State Accepted
Headers show

Comments

Colin King - April 19, 2013, 2:42 p.m.
From: Colin Ian King <colin.king@canonical.com>

Looks like we need to check for PSTOREFS and EFIVARSFS magics
to make this work with recent kernels. Sigh.  Tested on 3.5 + 3.8
kernels.  Without this fix uefidump fails on 3.8 kernels.

Thanks to Stefan Bader for spotting this bug.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/src/fwts_uefi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Alex Hung - April 22, 2013, 1:30 a.m.
On 04/19/2013 10:42 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Looks like we need to check for PSTOREFS and EFIVARSFS magics
> to make this work with recent kernels. Sigh.  Tested on 3.5 + 3.8
> kernels.  Without this fix uefidump fails on 3.8 kernels.
>
> Thanks to Stefan Bader for spotting this bug.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_uefi.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index b3d0c36..8149d23 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -60,7 +60,8 @@ typedef struct {
>   #define UEFI_IFACE_EFIVARS		(3)	/* efivar fs */
>
>   /* File system magic numbers */
> -#define EFIVARS_FS_MAGIC	0x6165676C
> +#define PSTOREFS_MAGIC          0x6165676C
> +#define EFIVARFS_MAGIC          0xde5e81e4
>   #define SYS_FS_MAGIC		0x62656572
>
>   /*
> @@ -126,7 +127,8 @@ static int fwts_uefi_get_interface(char **path)
>   	/* We've now found a valid file system we can use */
>   	*path = efivar_path;
>
> -	if (statbuf.f_type == EFIVARS_FS_MAGIC) {
> +	if ((statbuf.f_type == EFIVARFS_MAGIC) ||
> +	    (statbuf.f_type == PSTOREFS_MAGIC)) {
>   		efivars_interface = UEFI_IFACE_EFIVARS;
>   		return UEFI_IFACE_EFIVARS;
>   	}
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Ivan Hu - April 22, 2013, 3:46 a.m.
On 04/19/2013 10:42 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Looks like we need to check for PSTOREFS and EFIVARSFS magics
> to make this work with recent kernels. Sigh.  Tested on 3.5 + 3.8
> kernels.  Without this fix uefidump fails on 3.8 kernels.
>
> Thanks to Stefan Bader for spotting this bug.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_uefi.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index b3d0c36..8149d23 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -60,7 +60,8 @@ typedef struct {
>   #define UEFI_IFACE_EFIVARS		(3)	/* efivar fs */
>
>   /* File system magic numbers */
> -#define EFIVARS_FS_MAGIC	0x6165676C
> +#define PSTOREFS_MAGIC          0x6165676C
> +#define EFIVARFS_MAGIC          0xde5e81e4
>   #define SYS_FS_MAGIC		0x62656572
>
>   /*
> @@ -126,7 +127,8 @@ static int fwts_uefi_get_interface(char **path)
>   	/* We've now found a valid file system we can use */
>   	*path = efivar_path;
>
> -	if (statbuf.f_type == EFIVARS_FS_MAGIC) {
> +	if ((statbuf.f_type == EFIVARFS_MAGIC) ||
> +	    (statbuf.f_type == PSTOREFS_MAGIC)) {
>   		efivars_interface = UEFI_IFACE_EFIVARS;
>   		return UEFI_IFACE_EFIVARS;
>   	}
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>
Colin King - April 22, 2013, 8:43 p.m.
On 19/04/13 15:42, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>

This fixes LP:#1171617

Kengu-Yu, do you mind added that bug number into the patch
when it is added to the repo.

Also, can we get fwts released as a SRU under this bug as it's quite an 
omission for uefidump to fail with recent kernels.

Thanks.

> Looks like we need to check for PSTOREFS and EFIVARSFS magics
> to make this work with recent kernels. Sigh.  Tested on 3.5 + 3.8
> kernels.  Without this fix uefidump fails on 3.8 kernels.
>
> Thanks to Stefan Bader for spotting this bug.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/src/fwts_uefi.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
> index b3d0c36..8149d23 100644
> --- a/src/lib/src/fwts_uefi.c
> +++ b/src/lib/src/fwts_uefi.c
> @@ -60,7 +60,8 @@ typedef struct {
>   #define UEFI_IFACE_EFIVARS		(3)	/* efivar fs */
>
>   /* File system magic numbers */
> -#define EFIVARS_FS_MAGIC	0x6165676C
> +#define PSTOREFS_MAGIC          0x6165676C
> +#define EFIVARFS_MAGIC          0xde5e81e4
>   #define SYS_FS_MAGIC		0x62656572
>
>   /*
> @@ -126,7 +127,8 @@ static int fwts_uefi_get_interface(char **path)
>   	/* We've now found a valid file system we can use */
>   	*path = efivar_path;
>
> -	if (statbuf.f_type == EFIVARS_FS_MAGIC) {
> +	if ((statbuf.f_type == EFIVARFS_MAGIC) ||
> +	    (statbuf.f_type == PSTOREFS_MAGIC)) {
>   		efivars_interface = UEFI_IFACE_EFIVARS;
>   		return UEFI_IFACE_EFIVARS;
>   	}
>
Keng-Yu Lin - April 23, 2013, 1:21 a.m.
On Tue, Apr 23, 2013 at 4:43 AM, Colin Ian King
<colin.king@canonical.com> wrote:
> On 19/04/13 15:42, Colin King wrote:
>>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>
> This fixes LP:#1171617
>
> Kengu-Yu, do you mind added that bug number into the patch
> when it is added to the repo.
>

No problem. Already done.

> Also, can we get fwts released as a SRU under this bug as it's quite an
> omission for uefidump to fail with recent kernels.
>

I will do the SRU.

> Thanks.
>
>> Looks like we need to check for PSTOREFS and EFIVARSFS magics
>> to make this work with recent kernels. Sigh.  Tested on 3.5 + 3.8
>> kernels.  Without this fix uefidump fails on 3.8 kernels.
>>
>> Thanks to Stefan Bader for spotting this bug.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>>   src/lib/src/fwts_uefi.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
>> index b3d0c36..8149d23 100644
>> --- a/src/lib/src/fwts_uefi.c
>> +++ b/src/lib/src/fwts_uefi.c
>> @@ -60,7 +60,8 @@ typedef struct {
>>   #define UEFI_IFACE_EFIVARS            (3)     /* efivar fs */
>>
>>   /* File system magic numbers */
>> -#define EFIVARS_FS_MAGIC       0x6165676C
>> +#define PSTOREFS_MAGIC          0x6165676C
>> +#define EFIVARFS_MAGIC          0xde5e81e4
>>   #define SYS_FS_MAGIC          0x62656572
>>
>>   /*
>> @@ -126,7 +127,8 @@ static int fwts_uefi_get_interface(char **path)
>>         /* We've now found a valid file system we can use */
>>         *path = efivar_path;
>>
>> -       if (statbuf.f_type == EFIVARS_FS_MAGIC) {
>> +       if ((statbuf.f_type == EFIVARFS_MAGIC) ||
>> +           (statbuf.f_type == PSTOREFS_MAGIC)) {
>>                 efivars_interface = UEFI_IFACE_EFIVARS;
>>                 return UEFI_IFACE_EFIVARS;
>>         }
>>
>
>
> --
> fwts-devel mailing list
> fwts-devel@lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/fwts-devel

Patch

diff --git a/src/lib/src/fwts_uefi.c b/src/lib/src/fwts_uefi.c
index b3d0c36..8149d23 100644
--- a/src/lib/src/fwts_uefi.c
+++ b/src/lib/src/fwts_uefi.c
@@ -60,7 +60,8 @@  typedef struct {
 #define UEFI_IFACE_EFIVARS		(3)	/* efivar fs */
 
 /* File system magic numbers */
-#define EFIVARS_FS_MAGIC	0x6165676C
+#define PSTOREFS_MAGIC          0x6165676C
+#define EFIVARFS_MAGIC          0xde5e81e4
 #define SYS_FS_MAGIC		0x62656572
 
 /*
@@ -126,7 +127,8 @@  static int fwts_uefi_get_interface(char **path)
 	/* We've now found a valid file system we can use */
 	*path = efivar_path;
 
-	if (statbuf.f_type == EFIVARS_FS_MAGIC) {
+	if ((statbuf.f_type == EFIVARFS_MAGIC) ||
+	    (statbuf.f_type == PSTOREFS_MAGIC)) {
 		efivars_interface = UEFI_IFACE_EFIVARS;
 		return UEFI_IFACE_EFIVARS;
 	}