lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 29 Oct 2012 13:12:58 -0700
From:	Mike Waychison <mikew@...gle.com>
To:	Seiji Aguchi <seiji.aguchi@....com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-efi@...r.kernel.org" <linux-efi@...r.kernel.org>,
	"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
	"Luck, Tony (tony.luck@...el.com)" <tony.luck@...el.com>,
	"Matthew Garrett (mjg@...hat.com)" <mjg@...hat.com>,
	"dzickus@...hat.com" <dzickus@...hat.com>,
	"dle-develop@...ts.sourceforge.net" 
	<dle-develop@...ts.sourceforge.net>,
	Satoru Moriya <satoru.moriya@....com>
Subject: Re: [PATCH v3 6/7] efi_pstore: Add a format check for an existing
 variable name at reading time

On Fri, Oct 26, 2012 at 2:43 PM, Seiji Aguchi <seiji.aguchi@....com> wrote:
> [Issue]
>
> A format of variable name has been updated to type, id, count and ctime
> to support holding multiple logs.
>
> Format of current variable name
>   dump-type0-1-2-12345678
>
>   type:0
>   id:1
>   count:2
>   ctime:12345678
>
> On the other hand, if an old variable name before being updated
> remains, users can't read it via /dev/pstore.
>
> Format of old variable name
>   dump-type0-1-12345678
>
>   type:0
>   id:1
>   ctime:12345678
>
> [Solution]
>
> This patch adds a format check for the old variable name in a read callback
> to make it readable.
>
> Signed-off-by: Seiji Aguchi <seiji.aguchi@....com>
> ---
>  drivers/firmware/efivars.c |   38 ++++++++++++++++++++++++++++----------
>  1 files changed, 28 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
> index dc69802..dd228d5 100644
> --- a/drivers/firmware/efivars.c
> +++ b/drivers/firmware/efivars.c
> @@ -681,17 +681,35 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
>                                 *count = cnt;
>                                 timespec->tv_sec = time;
>                                 timespec->tv_nsec = 0;
> -                               get_var_data_locked(efivars, &efivars->walk_entry->var);
> -                               size = efivars->walk_entry->var.DataSize;
> -                               *buf = kmalloc(size, GFP_KERNEL);
> -                               if (*buf == NULL)
> -                                       return -ENOMEM;
> -                               memcpy(*buf, efivars->walk_entry->var.Data,
> -                                      size);
> -                               efivars->walk_entry = list_entry(efivars->walk_entry->list.next,
> -                                                  struct efivar_entry, list);
> -                               return size;
> +                       } else if (sscanf(name, "dump-type%u-%u-%lu",
> +                                  type, &part, &time) == 3) {
> +                               /*
> +                                * Check if an old format,
> +                                * which doesn't support holding
> +                                * multiple logs, remains.
> +                                */
> +                               *id = part;
> +                               *count = 0;
> +                               timespec->tv_sec = time;
> +                               timespec->tv_nsec = 0;
> +                       } else {
> +                               efivars->walk_entry = list_entry(
> +                                       efivars->walk_entry->list.next,
> +                                        struct efivar_entry, list);

odd wrap.

> +                               continue;
>                         }
> +
> +                       get_var_data_locked(efivars, &efivars->walk_entry->var);
> +                       size = efivars->walk_entry->var.DataSize;
> +                       *buf = kmalloc(size, GFP_KERNEL);
> +                       if (*buf == NULL)
> +                               return -ENOMEM;
> +                       memcpy(*buf, efivars->walk_entry->var.Data,
> +                              size);
> +                       efivars->walk_entry = list_entry(
> +                                       efivars->walk_entry->list.next,
> +                                       struct efivar_entry, list);
> +                       return size;
>                 }
>                 efivars->walk_entry = list_entry(efivars->walk_entry->list.next,
>                                                  struct efivar_entry, list);
> -- 1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ