svn commit: r343265 - head/sys/dev/hwpmc

Mark Johnston markj at FreeBSD.org
Mon Jan 21 18:07:03 UTC 2019


Author: markj
Date: Mon Jan 21 18:07:02 2019
New Revision: 343265
URL: https://svnweb.freebsd.org/changeset/base/343265

Log:
  hwpmc: Plug memory disclosures from PMC_OP_{GETPMCINFO,GETCPUINFO}.
  
  admbugs:	765
  Reported by:	Vlad Tsyrklevich <vlad at tsyrklevich.net>
  MFC after:	1 day
  Security:	Kernel memory disclosure
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/hwpmc/hwpmc_mod.c

Modified: head/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- head/sys/dev/hwpmc/hwpmc_mod.c	Mon Jan 21 17:58:06 2019	(r343264)
+++ head/sys/dev/hwpmc/hwpmc_mod.c	Mon Jan 21 18:07:02 2019	(r343265)
@@ -3512,6 +3512,7 @@ pmc_syscall_handler(struct thread *td, void *syscall_a
 		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_a
 		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;
 


More information about the svn-src-head mailing list