DTrace copyin with struct doesn't work?

2013-07-24 Thread Yuri

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 (0xff82ff0799d8) in 
action #1 at DIF offset 40
dtrace: error on enabled probe ID 1 (ID 33598: 
fbt:kernel:sys_select:entry): invalid address (0xff82fefb19d8) 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)


arg1 in DTrace script should correspond to uap argument of sys_select, 
and dereferencing should always produce an int.


Yuri
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org


Re: DTrace copyin with struct doesn't work?

2013-07-24 Thread Andriy Gapon
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 (0xff82ff0799d8) in action #1 at DIF offset 40
 dtrace: error on enabled probe ID 1 (ID 33598: fbt:kernel:sys_select:entry):
 invalid address (0xff82fefb19d8) 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
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to freebsd-hackers-unsubscr...@freebsd.org