public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: x86-ml <x86@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] x86: Filter MSR writes from luserspace
Date: Tue, 26 Nov 2019 12:36:28 +0100	[thread overview]
Message-ID: <20191126113628.GD31379@zn.tnic> (raw)
In-Reply-To: <20191126112234.GA22393@zn.tnic>

On Tue, Nov 26, 2019 at 12:22:34PM +0100, Borislav Petkov wrote:
> Hi,
> 
> so this has been on my TODO list for a while. I'd like to disable writes
> to certain MSRs and MSR ranges because luserspace has no job poking at
> those at all. If there's a need for poking at MSRs, a proper userspace
> interface needs to be designed instead of plain writes into the MSRs.
> 
> There's a "msr.allow_writes" root-only param for the use case where CPU
> folks want to be poking at MSRs. And yes, that is a valid use case -
> they wanna be poking at their MSRs.
> 
> In any case, writes do taint the kernel now so that it is known that
> something has been poking at the MSRs.
> 
> Thoughts?
> 
> ---
> 
> ... to certain important MSRs.
> 
> v0: add allow_writes param for root.
> 
> Not-yet-signed-off-by: Borislav Petkov <bp@suse.de>
> ---
>  arch/x86/events/amd/power.c      |   4 -
>  arch/x86/events/intel/knc.c      |   4 -
>  arch/x86/include/asm/msr-index.h |   8 ++
>  arch/x86/include/asm/processor.h |   2 +
>  arch/x86/kernel/cpu/bugs.c       |   2 +-
>  arch/x86/kernel/cpu/common.c     | 165 +++++++++++++++++++++++++++++++
>  arch/x86/kernel/msr.c            |  20 +++-
>  drivers/hwmon/fam15h_power.c     |   4 -
>  8 files changed, 195 insertions(+), 14 deletions(-)

Note to self for next version:

- turn the list into a whitelist of MSRs instead, for obvious reasons (Ingo).

-- 
Regards/Gruss,
    Boris.

SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg
-- 

  reply	other threads:[~2019-11-26 11:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26 11:22 [RFC PATCH] x86: Filter MSR writes from luserspace Borislav Petkov
2019-11-26 11:36 ` Borislav Petkov [this message]
2019-11-26 20:15 ` Andi Kleen
2019-11-26 20:33   ` Borislav Petkov
2019-11-26 20:50     ` Andi Kleen
2019-11-26 20:53       ` Borislav Petkov
2019-11-27  7:08         ` Ingo Molnar

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=20191126113628.GD31379@zn.tnic \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --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