Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jan 2019 18:07:02 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r343265 - head/sys/dev/hwpmc
Message-ID:  <201901211807.x0LI722p098830@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901211807.x0LI722p098830>