hwpmc: Plug memory disclosures from PMC_OP_{GETPMCINFO,GETCPUINFO}.

admbugs:	765
Reported by:	Vlad Tsyrklevich <vlad@tsyrklevich.net>
MFC after:	1 day
Security:	Kernel memory disclosure
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
markj 2019-01-21 18:07:02 +00:00
parent b0a44857b4
commit ef1eba7c67

View File

@ -3512,6 +3512,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
struct pmc_classdep *pcd;
int cl;
memset(&gci, 0, sizeof(gci));
gci.pm_cputype = md->pmd_cputype;
gci.pm_ncpu = pmc_cpu_max();
gci.pm_npmc = md->pmd_npmc;
@ -3661,7 +3662,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_args)
npmc = md->pmd_npmc;
pmcinfo_size = npmc * sizeof(struct pmc_info);
pmcinfo = malloc(pmcinfo_size, M_PMC, M_WAITOK);
pmcinfo = malloc(pmcinfo_size, M_PMC, M_WAITOK | M_ZERO);
p = pmcinfo;