linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 0/1] EFI fix for v5.5
@ 2019-12-10  9:09 Ard Biesheuvel
  2019-12-10  9:09 ` [PATCH 1/1] efi: don't attempt to map RCI2 config table if it doesn't exist Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2019-12-10  9:09 UTC (permalink / raw)
  To: linux-efi, Ingo Molnar, Thomas Gleixner
  Cc: Ard Biesheuvel, linux-kernel, Richard Narron

The following changes since commit b418d660bb9798d2249ac6a46c844389ef50b6a5:

  efi/earlycon: Remap entire framebuffer after page initialization (2019-12-08 12:42:19 +0100)

are available in the Git repository at:

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

for you to fetch changes up to e943a5491f445c0d39ec69e897eb1fd180d09ffd:

  efi: don't attempt to map RCI2 config table if it doesn't exist (2019-12-10 10:08:24 +0100)

----------------------------------------------------------------
Another EFI fix for the v5.5 cycle:
- Avoid dereferencing the RCI2 configuration table address if it hasn't
  been assigned.

----------------------------------------------------------------
Ard Biesheuvel (1):
      efi: don't attempt to map RCI2 config table if it doesn't exist

 drivers/firmware/efi/rci2-table.c | 3 +++
 1 file changed, 3 insertions(+)

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

* [PATCH 1/1] efi: don't attempt to map RCI2 config table if it doesn't exist
  2019-12-10  9:09 [GIT PULL 0/1] EFI fix for v5.5 Ard Biesheuvel
@ 2019-12-10  9:09 ` Ard Biesheuvel
  2019-12-10 11:14   ` [tip: efi/urgent] efi: Don't " tip-bot2 for Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2019-12-10  9:09 UTC (permalink / raw)
  To: linux-efi, Ingo Molnar, Thomas Gleixner
  Cc: Ard Biesheuvel, linux-kernel, Richard Narron

Commit 1c5fecb61255aa12

  "efi: Export Runtime Configuration Interface table to sysfs"

added support for a Dell specific UEFI configuration table, but
failed to take into account that mapping the table should not be
attempted unless the table actually exists. If it doesn't exist,
the code usually fails silently unless pr_debug() prints are
enabled. However, on 32-bit PAE x86, the splat below is produced due
to the attempt to map the placeholder value EFI_INVALID_TABLE_ADDR
which we use for non-existing UEFI configuration tables, and which
equals ULONG_MAX.

  [    2.852491] memremap attempted on mixed range 0x00000000ffffffff size: 0x1e
  [    2.852501] WARNING: CPU: 1 PID: 1 at kernel/iomem.c:81 memremap+0x1a3/0x1c0
  [    2.852501] Modules linked in:
  [    2.852503] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.2-smp-mine #1
  [    2.852504] Hardware name: Hewlett-Packard HP Z400 Workstation/0B4Ch, BIOS 786G3 v03.61 03/05/2018
  [    2.852505] EIP: memremap+0x1a3/0x1c0
  ...
  [    2.852507] EAX: 0000003f EBX: 0000001e ECX: c5225bc0 EDX: 00000001
  [    2.852507] ESI: 01000200 EDI: 00000000 EBP: ee551f0c ESP: ee551eec
  [    2.852508] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068 EFLAGS: 00010296
  [    2.852509] CR0: 80050033 CR2: 00000000 CR3: 0520c000 CR4: 000006f0
  [    2.852509] Call Trace:
  [    2.852513]  ? map_properties+0x473/0x473
  [    2.852515]  ? efi_rci2_sysfs_init+0x2c/0x154
  [    2.852516]  ? map_properties+0x473/0x473
  [    2.852517]  ? do_one_initcall+0x49/0x1d4
  [    2.852519]  ? parse_args+0x1e8/0x2a0
  [    2.852521]  ? do_early_param+0x7a/0x7a
  [    2.852522]  ? kernel_init_freeable+0x139/0x1c2
  [    2.852525]  ? rest_init+0x8e/0x8e
  [    2.852526]  ? kernel_init+0xd/0xf2
  [    2.852529]  ? ret_from_fork+0x2e/0x38
  [    2.852530] ---[ end trace 5c4c3f26439c3728 ]---

Fix this by checking whether the table exists before attempting to map it.

Fixes: 1c5fecb61255aa12 ("efi: Export Runtime Configuration Interface table to sysfs")
Reported-by: Richard Narron <comet.berkeley@gmail.com>
Tested-by: Richard Narron <comet.berkeley@gmail.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/rci2-table.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/efi/rci2-table.c b/drivers/firmware/efi/rci2-table.c
index 76b0c354a027..de1a9a1f9f14 100644
--- a/drivers/firmware/efi/rci2-table.c
+++ b/drivers/firmware/efi/rci2-table.c
@@ -81,6 +81,9 @@ static int __init efi_rci2_sysfs_init(void)
 	struct kobject *tables_kobj;
 	int ret = -ENOMEM;
 
+	if (rci2_table_phys == EFI_INVALID_TABLE_ADDR)
+		return 0;
+
 	rci2_base = memremap(rci2_table_phys,
 			     sizeof(struct rci2_table_global_hdr),
 			     MEMREMAP_WB);
-- 
2.17.1


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

* [tip: efi/urgent] efi: Don't attempt to map RCI2 config table if it doesn't exist
  2019-12-10  9:09 ` [PATCH 1/1] efi: don't attempt to map RCI2 config table if it doesn't exist Ard Biesheuvel
@ 2019-12-10 11:14   ` tip-bot2 for Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: tip-bot2 for Ard Biesheuvel @ 2019-12-10 11:14 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Richard Narron, Ard Biesheuvel, linux-efi, Ingo Molnar, x86, LKML

The following commit has been merged into the efi/urgent branch of tip:

Commit-ID:     a470552ee8965da0fe6fd4df0aa39c4cda652c7c
Gitweb:        https://git.kernel.org/tip/a470552ee8965da0fe6fd4df0aa39c4cda652c7c
Author:        Ard Biesheuvel <ardb@kernel.org>
AuthorDate:    Tue, 10 Dec 2019 10:09:45 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 10 Dec 2019 12:13:02 +01:00

efi: Don't attempt to map RCI2 config table if it doesn't exist

Commit:

  1c5fecb61255aa12 ("efi: Export Runtime Configuration Interface table to sysfs")

... added support for a Dell specific UEFI configuration table, but
failed to take into account that mapping the table should not be
attempted unless the table actually exists. If it doesn't exist,
the code usually fails silently unless pr_debug() prints are
enabled. However, on 32-bit PAE x86, the splat below is produced due
to the attempt to map the placeholder value EFI_INVALID_TABLE_ADDR
which we use for non-existing UEFI configuration tables, and which
equals ULONG_MAX.

   memremap attempted on mixed range 0x00000000ffffffff size: 0x1e
   WARNING: CPU: 1 PID: 1 at kernel/iomem.c:81 memremap+0x1a3/0x1c0
   Modules linked in:
   CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.2-smp-mine #1
   Hardware name: Hewlett-Packard HP Z400 Workstation/0B4Ch, BIOS 786G3 v03.61 03/05/2018
   EIP: memremap+0x1a3/0x1c0
  ...
   Call Trace:
    ? map_properties+0x473/0x473
    ? efi_rci2_sysfs_init+0x2c/0x154
    ? map_properties+0x473/0x473
    ? do_one_initcall+0x49/0x1d4
    ? parse_args+0x1e8/0x2a0
    ? do_early_param+0x7a/0x7a
    ? kernel_init_freeable+0x139/0x1c2
    ? rest_init+0x8e/0x8e
    ? kernel_init+0xd/0xf2
    ? ret_from_fork+0x2e/0x38

Fix this by checking whether the table exists before attempting to map it.

Reported-by: Richard Narron <comet.berkeley@gmail.com>
Tested-by: Richard Narron <comet.berkeley@gmail.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-efi@vger.kernel.org
Fixes: 1c5fecb61255aa12 ("efi: Export Runtime Configuration Interface table to sysfs")
Link: https://lkml.kernel.org/r/20191210090945.11501-2-ardb@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/firmware/efi/rci2-table.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/efi/rci2-table.c b/drivers/firmware/efi/rci2-table.c
index 76b0c35..de1a9a1 100644
--- a/drivers/firmware/efi/rci2-table.c
+++ b/drivers/firmware/efi/rci2-table.c
@@ -81,6 +81,9 @@ static int __init efi_rci2_sysfs_init(void)
 	struct kobject *tables_kobj;
 	int ret = -ENOMEM;
 
+	if (rci2_table_phys == EFI_INVALID_TABLE_ADDR)
+		return 0;
+
 	rci2_base = memremap(rci2_table_phys,
 			     sizeof(struct rci2_table_global_hdr),
 			     MEMREMAP_WB);

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

end of thread, other threads:[~2019-12-10 11:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10  9:09 [GIT PULL 0/1] EFI fix for v5.5 Ard Biesheuvel
2019-12-10  9:09 ` [PATCH 1/1] efi: don't attempt to map RCI2 config table if it doesn't exist Ard Biesheuvel
2019-12-10 11:14   ` [tip: efi/urgent] efi: Don't " tip-bot2 for Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).