]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Jun 2020 10:48:24 +0000 (12:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 29 Jun 2020 10:48:24 +0000 (12:48 +0200)
added patches:
acpi-sysfs-fix-pm_profile_attr-type.patch
kvm-x86-fix-msr-range-of-apic-registers-in-x2apic-mode.patch

queue-4.4/acpi-sysfs-fix-pm_profile_attr-type.patch [new file with mode: 0644]
queue-4.4/blktrace-break-out-of-blktrace-setup-on-concurrent-c.patch
queue-4.4/kvm-x86-fix-msr-range-of-apic-registers-in-x2apic-mode.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/acpi-sysfs-fix-pm_profile_attr-type.patch b/queue-4.4/acpi-sysfs-fix-pm_profile_attr-type.patch
new file mode 100644 (file)
index 0000000..5271338
--- /dev/null
@@ -0,0 +1,94 @@
+From e6d701dca9893990d999fd145e3e07223c002b06 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <natechancellor@gmail.com>
+Date: Thu, 11 Jun 2020 21:51:50 -0700
+Subject: ACPI: sysfs: Fix pm_profile_attr type
+
+From: Nathan Chancellor <natechancellor@gmail.com>
+
+commit e6d701dca9893990d999fd145e3e07223c002b06 upstream.
+
+When running a kernel with Clang's Control Flow Integrity implemented,
+there is a violation that happens when accessing
+/sys/firmware/acpi/pm_profile:
+
+$ cat /sys/firmware/acpi/pm_profile
+0
+
+$ dmesg
+...
+[   17.352564] ------------[ cut here ]------------
+[   17.352568] CFI failure (target: acpi_show_profile+0x0/0x8):
+[   17.352572] WARNING: CPU: 3 PID: 497 at kernel/cfi.c:29 __cfi_check_fail+0x33/0x40
+[   17.352573] Modules linked in:
+[   17.352575] CPU: 3 PID: 497 Comm: cat Tainted: G        W         5.7.0-microsoft-standard+ #1
+[   17.352576] RIP: 0010:__cfi_check_fail+0x33/0x40
+[   17.352577] Code: 48 c7 c7 50 b3 85 84 48 c7 c6 50 0a 4e 84 e8 a4 d8 60 00 85 c0 75 02 5b c3 48 c7 c7 dc 5e 49 84 48 89 de 31 c0 e8 7d 06 eb ff <0f> 0b 5b c3 00 00 cc cc 00 00 cc cc 00 85 f6 74 25 41 b9 ea ff ff
+[   17.352577] RSP: 0018:ffffaa6dc3c53d30 EFLAGS: 00010246
+[   17.352578] RAX: 331267e0c06cee00 RBX: ffffffff83d85890 RCX: ffffffff8483a6f8
+[   17.352579] RDX: ffff9cceabbb37c0 RSI: 0000000000000082 RDI: ffffffff84bb9e1c
+[   17.352579] RBP: ffffffff845b2bc8 R08: 0000000000000001 R09: ffff9cceabbba200
+[   17.352579] R10: 000000000000019d R11: 0000000000000000 R12: ffff9cc947766f00
+[   17.352580] R13: ffffffff83d6bd50 R14: ffff9ccc6fa80000 R15: ffffffff845bd328
+[   17.352582] FS:  00007fdbc8d13580(0000) GS:ffff9cce91ac0000(0000) knlGS:0000000000000000
+[   17.352582] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[   17.352583] CR2: 00007fdbc858e000 CR3: 00000005174d0000 CR4: 0000000000340ea0
+[   17.352584] Call Trace:
+[   17.352586]  ? rev_id_show+0x8/0x8
+[   17.352587]  ? __cfi_check+0x45bac/0x4b640
+[   17.352589]  ? kobj_attr_show+0x73/0x80
+[   17.352590]  ? sysfs_kf_seq_show+0xc1/0x140
+[   17.352592]  ? ext4_seq_options_show.cfi_jt+0x8/0x8
+[   17.352593]  ? seq_read+0x180/0x600
+[   17.352595]  ? sysfs_create_file_ns.cfi_jt+0x10/0x10
+[   17.352596]  ? tlbflush_read_file+0x8/0x8
+[   17.352597]  ? __vfs_read+0x6b/0x220
+[   17.352598]  ? handle_mm_fault+0xa23/0x11b0
+[   17.352599]  ? vfs_read+0xa2/0x130
+[   17.352599]  ? ksys_read+0x6a/0xd0
+[   17.352601]  ? __do_sys_getpgrp+0x8/0x8
+[   17.352602]  ? do_syscall_64+0x72/0x120
+[   17.352603]  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
+[   17.352604] ---[ end trace 7b1fa81dc897e419 ]---
+
+When /sys/firmware/acpi/pm_profile is read, sysfs_kf_seq_show is called,
+which in turn calls kobj_attr_show, which gets the ->show callback
+member by calling container_of on attr (casting it to struct
+kobj_attribute) then calls it.
+
+There is a CFI violation because pm_profile_attr is of type
+struct device_attribute but kobj_attr_show calls ->show expecting it
+to be from struct kobj_attribute. CFI checking ensures that function
+pointer types match when doing indirect calls. Fix pm_profile_attr to
+be defined in terms of kobj_attribute so there is no violation or
+mismatch.
+
+Fixes: 362b646062b2 ("ACPI: Export FADT pm_profile integer value to userspace")
+Link: https://github.com/ClangBuiltLinux/linux/issues/1051
+Reported-by: yuu ichii <byahu140@heisei.be>
+Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
+Cc: 3.10+ <stable@vger.kernel.org> # 3.10+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/acpi/sysfs.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/acpi/sysfs.c
++++ b/drivers/acpi/sysfs.c
+@@ -776,13 +776,13 @@ static void __exit interrupt_stats_exit(
+ }
+ static ssize_t
+-acpi_show_profile(struct device *dev, struct device_attribute *attr,
++acpi_show_profile(struct kobject *kobj, struct kobj_attribute *attr,
+                 char *buf)
+ {
+       return sprintf(buf, "%d\n", acpi_gbl_FADT.preferred_profile);
+ }
+-static const struct device_attribute pm_profile_attr =
++static const struct kobj_attribute pm_profile_attr =
+       __ATTR(pm_profile, S_IRUGO, acpi_show_profile, NULL);
+ static ssize_t hotplug_enabled_show(struct kobject *kobj,
index 5e691bd4f4bb622df11788b4d1334852cc93e3fd..3111d7f6b37b6f218cc8d10cdf3f05ed71a7cfc2 100644 (file)
@@ -54,11 +54,9 @@ Reviewed-by: Christoph Hellwig <hch@lst.de>
 Signed-off-by: Jens Axboe <axboe@kernel.dk>
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- kernel/trace/blktrace.c | 13 +++++++++++++
+ kernel/trace/blktrace.c |   13 +++++++++++++
  1 file changed, 13 insertions(+)
 
-diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
-index 6737564680193..8ac3663e0012d 100644
 --- a/kernel/trace/blktrace.c
 +++ b/kernel/trace/blktrace.c
 @@ -15,6 +15,9 @@
@@ -71,7 +69,7 @@ index 6737564680193..8ac3663e0012d 100644
  #include <linux/kernel.h>
  #include <linux/blkdev.h>
  #include <linux/blktrace_api.h>
-@@ -481,6 +484,16 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
+@@ -481,6 +484,16 @@ int do_blk_trace_setup(struct request_qu
         */
        strreplace(buts->name, '/', '_');
  
@@ -88,6 +86,3 @@ index 6737564680193..8ac3663e0012d 100644
        bt = kzalloc(sizeof(*bt), GFP_KERNEL);
        if (!bt)
                return -ENOMEM;
--- 
-2.25.1
-
diff --git a/queue-4.4/kvm-x86-fix-msr-range-of-apic-registers-in-x2apic-mode.patch b/queue-4.4/kvm-x86-fix-msr-range-of-apic-registers-in-x2apic-mode.patch
new file mode 100644 (file)
index 0000000..bc42481
--- /dev/null
@@ -0,0 +1,45 @@
+From bf10bd0be53282183f374af23577b18b5fbf7801 Mon Sep 17 00:00:00 2001
+From: Xiaoyao Li <xiaoyao.li@intel.com>
+Date: Tue, 16 Jun 2020 15:33:07 +0800
+Subject: KVM: X86: Fix MSR range of APIC registers in X2APIC mode
+
+From: Xiaoyao Li <xiaoyao.li@intel.com>
+
+commit bf10bd0be53282183f374af23577b18b5fbf7801 upstream.
+
+Only MSR address range 0x800 through 0x8ff is architecturally reserved
+and dedicated for accessing APIC registers in x2APIC mode.
+
+Fixes: 0105d1a52640 ("KVM: x2apic interface to lapic")
+Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
+Message-Id: <20200616073307.16440-1-xiaoyao.li@intel.com>
+Cc: stable@vger.kernel.org
+Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
+Reviewed-by: Jim Mattson <jmattson@google.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kvm/x86.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/kvm/x86.c
++++ b/arch/x86/kvm/x86.c
+@@ -2162,7 +2162,7 @@ int kvm_set_msr_common(struct kvm_vcpu *
+               return kvm_mtrr_set_msr(vcpu, msr, data);
+       case MSR_IA32_APICBASE:
+               return kvm_set_apic_base(vcpu, msr_info);
+-      case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
++      case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
+               return kvm_x2apic_msr_write(vcpu, msr, data);
+       case MSR_IA32_TSCDEADLINE:
+               kvm_set_lapic_tscdeadline_msr(vcpu, data);
+@@ -2432,7 +2432,7 @@ int kvm_get_msr_common(struct kvm_vcpu *
+       case MSR_IA32_APICBASE:
+               msr_info->data = kvm_get_apic_base(vcpu);
+               break;
+-      case APIC_BASE_MSR ... APIC_BASE_MSR + 0x3ff:
++      case APIC_BASE_MSR ... APIC_BASE_MSR + 0xff:
+               return kvm_x2apic_msr_read(vcpu, msr_info->index, &msr_info->data);
+               break;
+       case MSR_IA32_TSCDEADLINE:
index aca0c5d3417a48040bf2aa590e7e13606ec115e0..1b611f84f67176cf2fa92b3d0de155240ca8a1ea 100644 (file)
@@ -117,3 +117,5 @@ sched-core-fix-pi-boosting-between-rt-and-deadline-t.patch
 net-alx-fix-race-condition-in-alx_remove.patch
 kbuild-improve-cc-option-to-clean-up-all-temporary-f.patch
 blktrace-break-out-of-blktrace-setup-on-concurrent-c.patch
+acpi-sysfs-fix-pm_profile_attr-type.patch
+kvm-x86-fix-msr-range-of-apic-registers-in-x2apic-mode.patch