Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Feb 2014 15:57:38 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r261799 - head/lib/libkvm
Message-ID:  <201402121557.s1CFvccH061255@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Wed Feb 12 15:57:38 2014
New Revision: 261799
URL: http://svnweb.freebsd.org/changeset/base/261799

Log:
  Add bounds check for pteindex / pdeindex

Modified:
  head/lib/libkvm/kvm_minidump_amd64.c

Modified: head/lib/libkvm/kvm_minidump_amd64.c
==============================================================================
--- head/lib/libkvm/kvm_minidump_amd64.c	Wed Feb 12 13:55:30 2014	(r261798)
+++ head/lib/libkvm/kvm_minidump_amd64.c	Wed Feb 12 15:57:38 2014	(r261799)
@@ -214,6 +214,8 @@ _kvm_minidump_vatop_v1(kvm_t *kd, u_long
 
 	if (va >= vm->hdr.kernbase) {
 		pteindex = (va - vm->hdr.kernbase) >> PAGE_SHIFT;
+		if (pteindex >= vm->hdr.pmapsize / sizeof(*vm->page_map))
+			goto invalid;
 		pte = vm->page_map[pteindex];
 		if (((u_long)pte & PG_V) == 0) {
 			_kvm_err(kd, kd->program, "_kvm_vatop: pte not valid");
@@ -264,6 +266,8 @@ _kvm_minidump_vatop(kvm_t *kd, u_long va
 
 	if (va >= vm->hdr.kernbase) {
 		pdeindex = (va - vm->hdr.kernbase) >> PDRSHIFT;
+		if (pdeindex >= vm->hdr.pmapsize / sizeof(*vm->page_map))
+			goto invalid;
 		pde = vm->page_map[pdeindex];
 		if (((u_long)pde & PG_V) == 0) {
 			_kvm_err(kd, kd->program, "_kvm_vatop: pde not valid");



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