Skip to content

Commit 70479c0

Browse files
rchatreKAGA-KOKO
authored andcommitted
x86/intel_rdt: Fix unchecked MSR access
When a new resource group is created, it is initialized with sane defaults that currently assume the resource being initialized is a CAT resource. This code path is also followed by a MBA resource that is not allocated the same as a CAT resource and as a result we encounter the following unchecked MSR access error: unchecked MSR access error: WRMSR to 0xd51 (tried to write 0x0000 000000000064) at rIP: 0xffffffffae059994 (native_write_msr+0x4/0x20) Call Trace: mba_wrmsr+0x41/0x80 update_domains+0x125/0x130 rdtgroup_mkdir+0x270/0x500 Fix the above by ensuring the initial allocation is only attempted on a CAT resource. Fixes: 95f0b77 ("x86/intel_rdt: Initialize new resource group with sane defaults") Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: "H Peter Anvin" <hpa@zytor.com> Cc: "Tony Luck" <tony.luck@intel.com> Cc: "Xiaochen Shen" <xiaochen.shen@intel.com> Cc: "Chen Yu" <yu.c.chen@intel.com> Link: https://lkml.kernel.org/r/1537048707-76280-6-git-send-email-fenghua.yu@intel.com
1 parent 47d53b1 commit 70479c0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,12 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
23492349
u32 *ctrl;
23502350

23512351
for_each_alloc_enabled_rdt_resource(r) {
2352+
/*
2353+
* Only initialize default allocations for CBM cache
2354+
* resources
2355+
*/
2356+
if (r->rid == RDT_RESOURCE_MBA)
2357+
continue;
23522358
list_for_each_entry(d, &r->domains, list) {
23532359
d->have_new_ctrl = false;
23542360
d->new_ctrl = r->cache.shareable_bits;
@@ -2386,6 +2392,12 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp)
23862392
}
23872393

23882394
for_each_alloc_enabled_rdt_resource(r) {
2395+
/*
2396+
* Only initialize default allocations for CBM cache
2397+
* resources
2398+
*/
2399+
if (r->rid == RDT_RESOURCE_MBA)
2400+
continue;
23892401
ret = update_domains(r, rdtgrp->closid);
23902402
if (ret < 0) {
23912403
rdt_last_cmd_puts("failed to initialize allocations\n");

0 commit comments

Comments
 (0)