linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for Misono Tomohiro" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>,
	Borislav Petkov <bp@suse.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/misc] x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too
Date: Wed, 27 Jan 2021 19:31:34 -0000	[thread overview]
Message-ID: <161177589483.23325.9744949016620095034.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210127122456.13939-1-misono.tomohiro@jp.fujitsu.com>

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@jp.fujitsu.com>
AuthorDate:    Wed, 27 Jan 2021 21:24:56 +09:00
Committer:     Borislav Petkov <bp@suse.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@jp.fujitsu.com>
Signed-off-by: Borislav Petkov <bp@suse.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;

      parent reply	other threads:[~2021-01-27 19:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 12:24 [PATCH] x86/msr: Filter msr write by X86_IOC_WRMSR_REGS ioctl Misono Tomohiro
2021-01-27 14:30 ` Borislav Petkov
2021-01-27 19:31 ` tip-bot2 for Misono Tomohiro [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161177589483.23325.9744949016620095034.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=misono.tomohiro@jp.fujitsu.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).