[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <161177589483.23325.9744949016620095034.tip-bot2@tip-bot2>
Date: Wed, 27 Jan 2021 19:31:34 -0000
From: "tip-bot2 for Misono Tomohiro" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Misono Tomohiro <misono.tomohiro@...fujitsu.com>,
Borislav Petkov <bp@...e.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: x86/misc] x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS
ioctl too
The following commit has been merged into the x86/misc branch of tip:
Commit-ID: 02a16aa13574c8526beadfc9ae8cc9b66315fa2d
Gitweb: https://git.kernel.org/tip/02a16aa13574c8526beadfc9ae8cc9b66315fa2d
Author: Misono Tomohiro <misono.tomohiro@...fujitsu.com>
AuthorDate: Wed, 27 Jan 2021 21:24:56 +09:00
Committer: Borislav Petkov <bp@...e.de>
CommitterDate: Wed, 27 Jan 2021 19:06:47 +01:00
x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too
Commit
a7e1f67ed29f ("x86/msr: Filter MSR writes")
introduced a module parameter to disable writing to the MSR device file
and tainted the kernel upon writing. As MSR registers can be written by
the X86_IOC_WRMSR_REGS ioctl too, the same filtering and tainting should
be applied to the ioctl as well.
[ bp: Massage commit message and space out statements. ]
Fixes: a7e1f67ed29f ("x86/msr: Filter MSR writes")
Signed-off-by: Misono Tomohiro <misono.tomohiro@...fujitsu.com>
Signed-off-by: Borislav Petkov <bp@...e.de>
Link: https://lkml.kernel.org/r/20210127122456.13939-1-misono.tomohiro@jp.fujitsu.com
---
arch/x86/kernel/msr.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
index 8a67d1f..ed8ac6b 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
@@ -182,6 +182,13 @@ static long msr_ioctl(struct file *file, unsigned int ioc, unsigned long arg)
err = security_locked_down(LOCKDOWN_MSR);
if (err)
break;
+
+ err = filter_write(regs[1]);
+ if (err)
+ return err;
+
+ add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK);
+
err = wrmsr_safe_regs_on_cpu(cpu, regs);
if (err)
break;
Powered by blists - more mailing lists