<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/kernel/msr.c, branch linux-5.19.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.19.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-01-27T18:06:47Z</updated>
<entry>
<title>x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too</title>
<updated>2021-01-27T18:06:47Z</updated>
<author>
<name>Misono Tomohiro</name>
</author>
<published>2021-01-27T12:24:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=02a16aa13574c8526beadfc9ae8cc9b66315fa2d'/>
<id>urn:sha1:02a16aa13574c8526beadfc9ae8cc9b66315fa2d</id>
<content type='text'>
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 &lt;misono.tomohiro@jp.fujitsu.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20210127122456.13939-1-misono.tomohiro@jp.fujitsu.com
</content>
</entry>
<entry>
<title>x86/msr: Add a pointer to an URL which contains further details</title>
<updated>2020-12-08T09:17:08Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2020-12-05T00:19:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f77f420d34754b8d08ac6ebf094ff7193023196a'/>
<id>urn:sha1:f77f420d34754b8d08ac6ebf094ff7193023196a</id>
<content type='text'>
After having collected the majority of reports about MSRs being written
by userspace tools and what tools those are, and all newer reports
mostly repeating, add an URL where detailed information is gathered and
kept up-to-date.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20201205002825.19107-1-bp@alien8.de
</content>
</entry>
<entry>
<title>x86/msr: Downgrade unrecognized MSR message</title>
<updated>2020-11-19T09:46:54Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2020-11-18T12:34:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b023fd5f741f34d2cd90258ccc3f245924d2eadd'/>
<id>urn:sha1:b023fd5f741f34d2cd90258ccc3f245924d2eadd</id>
<content type='text'>
It is a warning and not an error so use pr_warn().

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20201118123806.19672-1-bp@alien8.de
</content>
</entry>
<entry>
<title>x86/msr: Do not allow writes to MSR_IA32_ENERGY_PERF_BIAS</title>
<updated>2020-11-16T16:44:04Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2020-10-15T13:00:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=18741a5251d018094536a2dffe284d269ebb07fe'/>
<id>urn:sha1:18741a5251d018094536a2dffe284d269ebb07fe</id>
<content type='text'>
Now that all in-kernel-tree users are converted to using the sysfs file,
remove the MSR from the "allowlist".

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Reviewed-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
Link: https://lkml.kernel.org/r/20201029190259.3476-5-bp@alien8.de
</content>
</entry>
<entry>
<title>x86/msr: Make source of unrecognised MSR writes unambiguous</title>
<updated>2020-08-22T09:40:38Z</updated>
<author>
<name>Chris Down</name>
</author>
<published>2020-08-21T12:10:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c31feed8461fb8648075ba9b53d9e527d530972f'/>
<id>urn:sha1:c31feed8461fb8648075ba9b53d9e527d530972f</id>
<content type='text'>
In many cases, task_struct.comm isn't enough to distinguish the
offender, since for interpreted languages it's likely just going to be
"python3" or whatever. Add the pid to make it unambiguous.

 [ bp: Make the printk string a single line for easier grepping. ]

Signed-off-by: Chris Down &lt;chris@chrisdown.name&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/6f6fbd0ee6c99bc5e47910db700a6642159db01b.1598011595.git.chris@chrisdown.name
</content>
</entry>
<entry>
<title>x86/msr: Prevent userspace MSR access from dominating the console</title>
<updated>2020-08-22T09:27:40Z</updated>
<author>
<name>Chris Down</name>
</author>
<published>2020-08-21T12:10:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1f35c9c0ce3888405fc813afedaff79de433cf27'/>
<id>urn:sha1:1f35c9c0ce3888405fc813afedaff79de433cf27</id>
<content type='text'>
Applications which manipulate MSRs from userspace often do so
infrequently, and all at once. As such, the default printk ratelimit
architecture supplied by pr_err_ratelimited() doesn't do enough to prevent
kmsg becoming completely overwhelmed with their messages and pushing
other salient information out of the circular buffer.

In one case, I saw over 80% of kmsg being filled with these messages,
and the default kmsg buffer being completely filled less than 5 minutes
after boot(!).

Make things much less aggressive, while still achieving the original
goal of fiter_write(). Operators will still get warnings that MSRs are
being manipulated from userspace, but they won't have other also
potentially useful messages pushed out of the kmsg buffer.

Of course, one can boot with `allow_writes=1` to avoid these messages at
all, but that then has the downfall that one doesn't get _any_
notification at all about these problems in the first place, and so is
much less likely to forget to fix it.

One might rather it was less binary: it was still logged, just less
often, so that application developers _do_ have the incentive to improve
their current methods, without the kernel having to push other useful
stuff out of the kmsg buffer.

This one example isn't the point, of course: I'm sure there are plenty
of other non-ideal-but-pragmatic cases where people are writing to MSRs
from userspace right now, and it will take time for those people to find
other solutions.

Overall, keep the intent of the original patch, while mitigating its
sometimes heavy effects on kmsg composition.

 [ bp: Massage a bit. ]

Signed-off-by: Chris Down &lt;chris@chrisdown.name&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/563994ef132ce6cffd28fc659254ca37d032b5ef.1598011595.git.chris@chrisdown.name
</content>
</entry>
<entry>
<title>x86/msr: Filter MSR writes</title>
<updated>2020-06-25T08:39:02Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2020-06-10T19:37:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a7e1f67ed29f0c339e2aa7483d13b085127566ab'/>
<id>urn:sha1:a7e1f67ed29f0c339e2aa7483d13b085127566ab</id>
<content type='text'>
Add functionality to disable writing to MSRs from userspace. Writes can
still be allowed by supplying the allow_writes=on module parameter. The
kernel will be tainted so that it shows in oopses.

Having unfettered access to all MSRs on a system is and has always been
a disaster waiting to happen. Think performance counter MSRs, MSRs with
sticky or locked bits, MSRs making major system changes like loading
microcode, MTRRs, PAT configuration, TSC counter, security mitigations
MSRs, you name it.

This also destroys all the kernel's caching of MSR values for
performance, as the recent case with MSR_AMD64_LS_CFG showed.

Another example is writing MSRs by mistake by simply typing the wrong
MSR address. System freezes have been experienced that way.

In general, poking at MSRs under the kernel's feet is a bad bad idea.

So log writing to MSRs by default. Longer term, such writes will be
disabled by default.

If userspace still wants to do that, then proper interfaces should be
defined which are under the kernel's control and accesses to those MSRs
can be synchronized and sanitized properly.

[ Fix sparse warnings. ]
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Tested-by: Sean Christopherson &lt;sean.j.christopherson@intel.com&gt;
Link: https://lkml.kernel.org/r/20200612105026.GA22660@zn.tnic
</content>
</entry>
<entry>
<title>x86/msr: Restrict MSR access when the kernel is locked down</title>
<updated>2019-08-20T04:54:16Z</updated>
<author>
<name>Matthew Garrett</name>
</author>
<published>2019-08-20T00:17:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=95f5e95f41dff31b2a4566c5a8975c08a49ae4e3'/>
<id>urn:sha1:95f5e95f41dff31b2a4566c5a8975c08a49ae4e3</id>
<content type='text'>
Writing to MSRs should not be allowed if the kernel is locked down, since
it could lead to execution of arbitrary code in kernel mode.  Based on a
patch by Kees Cook.

Signed-off-by: Matthew Garrett &lt;mjg59@google.com&gt;
Signed-off-by: David Howells &lt;dhowells@redhat.com&gt;
Acked-by: Kees Cook &lt;keescook@chromium.org&gt;
Reviewed-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
cc: x86@kernel.org
Signed-off-by: James Morris &lt;jmorris@namei.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 142</title>
<updated>2019-05-30T18:25:17Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2019-05-24T10:04:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a94da204fded9dccd545782c17959469519ef3a8'/>
<id>urn:sha1:a94da204fded9dccd545782c17959469519ef3a8</id>
<content type='text'>
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license as published by
  the free software foundation inc 675 mass ave cambridge ma 02139 usa
  either version 2 of the license or at your option any later version
  incorporated herein by reference

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 4 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Richard Fontana &lt;rfontana@redhat.com&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Reviewed-by: Kate Stewart &lt;kstewart@linuxfoundation.org&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190524100844.465381181@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>x86: Clean up 'sizeof x' =&gt; 'sizeof(x)'</title>
<updated>2018-10-29T06:13:28Z</updated>
<author>
<name>Jordan Borgner</name>
</author>
<published>2018-10-28T12:58:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e96f31ea4249b1e94e266fe4dff908c2983a9b3'/>
<id>urn:sha1:0e96f31ea4249b1e94e266fe4dff908c2983a9b3</id>
<content type='text'>
"sizeof(x)" is the canonical coding style used in arch/x86 most of the time.
Fix the few places that didn't follow the convention.

(Also do some whitespace cleanups in a few places while at it.)

[ mingo: Rewrote the changelog. ]

Signed-off-by: Jordan Borgner &lt;mail@jordan-borgner.de&gt;
Cc: Borislav Petkov &lt;bp@alien8.de&gt;
Cc: H. Peter Anvin &lt;hpa@zytor.com&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: http://lkml.kernel.org/r/20181028125828.7rgammkgzep2wpam@JordanDesktop
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
</feed>
