From owner-freebsd-bugs@FreeBSD.ORG Wed Jun 24 16:10:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B48C01065674 for ; Wed, 24 Jun 2009 16:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 974B48FC20 for ; Wed, 24 Jun 2009 16:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OGA3L9060558 for ; Wed, 24 Jun 2009 16:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n5OGA3Ou060557; Wed, 24 Jun 2009 16:10:03 GMT (envelope-from gnats) Date: Wed, 24 Jun 2009 16:10:03 GMT Message-Id: <200906241610.n5OGA3Ou060557@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) Cc: Subject: Re: kern/134408: commit references a PR X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 16:10:04 -0000 The following reply was made to PR kern/134408; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/134408: commit references a PR Date: Wed, 24 Jun 2009 16:04:08 +0000 (UTC) Author: avg Date: Wed Jun 24 16:03:57 2009 New Revision: 194850 URL: http://svn.freebsd.org/changeset/base/194850 Log: dtrace/amd64: fix virtual address checks On amd64 KERNBASE/kernbase does not mean start of kernel memory. This should fix a KASSERT panic in dtrace_copycheck when copyin*() is used in D program. Also make checks for user memory a bit stricter. Reported by: Thomas Backman Submitted by: wxs (kaddr part) Tested by: Thomas Backman (prototype), wxs Reviewed by: alc (concept), jhb, current@ Aprroved by: jb (concept) MFC after: 2 weeks PR: kern/134408 Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Wed Jun 24 15:48:20 2009 (r194849) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Wed Jun 24 16:03:57 2009 (r194850) @@ -42,8 +42,6 @@ #include #include -extern uintptr_t kernbase; -uintptr_t kernelbase = (uintptr_t) &kernbase; uint8_t dtrace_fuword8_nocheck(void *); uint16_t dtrace_fuword16_nocheck(void *); @@ -524,9 +522,9 @@ dtrace_getreg(struct regs *rp, uint_t re static int dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) { - ASSERT(kaddr >= kernelbase && kaddr + size >= kaddr); + ASSERT(INKERNEL(kaddr) && kaddr + size >= kaddr); - if (uaddr + size >= kernelbase || uaddr + size < uaddr) { + if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = uaddr; return (0); @@ -570,7 +568,7 @@ dtrace_copyoutstr(uintptr_t kaddr, uintp uint8_t dtrace_fuword8(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -581,7 +579,7 @@ dtrace_fuword8(void *uaddr) uint16_t dtrace_fuword16(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -592,7 +590,7 @@ dtrace_fuword16(void *uaddr) uint32_t dtrace_fuword32(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -603,7 +601,7 @@ dtrace_fuword32(void *uaddr) uint64_t dtrace_fuword64(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jun 24 15:48:20 2009 (r194849) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jun 24 16:03:57 2009 (r194850) @@ -40,7 +40,6 @@ #include #include -extern uintptr_t kernelbase; extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"