Skip to contentSkip to conversation

efi/urgent for v5.7-rc7

GIT PULL Merged Thomas Gleixner 3 participants 8 messages May 24, 2020 – May 25, 2020

Subsystems (7)
x86 Scheduler x86 MM EFI +3 more subsystems
lore
Share & tools
lore
#0 lore raw

Linus,

please pull the latest efi/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-2020-05-24

up to: 9bb4cbf4862d: Merge tag 'efi-fixes-for-v5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi into efi/urgent

A set of EFI fixes:

- Don't return a garbage screen info when EFI framebuffer is not available

- Make the early EFI console work proper with wider fonts instead of drawing garbage

- Prevent a memory buffer leak in allocate_e820()

- Print the firmware error record proper so it can be decoded by users

- Fix a symbol clash in the host tool build which only happens with newer compilers.

- Add a missing check for the event log version of TPM which caused boot fails on several Dell systems due to an attempt to decode SHA-1 format with the crypto agile algorithm

Thanks,

tglx

------------------>
Arvind Sankar (1):
x86/boot: Mark global variables as static

Benjamin Thiel (1):
efi: Pull up arch-specific prototype efi_systab_show_arch()

Dave Young (1):
efi/earlycon: Fix early printk for wider fonts

Heinrich Schuchardt (1):
efi/libstub: Avoid returning uninitialized data from setup_graphics()

Lenny Szubowicz (1):
efi/libstub/x86: Avoid EFI map buffer alloc in allocate_e820()

Loïc Yhuel (1):
tpm: check event log version before reading final events

Punit Agrawal (1):
efi: cper: Add support for printing Firmware Error Record Reference

 arch/x86/boot/tools/build.c             | 16 ++++-----
 drivers/firmware/efi/cper.c             | 62 +++++++++++++++++++++++++++++++++
 drivers/firmware/efi/earlycon.c         | 14 ++++----
 drivers/firmware/efi/efi.c              |  5 +--
 drivers/firmware/efi/libstub/arm-stub.c |  6 +++-
 drivers/firmware/efi/libstub/efistub.h  | 13 +++++++
 drivers/firmware/efi/libstub/mem.c      |  2 --
 drivers/firmware/efi/libstub/tpm.c      |  5 +--
 drivers/firmware/efi/libstub/x86-stub.c | 24 +++++--------
 drivers/firmware/efi/tpm.c              |  5 ++-
 include/linux/cper.h                    |  9 +++++
 include/linux/efi.h                     |  2 ++
 12 files changed, 124 insertions(+), 39 deletions(-)
arch/x86/boot/tools/build.c +8 -8
index 8f8c8e386cea..c8b8c1a8d1fc 100644
@@ -59,14 +59,14 @@ u8 buf[SETUP_SECT_MAX*512];
 #define PECOFF_COMPAT_RESERVE 0x0
 #endif
 
-unsigned long efi32_stub_entry;
-unsigned long efi64_stub_entry;
-unsigned long efi_pe_entry;
-unsigned long efi32_pe_entry;
-unsigned long kernel_info;
-unsigned long startup_64;
-unsigned long _ehead;
-unsigned long _end;
+static unsigned long efi32_stub_entry;
+static unsigned long efi64_stub_entry;
+static unsigned long efi_pe_entry;
+static unsigned long efi32_pe_entry;
+static unsigned long kernel_info;
+static unsigned long startup_64;
+static unsigned long _ehead;
+static unsigned long _end;
 
 /*----------------------------------------------------------------------*/
 
drivers/firmware/efi/cper.c +62 -0

74 lines not on this page · raw message

drivers/firmware/efi/earlycon.c +8 -6
index 5d4f84781aa0..a52236e11e5f 100644
@@ -114,14 +114,16 @@ static void efi_earlycon_write_char(u32 *dst, unsigned char c, unsigned int h)
 	const u32 color_black = 0x00000000;
 	const u32 color_white = 0x00ffffff;
 	const u8 *src;
-	u8 s8;
-	int m;
+	int m, n, bytes;
+	u8 x;
 
-	src = font->data + c * font->height;
-	s8 = *(src + h);
+	bytes = BITS_TO_BYTES(font->width);
+	src = font->data + c * font->height * bytes + h * bytes;
 
-	for (m = 0; m < 8; m++) {
-		if ((s8 >> (7 - m)) & 1)
+	for (m = 0; m < font->width; m++) {
+		n = m % 8;
+		x = *(src + m / 8);
+		if ((x >> (7 - n)) & 1)
 			*dst = color_white;
 		else
 			*dst = color_black;
drivers/firmware/efi/efi.c +1 -4
index 911a2bd0f6b7..4e3055238f31 100644
@@ -130,11 +130,8 @@ static ssize_t systab_show(struct kobject *kobj,
 	if (efi.smbios != EFI_INVALID_TABLE_ADDR)
 		str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 
-	if (IS_ENABLED(CONFIG_IA64) || IS_ENABLED(CONFIG_X86)) {
-		extern char *efi_systab_show_arch(char *str);
-
+	if (IS_ENABLED(CONFIG_IA64) || IS_ENABLED(CONFIG_X86))
 		str = efi_systab_show_arch(str);
-	}
 
 	return str - buf;
 }
drivers/firmware/efi/libstub/arm-stub.c +5 -1
index 99a5cde7c2d8..48161b1dd098 100644
@@ -60,7 +60,11 @@ static struct screen_info *setup_graphics(void)
 		si = alloc_screen_info();
 		if (!si)
 			return NULL;
-		efi_setup_gop(si, &gop_proto, size);
+		status = efi_setup_gop(si, &gop_proto, size);
+		if (status != EFI_SUCCESS) {
+			free_screen_info(si);
+			return NULL;
+		}
 	}
 	return si;
 }
drivers/firmware/efi/libstub/efistub.h +13 -0
index 67d26949fd26..62943992f02f 100644
@@ -92,6 +92,19 @@ extern __pure efi_system_table_t  *efi_system_table(void);
 #define EFI_LOCATE_BY_REGISTER_NOTIFY		1
 #define EFI_LOCATE_BY_PROTOCOL			2
 
+/*
+ * An efi_boot_memmap is used by efi_get_memory_map() to return the
+ * EFI memory map in a dynamically allocated buffer.
+ *
+ * The buffer allocated for the EFI memory map includes extra room for
+ * a minimum of EFI_MMAP_NR_SLACK_SLOTS additional EFI memory descriptors.
+ * This facilitates the reuse of the EFI memory map buffer when a second
+ * call to ExitBootServices() is needed because of intervening changes to
+ * the EFI memory map. Other related structures, e.g. x86 e820ext, need
+ * to factor in this headroom requirement as well.
+ */
+#define EFI_MMAP_NR_SLACK_SLOTS	8
+
 struct efi_boot_memmap {
 	efi_memory_desc_t	**map;
 	unsigned long		*map_size;
drivers/firmware/efi/libstub/mem.c +0 -2
index 869a79c8946f..09f4fa01914e 100644
@@ -5,8 +5,6 @@
 
 #include "efistub.h"
 
-#define EFI_MMAP_NR_SLACK_SLOTS	8
-
 static inline bool mmap_has_headroom(unsigned long buff_size,
 				     unsigned long map_size,
 				     unsigned long desc_size)
drivers/firmware/efi/libstub/tpm.c +3 -2
index 1d59e103a2e3..e9a684637b70 100644
@@ -54,7 +54,7 @@ void efi_retrieve_tpm2_eventlog(void)
 	efi_status_t status;
 	efi_physical_addr_t log_location = 0, log_last_entry = 0;
 	struct linux_efi_tpm_eventlog *log_tbl = NULL;
-	struct efi_tcg2_final_events_table *final_events_table;
+	struct efi_tcg2_final_events_table *final_events_table = NULL;
 	unsigned long first_entry_addr, last_entry_addr;
 	size_t log_size, last_entry_size;
 	efi_bool_t truncated;
@@ -127,7 +127,8 @@ void efi_retrieve_tpm2_eventlog(void)
 	 * Figure out whether any events have already been logged to the
 	 * final events structure, and if so how much space they take up
 	 */
-	final_events_table = get_efi_config_table(LINUX_EFI_TPM_FINAL_LOG_GUID);
+	if (version == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
+		final_events_table = get_efi_config_table(LINUX_EFI_TPM_FINAL_LOG_GUID);
 	if (final_events_table && final_events_table->nr_events) {
 		struct tcg_pcr_event2_head *header;
 		int offset;
drivers/firmware/efi/libstub/x86-stub.c +9 -15
index 05ccb229fb45..f0339b5d3658 100644
@@ -606,24 +606,18 @@ static efi_status_t allocate_e820(struct boot_params *params,
 				  struct setup_data **e820ext,
 				  u32 *e820ext_size)
 {
-	unsigned long map_size, desc_size, buff_size;
-	struct efi_boot_memmap boot_map;
-	efi_memory_desc_t *map;
+	unsigned long map_size, desc_size, map_key;
 	efi_status_t status;
-	__u32 nr_desc;
+	__u32 nr_desc, desc_version;
 
-	boot_map.map		= &map;
-	boot_map.map_size	= &map_size;
-	boot_map.desc_size	= &desc_size;
-	boot_map.desc_ver	= NULL;
-	boot_map.key_ptr	= NULL;
-	boot_map.buff_size	= &buff_size;
+	/* Only need the size of the mem map and size of each mem descriptor */
+	map_size = 0;
+	status = efi_bs_call(get_memory_map, &map_size, NULL, &map_key,
+			     &desc_size, &desc_version);
+	if (status != EFI_BUFFER_TOO_SMALL)
+		return (status != EFI_SUCCESS) ? status : EFI_UNSUPPORTED;
 
-	status = efi_get_memory_map(&boot_map);
-	if (status != EFI_SUCCESS)
-		return status;
-
-	nr_desc = buff_size / desc_size;
+	nr_desc = map_size / desc_size + EFI_MMAP_NR_SLACK_SLOTS;
 
 	if (nr_desc > ARRAY_SIZE(params->e820_table)) {
 		u32 nr_e820ext = nr_desc - ARRAY_SIZE(params->e820_table);
drivers/firmware/efi/tpm.c +4 -1
index 55b031d2c989..c1955d320fec 100644
@@ -62,8 +62,11 @@ int __init efi_tpm_eventlog_init(void)
 	tbl_size = sizeof(*log_tbl) + log_tbl->size;
 	memblock_reserve(efi.tpm_log, tbl_size);
 
-	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR)
+	if (efi.tpm_final_log == EFI_INVALID_TABLE_ADDR ||
+	    log_tbl->version != EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
+		pr_warn(FW_BUG "TPM Final Events table missing or invalid\n");
 		goto out;
+	}
 
 	final_tbl = early_memremap(efi.tpm_final_log, sizeof(*final_tbl));
 
include/linux/cper.h +9 -0
index 4f005d95ce88..8537e9282a65 100644
@@ -521,6 +521,15 @@ struct cper_sec_pcie {
 	u8	aer_info[96];
 };
 
+/* Firmware Error Record Reference, UEFI v2.7 sec N.2.10  */
+struct cper_sec_fw_err_rec_ref {
+	u8 record_type;
+	u8 revision;
+	u8 reserved[6];
+	u64 record_identifier;
+	guid_t record_identifier_guid;
+};
+
 /* Reset to default packing */
 #pragma pack()
 
include/linux/efi.h +2 -0
index 251f1f783cdf..9430d01c0c3d 100644
@@ -1245,4 +1245,6 @@ struct linux_efi_memreserve {
 
 void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size);
 
+char *efi_systab_show_arch(char *str);
+
 #endif /* _LINUX_EFI_H */
#1 lore raw

[GIT pull] x86/urgent for v5.7-rc7

Linus,

please pull the latest x86/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2020-05-24

up to: 187b96db5ca7: x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks

Two fixes for x86:

- Unbreak stack dumps for inactive tasks by interpreting the special first frame left by __switch_to_asm() correctly. The recent change not to skip the first frame so ORC and frame unwinder behave in the same way caused all entries to be unreliable, i.e. prepended with '?'.

- Use cpumask_available() instead of an implicit NULL check of a cpumask_var_t in mmio trace to prevent a Clang build warning

Thanks,

tglx

------------------>
Josh Poimboeuf (1):
x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks

Nathan Chancellor (1):
x86/mmiotrace: Use cpumask_available() for cpumask_var_t variables

 arch/x86/kernel/unwind_orc.c | 7 +++++++
 arch/x86/mm/mmio-mod.c       | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)
arch/x86/kernel/unwind_orc.c +7 -0
index fa79e4227d3d..7f969b2d240f 100644
@@ -320,12 +320,19 @@ EXPORT_SYMBOL_GPL(unwind_get_return_address);
 
 unsigned long *unwind_get_return_address_ptr(struct unwind_state *state)
 {
+	struct task_struct *task = state->task;
+
 	if (unwind_done(state))
 		return NULL;
 
 	if (state->regs)
 		return &state->regs->ip;
 
+	if (task != current && state->sp == task->thread.sp) {
+		struct inactive_task_frame *frame = (void *)task->thread.sp;
+		return &frame->ret_addr;
+	}
+
 	if (state->sp)
 		return (unsigned long *)state->sp - 1;
 
arch/x86/mm/mmio-mod.c +2 -2
index 109325d77b3e..43fd19b3f118 100644
@@ -372,7 +372,7 @@ static void enter_uniprocessor(void)
 	int cpu;
 	int err;
 
-	if (downed_cpus == NULL &&
+	if (!cpumask_available(downed_cpus) &&
 	    !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
 		pr_notice("Failed to allocate mask\n");
 		goto out;
@@ -402,7 +402,7 @@ static void leave_uniprocessor(void)
 	int cpu;
 	int err;
 
-	if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
+	if (!cpumask_available(downed_cpus) || cpumask_weight(downed_cpus) == 0)
 		return;
 	pr_notice("Re-enabling CPUs...\n");
 	for_each_cpu(cpu, downed_cpus) {
merge bot Merged
#2 lore raw

Re: [GIT pull] x86/urgent for v5.7-rc7

The pull request you sent on Sun, 24 May 2020 15:08:03 -0000:

The pull request you sent on Sun, 24 May 2020 15:08:03 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86-urgent-2020-05-24

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/667b6249b71c30c20fcd2f312f1665d90348635a

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#3 lore raw

[GIT pull] sched/urgent for v5.7-rc7

In reply to Thomas Gleixner

Linus,

please pull the latest sched/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-urgent-2020-05-24

up to: 39f23ce07b93: sched/fair: Fix unthrottle_cfs_rq() for leaf_cfs_rq list

A set of fixes for the scheduler:

- Fix handling of throttled parents in enqueue_task_fair() completely. The recent fix overlooked a corner case where the first iteration terminates do a entiry being on rq which makes the list management incomplete and later triggers the assertion which checks for completeness.

- Fix a similar problem in unthrottle_cfs_rq().

- Show the correct uclamp values in procfs which prints the effective value twice instead of requested and effective.

Thanks,

tglx

------------------>
Pavankumar Kondeti (1):
sched/debug: Fix requested task uclamp values shown in procfs

Phil Auld (1):
sched/fair: Fix enqueue_task_fair() warning some more

Vincent Guittot (1):
sched/fair: Fix unthrottle_cfs_rq() for leaf_cfs_rq list

 kernel/sched/debug.c |  4 ++--
 kernel/sched/fair.c  | 49 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 14 deletions(-)
kernel/sched/debug.c +2 -2
index a562df57a86e..239970b991c0 100644
@@ -948,8 +948,8 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
 	P(se.avg.util_est.enqueued);
 #endif
 #ifdef CONFIG_UCLAMP_TASK
-	__PS("uclamp.min", p->uclamp[UCLAMP_MIN].value);
-	__PS("uclamp.max", p->uclamp[UCLAMP_MAX].value);
+	__PS("uclamp.min", p->uclamp_req[UCLAMP_MIN].value);
+	__PS("uclamp.max", p->uclamp_req[UCLAMP_MAX].value);
 	__PS("effective uclamp.min", uclamp_eff_value(p, UCLAMP_MIN));
 	__PS("effective uclamp.max", uclamp_eff_value(p, UCLAMP_MAX));
 #endif
kernel/sched/fair.c +37 -12

83 lines not on this page · raw message

#4 lore raw

Re: [GIT pull] sched/urgent for v5.7-rc7

Quoted 3 lines · Thomas Gleixner

[..] overlooked a corner case where the first iteration terminates do a entiry being on rq which makes the list management incomplete [..]

You had some kind of mini-stroke while writing that explanation. I tried to fix it up as best I could.

Linus

#5 lore raw

Re: [GIT pull] sched/urgent for v5.7-rc7

Quoted 6 lines · Linus Torvalds
Quoted 3 lines · Thomas Gleixner

[..] overlooked a corner case where the first iteration terminates do a entiry being on rq which makes the list management incomplete [..]

You had some kind of mini-stroke while writing that explanation. I

Indeed.

Quoted 1 line

tried to fix it up as best I could.

That looks much more like what I wanted to write actually.

Thanks for fixing it!

tglx

merge bot Merged
#6 lore raw

Re: [GIT pull] sched/urgent for v5.7-rc7

In reply to Thomas Gleixner
The pull request you sent on Sun, 24 May 2020 15:08:02 -0000:

The pull request you sent on Sun, 24 May 2020 15:08:02 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-urgent-2020-05-24

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/9e61d12bac206e5e70176734604371ac3a6e50fd

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
merge bot Merged
#7 lore raw
In reply to Thomas Gleixner
The pull request you sent on Sun, 24 May 2020 15:08:01 -0000:

The pull request you sent on Sun, 24 May 2020 15:08:01 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git efi-urgent-2020-05-24

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/98790bbac4db1697212ce9462ec35ca09c4a2810

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker