Re: DTrace panic while probing syscall::open (and possibly many others)

From: Andriy Gapon <avg_at_freebsd.org>
Date: Wed, 24 Jun 2009 16:17:02 +0300
on 24/06/2009 03:35 Wesley Shields said the following:
> This patch makes it work for me and uses INKERNEL. I have no idea if
> it's correct or not...
> 
> Index: sys/cddl/dev/dtrace/amd64/dtrace_isa.c
> ===================================================================
> --- sys/cddl/dev/dtrace/amd64/dtrace_isa.c	(revision 194740)
> +++ sys/cddl/dev/dtrace/amd64/dtrace_isa.c	(working copy)
> _at__at_ -524,9 +524,9 _at__at_
>  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 (INKERNEL(uaddr + size) || uaddr + size < uaddr) {
>  		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
>  		cpu_core[curcpu].cpuc_dtrace_illval = uaddr;
>  		return (0);
> 
> 
> I've put a copy up at http://people.freebsd.org/~wxs/dtrace.diff too.

Wesley,

thank you!

I like this patch and I am sure that it does the right thing.
I think that we should retire kernelbase from amd64 altogether and replace all
other uses of it in dtrace_isa.c (uaddr checks) similarly to the above, and remove
unused extern declaration in dtrace_subr.c too.

-- 
Andriy Gapon
Received on Wed Jun 24 2009 - 11:17:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:50 UTC