This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Cannot access data passed in via gettimeofday
- From: Eugene Teo <eteo at redhat dot com>
- To: Perry Cheng <perryche at us dot ibm dot com>
- Cc: "systemtap at sources dot redhat dot com" <systemtap at sources dot redhat dot com>
- Date: Fri, 15 Dec 2006 09:11:22 +0800
- Subject: Re: Cannot access data passed in via gettimeofday
- Organization: Red Hat Asia Pacific
- References: <OF0D2461E2.660D946F-ON85257244.0078E70A-85257244.0079C9A5@us.ibm.com>
Perry Cheng wrote:
> I am having trouble getting parameters out of what seems to be a simple
> but buggy system-tap script. The script is included below and the test
> case (a short C program) follows. Basically, I am trying to hi-jack
> gettimeofday and piggyback some information back by treating the struct it
> passes in as a larger buffer than struct timeval. However, I need to
> separate regular calls to gettimeofday from the special ones where the
> special path triggers. To do this, I though I could treat the struct as
> an incoming parameter by looking for unusual bit patterns in the struct.
> Unfortunately, I can't seem to see the data at all despite using the
> copy_from_user function to copy data from user to kernel space. Any idea
> what's going on here? I additionally hijack stime so i can distinguish
> in the output my special call to gettimeofday. The sample out below
> shows that the special values 0xaaaaaaaa and 0xbbbbbbbb are not
> transmitted. If I use settimeofday instead of gettimeofday, then this
> program seems to work. It feels like there is some other mechanism at
> work here that I don't know about.
[eteo@kerndev tmp]$ stap -g test.stp -c ./test
Password:
---------------------------
gettimeofday 0: sec = aaaaaaaa usec = bbbbbbbb
---------------------------
gettimeofday 0: sec = 23a usec = 1
...
Eugene
--
1024D/58DF8823 print 47B9 90F6 AE4A 9C51 37E0 D6E1 EA84 C6A2 58DF 8823
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }