HomeFreeBSD

hwpmc: consistently validate PMC class in allocation method

Description

hwpmc: consistently validate PMC class in allocation method

It is always a good idea. In one case, attempting to allocate N+1 PMCs
from a class with N hardware counters would incorrectly attempt to
allocate from the next class in the list. Without this validation, this
can lead to all kinds of strange behaviour.

Since powerpc_allocate_pmc() is used by both the mpc7xxx and ppc970
classes, add a new global to track which is active (it will never be
both).

Reviewed by: luporl, ray
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31387

Details

Provenance
mhorneAuthored on Aug 30 2021, 5:02 PM
Reviewer
luporl
Differential Revision
D31387: hwpmc: consistently validate PMC class in allocation method
Parents
rG564b6aa7fccd: aesni: Avoid a potential out-of-bounds load in aes_encrypt_icm()
Branches
Unknown
Tags
Unknown