- Prevent unintentional page sharing by checking whether a page
reference to a PMU samples page has been acquired properly before that - Make sure the LBR_SELECT MSR is saved/restored too - Reset the LBR_SELECT MSR when resetting the LBR PMU to clear any residual data left -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmGQ5z8ACgkQEsHwGGHe VUqqdQ/+JIV6t0yIj7aNADaakwAe+i9zFzzUuvb5KT0zPzZirswkz6xeZ4g8S8PZ lSjqKk8M2Yt3SJiqi/s3KNIOev52wtKGmeOFz1I+DUNpgk0wGHkRtVHV/iSptB61 Kp/fJvOVppY5grs5B0fRYkM5e477RPyZo+E0COKnff1bQ+k+z2ItMLCVxFCxQS6k HmgPW7CBye811YcEg28lSwgS1OXiMZ19gACIsqnQ6kQP2Puo8+HT1/V1n+0grejb OeYxURuYSRPd6Ft76qz0YlRIe1dgKllUBr7b0AaM11ADBMtWBTxqJcQvq/mOIHmT 9to0dVB/xFySR57iaL7BRuZFOrt8MRqJniEedMO99Dm9sxEVfHs1iXC9r7wZxQAf /HcvVkcyOJD92Kv+4LS5tKjowCByOYEJW2YQIgXEbA6oIhRuM9/fdxEW6lHwgdwc BPnOR6rtYuq+I+merBIIijAuf8OsIGY7ap2B+f7DkiOtA9+SHZsrU22J8T7CED/w gmrAC3+3KGt7YDs6WZTbvkXminZQyu5WpHe+2K6dlCIPmJLqEsYUx8TeXa/okyvb 8ZXy/CfJNbHUrk6GZw7RFoeannwSPv9ZJO3Mfy5PDvwDk0Fj0J+/G92mR2Zucxpo siNyBCivPY5vBPqk+x6eUPev/C3wPS+dNrs4HOyr1N2gZwgTk40= =Ciqw -----END PGP SIGNATURE----- Merge tag 'perf_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull perf fixes from Borislav Petkov: - Prevent unintentional page sharing by checking whether a page reference to a PMU samples page has been acquired properly before that - Make sure the LBR_SELECT MSR is saved/restored too - Reset the LBR_SELECT MSR when resetting the LBR PMU to clear any residual data left * tag 'perf_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/core: Avoid put_page() when GUP fails perf/x86/vlbr: Add c->flags to vlbr event constraints perf/x86/lbr: Reset LBR_SELECT during vlbr reset
This commit is contained in:
commit
f7018be292
|
@ -3048,8 +3048,10 @@ intel_vlbr_constraints(struct perf_event *event)
|
|||
{
|
||||
struct event_constraint *c = &vlbr_constraint;
|
||||
|
||||
if (unlikely(constraint_match(c, event->hw.config)))
|
||||
if (unlikely(constraint_match(c, event->hw.config))) {
|
||||
event->hw.flags |= c->flags;
|
||||
return c;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -265,6 +265,8 @@ void intel_pmu_lbr_reset(void)
|
|||
|
||||
cpuc->last_task_ctx = NULL;
|
||||
cpuc->last_log_id = 0;
|
||||
if (!static_cpu_has(X86_FEATURE_ARCH_LBR) && cpuc->lbr_select)
|
||||
wrmsrl(MSR_LBR_SELECT, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -7154,7 +7154,6 @@ void perf_output_sample(struct perf_output_handle *handle,
|
|||
static u64 perf_virt_to_phys(u64 virt)
|
||||
{
|
||||
u64 phys_addr = 0;
|
||||
struct page *p = NULL;
|
||||
|
||||
if (!virt)
|
||||
return 0;
|
||||
|
@ -7173,14 +7172,15 @@ static u64 perf_virt_to_phys(u64 virt)
|
|||
* If failed, leave phys_addr as 0.
|
||||
*/
|
||||
if (current->mm != NULL) {
|
||||
struct page *p;
|
||||
|
||||
pagefault_disable();
|
||||
if (get_user_page_fast_only(virt, 0, &p))
|
||||
if (get_user_page_fast_only(virt, 0, &p)) {
|
||||
phys_addr = page_to_phys(p) + virt % PAGE_SIZE;
|
||||
put_page(p);
|
||||
}
|
||||
pagefault_enable();
|
||||
}
|
||||
|
||||
if (p)
|
||||
put_page(p);
|
||||
}
|
||||
|
||||
return phys_addr;
|
||||
|
|
Loading…
Reference in New Issue