if (is_p9)
pattern_cache_loop(); else
indirect_branch_loop();
prctl(PR_TASK_PERF_EVENTS_DISABLE);
event_read(&events[0]);
event_read(&events[1]);
// We could scale all the events by running/enabled but we're lazy // As long as the PMU is uncontended they should all run
FAIL_IF(events[0].result.running != events[0].result.enabled);
FAIL_IF(events[1].result.running != events[1].result.enabled);
pred = events[0].result.value;
mpred = events[1].result.value;
switch (state) { case VULNERABLE: case NOT_AFFECTED: case COUNT_CACHE_FLUSH_SW: case COUNT_CACHE_FLUSH_HW: // These should all not affect userspace branch prediction if (miss_percent > 15) { if (miss_percent > 95) { /* * Such a mismatch may be caused by a system being unaware * the count cache is disabled. This may be to enable * guest migration between hosts with different settings. * Return skip code to avoid detecting this as an error. * We are not vulnerable and reporting otherwise, so * missing such a mismatch is safe.
*/
printf("Branch misses > 95%% unexpected in this configuration.\n");
printf("Count cache likely disabled without Linux knowing.\n"); if (state == COUNT_CACHE_FLUSH_SW)
printf("WARNING: Kernel performing unnecessary flushes.\n"); return 4;
}
printf("Branch misses > 15%% unexpected in this configuration!\n");
printf("Possible mismatch between reported & actual mitigation\n");
return 1;
} break; case BRANCH_SERIALISATION: // This seems to affect userspace branch prediction a bit? if (miss_percent > 25) {
printf("Branch misses > 25%% unexpected in this configuration!\n");
printf("Possible mismatch between reported & actual mitigation\n"); return 1;
} break; case COUNT_CACHE_DISABLED: if (miss_percent < 95) {
printf("Branch misses < 95%% unexpected in this configuration!\n");
printf("Possible mismatch between reported & actual mitigation\n"); return 1;
} break; case UNKNOWN: case BTB_FLUSH:
printf("Not sure!\n"); return 1;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.