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

(cherry picked from commit 8399d923a5697b7c194dbd44c33018c94ec42c4e)

Details

Provenance
mhorneAuthored on Aug 4 2021, 5:37 PM
mavCommitted on Jul 4 2022, 5:48 PM
Parents
rGf0577f42b24a: riscv timer: remove intermediate helper
Branches
Unknown
Tags
Unknown