Skip to content

Commit 567cfea

Browse files
committed
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "Misc fixes: a SYSRET single-stepping fix, a dmi-scan robustization fix, a reboot quirk and a kgdb fixlet" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: kgdb/x86: Fix reporting of 'si' in kgdb on x86_64 x86/asm/entry/64: Disable opportunistic SYSRET if regs->flags has TF set x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk MAINTAINERS: Change the x86 microcode loader maintainer firmware: dmi_scan: Prevent dmi_num integer overflow
2 parents ec2e76b + f59df35 commit 567cfea

File tree

5 files changed

+35
-20
lines changed

5 files changed

+35
-20
lines changed

MAINTAINERS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,7 @@ F: drivers/gpu/drm/radeon/radeon_kfd.h
637637
F: include/uapi/linux/kfd_ioctl.h
638638

639639
AMD MICROCODE UPDATE SUPPORT
640-
M: Andreas Herrmann <[email protected]>
641-
640+
M: Borislav Petkov <[email protected]>
642641
S: Maintained
643642
F: arch/x86/kernel/cpu/microcode/amd*
644643

@@ -5095,7 +5094,7 @@ S: Supported
50955094
F: drivers/platform/x86/intel_menlow.c
50965095

50975096
INTEL IA32 MICROCODE UPDATE SUPPORT
5098-
M: Tigran Aivazian <[email protected]>
5097+
M: Borislav Petkov <[email protected]>
50995098
S: Maintained
51005099
F: arch/x86/kernel/cpu/microcode/core*
51015100
F: arch/x86/kernel/cpu/microcode/intel*

arch/x86/kernel/entry_64.S

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,21 @@ retint_swapgs: /* return to user-space */
799799
cmpq %r11,(EFLAGS-ARGOFFSET)(%rsp) /* R11 == RFLAGS */
800800
jne opportunistic_sysret_failed
801801

802-
testq $X86_EFLAGS_RF,%r11 /* sysret can't restore RF */
802+
/*
803+
* SYSRET can't restore RF. SYSRET can restore TF, but unlike IRET,
804+
* restoring TF results in a trap from userspace immediately after
805+
* SYSRET. This would cause an infinite loop whenever #DB happens
806+
* with register state that satisfies the opportunistic SYSRET
807+
* conditions. For example, single-stepping this user code:
808+
*
809+
* movq $stuck_here,%rcx
810+
* pushfq
811+
* popq %r11
812+
* stuck_here:
813+
*
814+
* would never get past 'stuck_here'.
815+
*/
816+
testq $(X86_EFLAGS_RF|X86_EFLAGS_TF), %r11
803817
jnz opportunistic_sysret_failed
804818

805819
/* nothing to check for RSP */

arch/x86/kernel/kgdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
7272
{ "bx", 8, offsetof(struct pt_regs, bx) },
7373
{ "cx", 8, offsetof(struct pt_regs, cx) },
7474
{ "dx", 8, offsetof(struct pt_regs, dx) },
75-
{ "si", 8, offsetof(struct pt_regs, dx) },
75+
{ "si", 8, offsetof(struct pt_regs, si) },
7676
{ "di", 8, offsetof(struct pt_regs, di) },
7777
{ "bp", 8, offsetof(struct pt_regs, bp) },
7878
{ "sp", 8, offsetof(struct pt_regs, sp) },

arch/x86/kernel/reboot.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
183183
},
184184
},
185185

186+
/* ASRock */
187+
{ /* Handle problems with rebooting on ASRock Q1900DC-ITX */
188+
.callback = set_pci_reboot,
189+
.ident = "ASRock Q1900DC-ITX",
190+
.matches = {
191+
DMI_MATCH(DMI_BOARD_VENDOR, "ASRock"),
192+
DMI_MATCH(DMI_BOARD_NAME, "Q1900DC-ITX"),
193+
},
194+
},
195+
186196
/* ASUS */
187197
{ /* Handle problems with rebooting on ASUS P4S800 */
188198
.callback = set_bios_reboot,

drivers/firmware/dmi_scan.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,13 @@ static void dmi_table(u8 *buf, u32 len, int num,
8686
int i = 0;
8787

8888
/*
89-
* Stop when we see all the items the table claimed to have
90-
* OR we run off the end of the table (also happens)
89+
* Stop when we have seen all the items the table claimed to have
90+
* (SMBIOS < 3.0 only) OR we reach an end-of-table marker OR we run
91+
* off the end of the table (should never happen but sometimes does
92+
* on bogus implementations.)
9193
*/
92-
while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) {
94+
while ((!num || i < num) &&
95+
(data - buf + sizeof(struct dmi_header)) <= len) {
9396
const struct dmi_header *dm = (const struct dmi_header *)data;
9497

9598
/*
@@ -529,21 +532,10 @@ static int __init dmi_smbios3_present(const u8 *buf)
529532
if (memcmp(buf, "_SM3_", 5) == 0 &&
530533
buf[6] < 32 && dmi_checksum(buf, buf[6])) {
531534
dmi_ver = get_unaligned_be16(buf + 7);
535+
dmi_num = 0; /* No longer specified */
532536
dmi_len = get_unaligned_le32(buf + 12);
533537
dmi_base = get_unaligned_le64(buf + 16);
534538

535-
/*
536-
* The 64-bit SMBIOS 3.0 entry point no longer has a field
537-
* containing the number of structures present in the table.
538-
* Instead, it defines the table size as a maximum size, and
539-
* relies on the end-of-table structure type (#127) to be used
540-
* to signal the end of the table.
541-
* So let's define dmi_num as an upper bound as well: each
542-
* structure has a 4 byte header, so dmi_len / 4 is an upper
543-
* bound for the number of structures in the table.
544-
*/
545-
dmi_num = dmi_len / 4;
546-
547539
if (dmi_walk_early(dmi_decode) == 0) {
548540
pr_info("SMBIOS %d.%d present.\n",
549541
dmi_ver >> 8, dmi_ver & 0xFF);

0 commit comments

Comments
 (0)