Date: Wed, 24 Jun 2009 16:10:03 GMT From: dfilter@FreeBSD.ORG (dfilter service) To: freebsd-bugs@FreeBSD.org Subject: Re: kern/134408: commit references a PR Message-ID: <200906241610.n5OGA3Ou060557@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <serenity@exscape.org> 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 <vm/vm_param.h> #include <vm/pmap.h> -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 <machine/frame.h> #include <vm/pmap.h> -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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906241610.n5OGA3Ou060557>