All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/2] EFI urgent fixes
@ 2016-02-16 12:59 Matt Fleming
  2016-02-16 12:59 ` [PATCH 1/2] efi: Add pstore variables to the deletion whitelist Matt Fleming
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Matt Fleming @ 2016-02-16 12:59 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin
  Cc: Ard Biesheuvel, Matt Fleming, linux-kernel, linux-efi,
	Jason Andryuk, Laszlo Ersek, Lee, Chun-Yi, Matthew Garrett,
	Peter Jones

Folks, here are some bug fixes that missed the previous pull request
but that are related to those patches.

The following changes since commit 4682c211a80ee93214b72d95f861b0f6e90e5445:

  Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/urgent (2016-02-16 13:14:57 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git tags/efi-urgent

for you to fetch changes up to a68075908a37850918ad96b056acc9ac4ce1bd90:

  lib/ucs2_string: Correct ucs2 -> utf8 conversion (2016-02-16 12:49:05 +0000)

----------------------------------------------------------------
 * Fix bugs in our code that converts ucs2 strings to utf8 where we
   unintentionally drop bits from the original string - Jason Andryuk

 * Add the efi-pstore variables to the variable whitelist so that
   users can continue to delete them via efivarfs without needing to
   manipulate the immutable flag - Matt Fleming

----------------------------------------------------------------
Jason Andryuk (1):
      lib/ucs2_string: Correct ucs2 -> utf8 conversion

Matt Fleming (1):
      efi: Add pstore variables to the deletion whitelist

 drivers/firmware/efi/vars.c |  1 +
 lib/ucs2_string.c           | 14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] efi: Add pstore variables to the deletion whitelist
  2016-02-16 12:59 [GIT PULL 0/2] EFI urgent fixes Matt Fleming
@ 2016-02-16 12:59 ` Matt Fleming
  2016-02-16 12:59 ` [PATCH 2/2] lib/ucs2_string: Correct ucs2 -> utf8 conversion Matt Fleming
  2016-02-16 15:47 ` [GIT PULL 0/2] EFI urgent fixes Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Matt Fleming @ 2016-02-16 12:59 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin
  Cc: Ard Biesheuvel, Matt Fleming, linux-kernel, linux-efi,
	Matthew Garrett, Lee, Chun-Yi, Laszlo Ersek, Peter Jones

Laszlo explains why this is a good idea,

 'This is because the pstore filesystem can be backed by UEFI variables,
  and (for example) a crash might dump the last kilobytes of the dmesg
  into a number of pstore entries, each entry backed by a separate UEFI
  variable in the above GUID namespace, and with a variable name
  according to the above pattern.

  Please see "drivers/firmware/efi/efi-pstore.c".

  While this patch series will not prevent the user from deleting those
  UEFI variables via the pstore filesystem (i.e., deleting a pstore fs
  entry will continue to delete the backing UEFI variable), I think it
  would be nice to preserve the possibility for the sysadmin to delete
  Linux-created UEFI variables that carry portions of the crash log,
  *without* having to mount the pstore filesystem.'

There's also no chance of causing machines to become bricked by
deleting these variables, which is the whole purpose of excluding
things from the whitelist.

Use the LINUX_EFI_CRASH_GUID guid and a wildcard '*' for the match so
that we don't have to update the string in the future if new variable
name formats are created for crash dump variables.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Peter Jones <pjones@redhat.com>
Tested-by: Peter Jones <pjones@redhat.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 drivers/firmware/efi/vars.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c
index 50f10bad2604..7f2ea21c730d 100644
--- a/drivers/firmware/efi/vars.c
+++ b/drivers/firmware/efi/vars.c
@@ -198,6 +198,7 @@ static const struct variable_validate variable_validate[] = {
 	{ EFI_GLOBAL_VARIABLE_GUID, "OsIndications", NULL },
 	{ EFI_GLOBAL_VARIABLE_GUID, "PlatformLang", validate_ascii_string },
 	{ EFI_GLOBAL_VARIABLE_GUID, "Timeout", validate_uint16 },
+	{ LINUX_EFI_CRASH_GUID, "*", NULL },
 	{ NULL_GUID, "", NULL },
 };
 
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] lib/ucs2_string: Correct ucs2 -> utf8 conversion
  2016-02-16 12:59 [GIT PULL 0/2] EFI urgent fixes Matt Fleming
  2016-02-16 12:59 ` [PATCH 1/2] efi: Add pstore variables to the deletion whitelist Matt Fleming
@ 2016-02-16 12:59 ` Matt Fleming
  2016-02-16 15:47 ` [GIT PULL 0/2] EFI urgent fixes Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Matt Fleming @ 2016-02-16 12:59 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H . Peter Anvin
  Cc: Ard Biesheuvel, Jason Andryuk, linux-kernel, linux-efi,
	Peter Jones, Matthew Garrett, Lee, Chun-Yi, Matt Fleming,
	Laszlo Ersek

From: Jason Andryuk <jandryuk@gmail.com>

The comparisons should be >= since 0x800 and 0x80 require an additional bit
to store.

For the 3 byte case, the existing shift would drop off 2 more bits than
intended.

For the 2 byte case, there should be 5 bits bits in byte 1, and 6 bits in
byte 2.

Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Cc: Peter Jones <pjones@redhat.com>
Cc: Matthew Garrett <mjg59@coreos.com>
Cc: "Lee, Chun-Yi" <jlee@suse.com>
Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk>
---
 lib/ucs2_string.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/ucs2_string.c b/lib/ucs2_string.c
index 17dd74e21ef9..f0b323abb4c6 100644
--- a/lib/ucs2_string.c
+++ b/lib/ucs2_string.c
@@ -59,9 +59,9 @@ ucs2_utf8size(const ucs2_char_t *src)
 	for (i = 0; i < ucs2_strlen(src); i++) {
 		u16 c = src[i];
 
-		if (c > 0x800)
+		if (c >= 0x800)
 			j += 3;
-		else if (c > 0x80)
+		else if (c >= 0x80)
 			j += 2;
 		else
 			j += 1;
@@ -88,19 +88,19 @@ ucs2_as_utf8(u8 *dest, const ucs2_char_t *src, unsigned long maxlength)
 	for (i = 0; maxlength && i < limit; i++) {
 		u16 c = src[i];
 
-		if (c > 0x800) {
+		if (c >= 0x800) {
 			if (maxlength < 3)
 				break;
 			maxlength -= 3;
 			dest[j++] = 0xe0 | (c & 0xf000) >> 12;
-			dest[j++] = 0x80 | (c & 0x0fc0) >> 8;
+			dest[j++] = 0x80 | (c & 0x0fc0) >> 6;
 			dest[j++] = 0x80 | (c & 0x003f);
-		} else if (c > 0x80) {
+		} else if (c >= 0x80) {
 			if (maxlength < 2)
 				break;
 			maxlength -= 2;
-			dest[j++] = 0xc0 | (c & 0xfe0) >> 5;
-			dest[j++] = 0x80 | (c & 0x01f);
+			dest[j++] = 0xc0 | (c & 0x7c0) >> 6;
+			dest[j++] = 0x80 | (c & 0x03f);
 		} else {
 			maxlength -= 1;
 			dest[j++] = c & 0x7f;
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [GIT PULL 0/2] EFI urgent fixes
  2016-02-16 12:59 [GIT PULL 0/2] EFI urgent fixes Matt Fleming
  2016-02-16 12:59 ` [PATCH 1/2] efi: Add pstore variables to the deletion whitelist Matt Fleming
  2016-02-16 12:59 ` [PATCH 2/2] lib/ucs2_string: Correct ucs2 -> utf8 conversion Matt Fleming
@ 2016-02-16 15:47 ` Ingo Molnar
  2 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2016-02-16 15:47 UTC (permalink / raw)
  To: Matt Fleming
  Cc: Thomas Gleixner, H . Peter Anvin, Ard Biesheuvel, linux-kernel,
	linux-efi, Jason Andryuk, Laszlo Ersek, Lee, Chun-Yi,
	Matthew Garrett, Peter Jones


* Matt Fleming <matt@codeblueprint.co.uk> wrote:

> Folks, here are some bug fixes that missed the previous pull request
> but that are related to those patches.
> 
> The following changes since commit 4682c211a80ee93214b72d95f861b0f6e90e5445:
> 
>   Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/urgent (2016-02-16 13:14:57 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git tags/efi-urgent
> 
> for you to fetch changes up to a68075908a37850918ad96b056acc9ac4ce1bd90:
> 
>   lib/ucs2_string: Correct ucs2 -> utf8 conversion (2016-02-16 12:49:05 +0000)
> 
> ----------------------------------------------------------------
>  * Fix bugs in our code that converts ucs2 strings to utf8 where we
>    unintentionally drop bits from the original string - Jason Andryuk
> 
>  * Add the efi-pstore variables to the variable whitelist so that
>    users can continue to delete them via efivarfs without needing to
>    manipulate the immutable flag - Matt Fleming
> 
> ----------------------------------------------------------------
> Jason Andryuk (1):
>       lib/ucs2_string: Correct ucs2 -> utf8 conversion
> 
> Matt Fleming (1):
>       efi: Add pstore variables to the deletion whitelist
> 
>  drivers/firmware/efi/vars.c |  1 +
>  lib/ucs2_string.c           | 14 +++++++-------
>  2 files changed, 8 insertions(+), 7 deletions(-)

Pulled, thanks Matt!

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-16 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16 12:59 [GIT PULL 0/2] EFI urgent fixes Matt Fleming
2016-02-16 12:59 ` [PATCH 1/2] efi: Add pstore variables to the deletion whitelist Matt Fleming
2016-02-16 12:59 ` [PATCH 2/2] lib/ucs2_string: Correct ucs2 -> utf8 conversion Matt Fleming
2016-02-16 15:47 ` [GIT PULL 0/2] EFI urgent fixes Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.