kernel 5.2 disallows thermald's direct MSR writes

Bug #1840454 reported by Julian Andres Klode
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Confirmed
Undecided
Unassigned
thermald (Ubuntu)
New
Undecided
Unassigned

Bug Description

thermald/kernel are spamming dmesg now because MSR write is disallowed.

jak@jak-t480s:~:master$ journalctl -b --since=today | grep msr | wc -l
8688
jak@jak-t480s:~:master$ journalctl -b --since=today | grep msr | tail
Aug 16 14:48:57 jak-t480s thermald[11327]: [WARN]sysfs write failed /dev/cpu/0/msr
Aug 16 14:48:57 jak-t480s kernel: msr: Direct access to MSR 1a2
Aug 16 14:49:05 jak-t480s thermald[11327]: [WARN]sysfs write failed /dev/cpu/0/msr
Aug 16 14:49:05 jak-t480s kernel: msr: Direct access to MSR 1a2
Aug 16 14:49:13 jak-t480s thermald[11327]: [WARN]sysfs write failed /dev/cpu/0/msr
Aug 16 14:49:13 jak-t480s kernel: msr: Direct access to MSR 1a2
Aug 16 14:49:21 jak-t480s thermald[11327]: [WARN]sysfs write failed /dev/cpu/0/msr
Aug 16 14:49:21 jak-t480s kernel: msr: Direct access to MSR 1a2
Aug 16 14:50:03 jak-t480s kernel: msr: Direct access to MSR 1a2
Aug 16 14:50:03 jak-t480s thermald[11327]: [WARN]sysfs write failed /dev/cpu/0/msr
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu7
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC2: jak 5499 F.... pulseaudio
 /dev/snd/controlC1: jak 5499 F.... pulseaudio
 /dev/snd/controlC0: jak 5499 F.... pulseaudio
CurrentDesktop: GNOME
DistroRelease: Ubuntu 19.10
HibernationDevice: RESUME=none
InstallationDate: Installed on 2018-03-14 (520 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Alpha amd64 (20180313)
MachineType: LENOVO 20L8S02D00
NonfreeKernelModules: zfs zunicode zavl icp zcommon znvpair
Package: thermald 1.9.0-1
PackageArchitecture: amd64
ProcFB: 0 i915drmfb
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-5.2.0-10-generic root=/dev/mapper/ubuntu--vg-root ro rootflags=subvol=@
ProcVersionSignature: Ubuntu 5.2.0-10.11-generic 5.2.4
RelatedPackageVersions:
 linux-restricted-modules-5.2.0-10-generic N/A
 linux-backports-modules-5.2.0-10-generic N/A
 linux-firmware 1.181
Tags: eoan third-party-packages
Uname: Linux 5.2.0-10-generic x86_64
UpgradeStatus: Upgraded to eoan on 2018-11-20 (269 days ago)
UserGroups: adm cdrom dip fax input kvm libvirt lpadmin lxd plugdev sambashare sbuild sudo
_MarkForUpload: True
dmi.bios.date: 04/22/2019
dmi.bios.vendor: LENOVO
dmi.bios.version: N22ET54W (1.31 )
dmi.board.asset.tag: Not Available
dmi.board.name: 20L8S02D00
dmi.board.vendor: LENOVO
dmi.board.version: Not Defined
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: None
dmi.modalias: dmi:bvnLENOVO:bvrN22ET54W(1.31):bd04/22/2019:svnLENOVO:pn20L8S02D00:pvrThinkPadT480s:rvnLENOVO:rn20L8S02D00:rvrNotDefined:cvnLENOVO:ct10:cvrNone:
dmi.product.family: ThinkPad T480s
dmi.product.name: 20L8S02D00
dmi.product.sku: LENOVO_MT_20L8_BU_Think_FM_ThinkPad T480s
dmi.product.version: ThinkPad T480s
dmi.sys.vendor: LENOVO

Revision history for this message
Anthony Wong (anthonywong) wrote :

Can you try 5.3rc kernel such as https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.3-rc4/?

I believe the patchset https://lore<email address hidden>/T/#t is needed, which got merged in 5.3.

Revision history for this message
Colin Ian King (colin-king) wrote :

I wonder if the msr module is not loaded. Try

sudo modprobe msr

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

No I think it's because kernel lockdown:
commit 708822cdbcd3faab40e83a79b71617e1812a1b06
Author: Matthew Garrett <email address hidden>
Date: Mon Feb 18 12:44:59 2019 +0000

    UBUNTU: SAUCE: (efi-lockdown) x86/msr: Restrict MSR access when the kernel is locked down

    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.

    MSR accesses are logged for the purposes of building up a whitelist as per
    Alan Cox's suggestion.

    Signed-off-by: Matthew Garrett <email address hidden>
    Signed-off-by: David Howells <email address hidden>
    Acked-by: Kees Cook <email address hidden>
    Reviewed-by: Thomas Gleixner <email address hidden>
    cc: <email address hidden>
    Signed-off-by: Matthew Garrett <email address hidden>
    (cherry picked from commit 323bd1cb92e03558ae3f3a11dd683dcbb23eeaea
     git://git.kernel.org/pub/scm/linux/kernel/git/jwboyer/fedora.git)
    Signed-off-by: Seth Forshee <email address hidden>

Revision history for this message
Colin Ian King (colin-king) wrote :

Good point.

Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:

apport-collect 1840454

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Srinivas Pandruvada (srinivas-pandruvada) wrote :

The patch for changing TCC offset can only be in for 5.4 kernel. Then there will be no MSR access.
So the option is to take out of mainline kernel patch to avoid this or avoid workaround option.
I don't know if there are any other options.

Revision history for this message
Julian Andres Klode (juliank) wrote : AlsaInfo.txt

apport information

tags: added: apport-collected eoan third-party-packages
description: updated
Revision history for this message
Julian Andres Klode (juliank) wrote : CRDA.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : CurrentDmesg.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : Dependencies.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : IwConfig.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : Lspci.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : Lsusb.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : ProcEnviron.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : ProcInterrupts.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : ProcModules.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : PulseList.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : RfKill.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : UdevDb.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote : WifiSyslog.txt

apport information

Revision history for this message
Julian Andres Klode (juliank) wrote :

Noteworthy maybe is that this did not seem to happen in 5.2.0-9, but that one complained about 1b0

Jul 27 16:44:16 jak-t480s kernel: msr: Direct access to MSR 1b0

but far less often :D

Changed in linux (Ubuntu):
status: Incomplete → New
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Revision history for this message
Anthony Wong (anthonywong) wrote : Re: [Bug 1840454] Re: kernel 5.2 disallows thermald's direct MSR writes

On Sat, Aug 17, 2019 at 1:05 AM Srinivas Pandruvada <
<email address hidden>> wrote:

> The patch for changing TCC offset can only be in for 5.4 kernel. Then
> there will be no MSR access.
>

Is it https://lkml.org/lkml/2019/7/22/1286? Should it work when system is
locked down?

> So the option is to take out of mainline kernel patch to avoid this or
> avoid workaround option.
>

Isn't the workaround option no longer applies to TCC offset adjustment?

Revision history for this message
Srinivas Pandruvada (srinivas-pandruvada) wrote :

On Sat, 2019-08-17 at 05:24 +0000, Anthony Wong wrote:
> On Sat, Aug 17, 2019 at 1:05 AM Srinivas Pandruvada <
> <email address hidden>> wrote:
>
> > The patch for changing TCC offset can only be in for 5.4 kernel.
> > Then
> > there will be no MSR access.
> >
>
> Is it https://lkml.org/lkml/2019/7/22/1286? Should it work when
> system is
> locked down?
Yes.

>
>
> > So the option is to take out of mainline kernel patch to avoid this
> > or
> > avoid workaround option.
> >
>
> Isn't the workaround option no longer applies to TCC offset
> adjustment?
TCC adjustment is required for some platform, so either we wait for
kernel patch merged or live with lock down errors with MSR accesses.

Thanks,
Srinivas

>

Brad Figg (brad-figg)
tags: added: ubuntu-certified
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.