DTrace copyin with struct doesn't work?
Andriy Gapon
avg at FreeBSD.org
Wed Jul 24 18:33:57 UTC 2013
on 24/07/2013 21:13 Yuri said the following:
> This simple .d script fails:
>
> ---script begin---
> #!/usr/sbin/dtrace -s
>
> struct my_args {
> int ii;
> };
>
> fbt::sys_select:entry
> {
> printf("sys_select %i", ((struct my_args*)copyin(arg1, sizeof (struct
> my_args)))->ii);
> }
> ---script end---
>
> dtrace: error on enabled probe ID 1 (ID 33598: fbt:kernel:sys_select:entry):
> invalid address (0xffffff82ff0799d8) in action #1 at DIF offset 40
> dtrace: error on enabled probe ID 1 (ID 33598: fbt:kernel:sys_select:entry):
> invalid address (0xffffff82fefb19d8) in action #1 at DIF offset 40
>
> Function sys_select is defined in kern/sys_generic.c:
> int
> sys_select(struct thread *td, struct select_args *uap)
>From sys_select code it is clear that uap points to something that is already
copied in. Unlike some fields within select_args.
> arg1 in DTrace script should correspond to uap argument of sys_select, and
> dereferencing should always produce an int.
--
Andriy Gapon
More information about the freebsd-hackers
mailing list