]> Git Repo - linux.git/commitdiff
x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too
authorMisono Tomohiro <[email protected]>
Wed, 27 Jan 2021 12:24:56 +0000 (21:24 +0900)
committerBorislav Petkov <[email protected]>
Wed, 27 Jan 2021 18:06:47 +0000 (19:06 +0100)
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 <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
arch/x86/kernel/msr.c

index 8a67d1fa8dc580656241442c8c5ca240dc0916f7..ed8ac6bcbafb2fd8b18af132622199628295eb46 100644 (file)
@@ -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;
This page took 0.055023 seconds and 4 git commands to generate.