Patch "x86/mce: Make sure to grab mce_sysfs_mutex in set_bank()" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    x86/mce: Make sure to grab mce_sysfs_mutex in set_bank()

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     x86-mce-make-sure-to-grab-mce_sysfs_mutex-in-set_bank.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 3ddf944b32f88741c303f0b21459dbb3872b8bc5 Mon Sep 17 00:00:00 2001
From: "Borislav Petkov (AMD)" <bp@xxxxxxxxx>
Date: Wed, 13 Mar 2024 14:48:27 +0100
Subject: x86/mce: Make sure to grab mce_sysfs_mutex in set_bank()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Borislav Petkov (AMD) <bp@xxxxxxxxx>

commit 3ddf944b32f88741c303f0b21459dbb3872b8bc5 upstream.

Modifying a MCA bank's MCA_CTL bits which control which error types to
be reported is done over

  /sys/devices/system/machinecheck/
  ├── machinecheck0
  │   ├── bank0
  │   ├── bank1
  │   ├── bank10
  │   ├── bank11
  ...

sysfs nodes by writing the new bit mask of events to enable.

When the write is accepted, the kernel deletes all current timers and
reinits all banks.

Doing that in parallel can lead to initializing a timer which is already
armed and in the timer wheel, i.e., in use already:

  ODEBUG: init active (active state 0) object: ffff888063a28000 object
  type: timer_list hint: mce_timer_fn+0x0/0x240 arch/x86/kernel/cpu/mce/core.c:2642
  WARNING: CPU: 0 PID: 8120 at lib/debugobjects.c:514
  debug_print_object+0x1a0/0x2a0 lib/debugobjects.c:514

Fix that by grabbing the sysfs mutex as the rest of the MCA sysfs code
does.

Reported by: Yue Sun <samsun1006219@xxxxxxxxx>
Reported by: xingwei lee <xrivendell7@xxxxxxxxx>
Signed-off-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>
Cc: <stable@xxxxxxxxxx>
Link: https://lore.kernel.org/r/CAEkJfYNiENwQY8yV1LYJ9LjJs%2Bx_-PqMv98gKig55=2vbzffRw@xxxxxxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 arch/x86/kernel/cpu/mce/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -2468,12 +2468,14 @@ static ssize_t set_bank(struct device *s
 		return -EINVAL;
 
 	b = &per_cpu(mce_banks_array, s->id)[bank];
-
 	if (!b->init)
 		return -ENODEV;
 
 	b->ctl = new;
+
+	mutex_lock(&mce_sysfs_mutex);
 	mce_restart();
+	mutex_unlock(&mce_sysfs_mutex);
 
 	return size;
 }


Patches currently in stable-queue which might be from bp@xxxxxxxxx are

queue-6.6/x86-cpu-amd-get-rid-of-amd_erratum_1054.patch
queue-6.6/x86-retpoline-add-noendbr-annotation-to-the-srso-dummy-return-thunk.patch
queue-6.6/drm-i915-pre-populate-the-cursor-physical-dma-addres.patch
queue-6.6/x86-srso-improve-i-cache-locality-for-alias-mitigation.patch
queue-6.6/x86-bugs-fix-the-srso-mitigation-on-zen3-4.patch
queue-6.6/x86-mce-make-sure-to-grab-mce_sysfs_mutex-in-set_bank.patch
queue-6.6/x86-retpoline-do-the-necessary-fixup-to-the-zen3-4-srso-return-thunk-for-srso.patch
queue-6.6/x86-srso-disentangle-rethunk-dependent-options.patch
queue-6.6/x86-cpu-amd-move-the-div0-bug-detection-to-the-zen1-.patch
queue-6.6/x86-cpu-amd-carve-out-the-erratum-1386-fix.patch
queue-6.6/x86-nospec-refactor-untrain_ret.patch
queue-6.6/mm-treewide-replace-pud_large-with-pud_leaf.patch
queue-6.6/x86-cpu-amd-add-x86_feature_zen1.patch
queue-6.6/x86-cpu-amd-add-zenx-generations-flags.patch
queue-6.6/x86-mm-pat-fix-vm_pat-handling-in-cow-mappings.patch
queue-6.6/x86-cpu-amd-move-erratum-1076-fix-into-the-zen1-init.patch
queue-6.6/x86-cpu-amd-move-zenbleed-check-to-the-zen2-init-fun.patch
queue-6.6/x86-coco-require-seeding-rng-with-rdrand-on-coco-systems.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux