On 2025-05-10 01:32, Borislav Petkov wrote:
On Fri, May 09, 2025 at 05:06:33PM +0000, Jiaqing Zhao wrote:
When suspending, save_processor_state() calls mtrr_save_fixed_ranges() to save fixed-range MTRRs. On platforms without fixed-range MTRRs, accessing these MSRs will trigger unchecked MSR access error. Make sure fixed-range MTRRs are supported before access to prevent such error.
Since mtrr_state.have_fixed is only set when MTRRs are present and enabled, checking the CPU feature flag in mtrr_save_fixed_ranges() is unnecessary.
Fixes: 3ebad5905609 ("[PATCH] x86: Save and restore the fixed-range MTRRs of the BSP when suspending") Cc: stable@vger.kernel.org Signed-off-by: Jiaqing Zhao jiaqing.zhao@linux.intel.com
Next question: this is CC:stable, meaning it'll go to Linus now.
What exactly is it fixing?
Because the patch in Fixes: is from 2007. :-\
Hi, Boris
This fixes unchecked MSR access error on platform without fixed-range MTRRs when doing ACPI S3 suspend. IMHO, though it is handled and won't panic kernel, it is worth getting fixed, and it matches the stable rule that
"It fixes a problem like an oops, a hang, data corruption, a real security issue, a hardware quirk, a build error (but not for things marked CONFIG_BROKEN), or some “oh, that’s not good” issue."
Kernel log is attached below.
Thanks, Jiaqing
[ 173.115706] ACPI: PM: Saving platform NVS memory [ 173.115818] Disabling non-boot CPUs ... [ 173.126530] unchecked MSR access error: RDMSR from 0x250 at rIP: 0xffffffffa90a15ff (get_fixed_ranges+0x) [ 173.126749] Call Trace: [ 173.126806] <TASK> [ 173.126858] ? show_stack_regs+0x23/0x30 [ 173.126946] ? fixup_exception+0x5a4/0x610 [ 173.127037] ? printk_get_next_message+0x105/0x350 [ 173.127141] ? gp_try_fixup_and_notify+0x37/0x100 [ 173.127244] ? exc_general_protection+0xe1/0x1f0 [ 173.127346] ? asm_exc_general_protection+0x27/0x30 [ 173.127452] ? __cfi_x86_acpi_suspend_lowlevel+0x10/0x10 [ 173.127567] ? get_fixed_ranges+0x5f/0x390 [ 173.127657] mtrr_save_fixed_ranges+0x1b/0x40 [ 173.127753] save_processor_state+0x111/0x220 [ 173.127849] do_suspend_lowlevel+0xf/0xb70 [ 173.127939] x86_acpi_suspend_lowlevel+0x14c/0x180 [ 173.128042] acpi_suspend_enter+0x17e/0x1e0 [ 173.128133] suspend_devices_and_enter+0x62d/0x950 [ 173.128236] pm_suspend+0x2cf/0x4c0 [ 173.128314] state_store+0x109/0x130 [ 173.128393] kobj_attr_store+0x1e/0x40 [ 173.128477] sysfs_kf_write+0x45/0x60 [ 173.128559] kernfs_fop_write_iter+0x113/0x1a0 [ 173.128698] vfs_write+0x38a/0x470 [ 173.128775] ksys_write+0x87/0x100 [ 173.128851] __x64_sys_write+0x1b/0x30 [ 173.128932] x64_sys_call+0x17f1/0x25e0 [ 173.129017] do_syscall_64+0x74/0x120 [ 173.129098] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 173.129206] RIP: 0033:0x7d6a19d82687 [ 173.129288] Code: 00 00 00 b8 00 00 00 00 0f 05 48 3d 01 f0 ff ff 72 09 f7 d8 89 c7 e8 e8 fa ff ff c3 0f0 [ 173.129661] RSP: 002b:00007d66c7a7f668 EFLAGS: 00000213 ORIG_RAX: 0000000000000001 [ 173.129819] RAX: ffffffffffffffda RBX: 00007d68a8858450 RCX: 00007d6a19d82687 [ 173.129967] RDX: 0000000000000003 RSI: 00007d680881a2a0 RDI: 00000000000000a8 [ 173.130115] RBP: 00007d66c7a7f6e0 R08: ffffffffffffffff R09: 0000000000000000 [ 173.130262] R10: 0000000000020000 R11: 0000000000000213 R12: 0000000000000000 [ 173.130410] R13: 0000000070ec9fb8 R14: 00000000000000a8 R15: 00007d66c7a7f75c [ 173.130559] </TASK>