Skip to contentSkip to conversation

x86/mce-inject: Reset struct after injection

PATCH New Borislav Petkov 2 participants 2 messages Sep 5, 2018 – Sep 21, 2018

Subsystems (2)
lore
Share & tools
lore

Borislav Petkov

author maintainer
#0 lore raw

PATCH 1/1 x86/mce-inject: Reset struct after injection

From: Borislav Petkov <[email protected]>

Clear the MCE struct which is used for collecting the injection details after injection.

Also, populate it with more details from the machine.

---
 arch/x86/kernel/cpu/mcheck/mce-inject.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/kernel/cpu/mcheck/mce-inject.c +6 -0
index c805a06e14c3..1fc424c40a31 100644
@@ -108,6 +108,9 @@ static void setup_inj_struct(struct mce *m)
 	memset(m, 0, sizeof(struct mce));
 
 	m->cpuvendor = boot_cpu_data.x86_vendor;
+	m->time	     = ktime_get_real_seconds();
+	m->cpuid     = cpuid_eax(1);
+	m->microcode = boot_cpu_data.microcode;
 }
 
 /* Update fake mce registers on current CPU. */
@@ -576,6 +579,9 @@ static int inj_bank_set(void *data, u64 val)
 	m->bank = val;
 	do_inject();
 
+	/* Reset injection struct */
+	setup_inj_struct(&i_mce);
+
 	return 0;
 }
 
#1 lore raw

[tip:ras/core] x86/mce-inject: Reset injection struct after injection

x86/mce-inject: Reset injection struct after injection
Commit-ID:  7401a633c34adc7aefd3edfec60074cb0475a3e8
Gitweb:     https://git.kernel.org/tip/7401a633c34adc7aefd3edfec60074cb0475a3e8
Author:     Borislav Petkov <[email protected]>
AuthorDate: Tue, 4 Sep 2018 11:22:12 +0200
Committer:  Borislav Petkov <[email protected]>
CommitDate: Fri, 21 Sep 2018 14:28:37 +0200

x86/mce-inject: Reset injection struct after injection

Clear the MCE struct which is used for collecting the injection details after injection.

Also, populate it with more details from the machine.

---
 arch/x86/kernel/cpu/mcheck/mce-inject.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/x86/kernel/cpu/mcheck/mce-inject.c +6 -0
index c805a06e14c3..1fc424c40a31 100644
@@ -108,6 +108,9 @@ static void setup_inj_struct(struct mce *m)
 	memset(m, 0, sizeof(struct mce));
 
 	m->cpuvendor = boot_cpu_data.x86_vendor;
+	m->time	     = ktime_get_real_seconds();
+	m->cpuid     = cpuid_eax(1);
+	m->microcode = boot_cpu_data.microcode;
 }
 
 /* Update fake mce registers on current CPU. */
@@ -576,6 +579,9 @@ static int inj_bank_set(void *data, u64 val)
 	m->bank = val;
 	do_inject();
 
+	/* Reset injection struct */
+	setup_inj_struct(&i_mce);
+
 	return 0;
 }