HomeFreeBSD

hwpmc_intel: assert for correct nclasses value

Description

hwpmc_intel: assert for correct nclasses value

This variable is set based on the exact CPU model detected. If this
value is set too small, it could lead to a NULL-dereference from an
improperly initialized pmc_rowindex_to_classdep array.

Though it has been fixed, this was previously the case for Broadwell.
Add two asserts to catch this in DEBUG kernels, as it represents a
configuration error that may be hard to uncover otherwise.

PR: 253687
Reported by: Zhenlei Huang <zlei.huang@gmail.com>
Sponsored by: The FreeBSD Foundation

Details

Provenance
mhorneAuthored on Aug 4 2021, 5:37 PM
Parents
R10:4f35e8cba232: hwpmc: disable uncore class on Sandy Bridge and newer
Branches
Unknown
Tags
Unknown