diff options
Diffstat (limited to 'tapset')
-rw-r--r-- | tapset/ChangeLog | 36 | ||||
-rw-r--r-- | tapset/aux_syscalls.stp | 112 | ||||
-rw-r--r-- | tapset/ctime.stp | 39 | ||||
-rw-r--r-- | tapset/nfs.stp | 2 | ||||
-rw-r--r-- | tapset/signal.stp | 4 | ||||
-rw-r--r-- | tapset/syscalls2.stp | 26 | ||||
-rw-r--r-- | tapset/vfs.stp | 14 | ||||
-rw-r--r-- | tapset/x86_64/syscalls.stp | 2 |
8 files changed, 152 insertions, 83 deletions
diff --git a/tapset/ChangeLog b/tapset/ChangeLog index 70d75b83..4b37471c 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,39 @@ +2008-05-21 Frank Ch. Eigler <fche@elastic.org> + + PR 6538 + * nfs.stp (nfs.aop.readpage): Fix rsize. + +2008-05-20 Frank Ch. Eigler <fche@elastic.org> + + PR 6538 + * signal.stp (_signal.send.part[23]): Initialize dummy sinfo. + * syscalls2.stp (syscall.compat_sys_semtimedop): Fix sops_uaddr. + * vfs.stp (__find_bdevname): Rewrite. + * x86_64/syscalls.stp (syscall.pipe32): Fix argstr. + +2008-05-21 Mark Wielaard <mwielaard@redhat.com> + + * syscalls2.stp (syscall.utime): Use pointer_arg to fetch arguments. + (syscall.compat_utime): Likewise. + +2008-05-20 Mark Wielaard <mwielaard@redhat.com> + + PR 5001 + * aux_syscalls.stp (_stp_ctime): Removed. + (_struct_utimbuf_u): Removed. + (_struct_compat_utimbuf_u): Removed. + (_struct_utimbuf_actime): New function. + (_struct_utimbuf_modtime): New function. + (_struct_compat_utimbuf_actime): New function. + (_struct_compat_utimbuf_modtime): New function. + * syscalls2.stp (syscall.utime): Use new functions and ctime. + (syscall.compat_utime): Likewise. + +2008-05-19 Mark Wielaard <mwielaard@redhat.com> + + PR 6524 + * ctime.stp: Don't try to convert values that won't fit in 32bits. + 2008-05-08 Ananth N Mavinakayanahalli <ananth@in.ibm.com> PR 5231 diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index da72a7ff..ec7fdcb0 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -60,77 +60,77 @@ function _struct_timezone_u:string(uaddr:long) %} %{ -static const int days_in_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; -static void _stp_ctime(time_t t, char *buf, int buflen) -{ - int mon=1, day, hour, min, sec, num, d, year = 1970; - - sec = t % 60; - min = t/60 % 60; - hour = t/(60*60) % 24; - day = t/(24*60*60); - - while(1) { - d = (!(year % 4) && ((year % 100) || !(year % 400))) ? 366 : 365; - if (day >= d) - day -= d; - else - break; - year++; - } - while (mon < 12) { - num = days_in_month[mon-1]; - if (mon == 2 && d == 366) - num++; - if (day >= num) - day -= num; - else - break; - mon++; - } - - snprintf(buf, buflen, "%4d/%02d/%02d-%02d:%02d:%02d", year, mon, day+1, hour, min, sec); - buf[buflen-1] = 0; -} + // Needed for the following four functions + // _struct_utimbuf_actime, _struct_utimbuf_modtime, + // _struct_compat_utimbuf_actime, _struct_compat_utimbuf_modtime + #include <linux/utime.h> %} -function _struct_utimbuf_u:string(uaddr:long) +// Returns the value of the actime field of a utimbuf in user space +// at the given address, or zero on when userspace data is not accessible. +function _struct_utimbuf_actime:long(uaddr:long) %{ /* pure */ - #include <linux/utime.h> struct utimbuf ubuf; - static char abuf[24], mbuf[24]; char *ptr = (char *)(unsigned long)THIS->uaddr; if (ptr == NULL) - strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN); - else { - if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) { - _stp_ctime(ubuf.actime, abuf, 24); - _stp_ctime(ubuf.modtime, mbuf, 24); - snprintf(THIS->__retvalue, MAXSTRINGLEN, "[%s, %s]", abuf, mbuf); - } else - strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN); - } + THIS->__retvalue = 0; + else + if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) + THIS->__retvalue = ubuf.actime; + else + THIS->__retvalue = 0; %} -function _struct_compat_utimbuf_u:string(uaddr:long) +// Returns the value of the modtime field of a utimbuf in user space +// at the given address, or zero on when userspace data is not accessible. +function _struct_utimbuf_modtime:long(uaddr:long) +%{ /* pure */ + struct utimbuf ubuf; + char *ptr = (char *)(unsigned long)THIS->uaddr; + + if (ptr == NULL) + THIS->__retvalue = 0; + else + if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) + THIS->__retvalue = ubuf.modtime; + else + THIS->__retvalue = 0; +%} + +// Returns the value of the actime field of a compat_utimbuf in user space +// at the given address, or zero on when userspace data is not accessible. +function _struct_compat_utimbuf_actime:long(uaddr:long) %{ /* pure */ #ifdef CONFIG_COMPAT - #include <linux/utime.h> struct compat_utimbuf ubuf; - static char abuf[24], mbuf[24]; char *ptr = (char *)(unsigned long)THIS->uaddr; if (ptr == NULL) - strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN); - else { - if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) { - _stp_ctime(ubuf.actime, abuf, 24); - _stp_ctime(ubuf.modtime, mbuf, 24); - snprintf(THIS->__retvalue, MAXSTRINGLEN, "[%s, %s]", abuf, mbuf); - } else - strlcpy (THIS->__retvalue, "UNKNOWN", MAXSTRINGLEN); - } + THIS->__retvalue = 0; + else + if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) + THIS->__retvalue = ubuf.actime; + else + THIS->__retvalue = 0; +#endif +%} + +// Returns the value of the modtime field of a compat_utimbuf in user space +// at the given address, or zero on when userspace data is not accessible. +function _struct_compat_utimbuf_modtime:long(uaddr:long) +%{ /* pure */ +#ifdef CONFIG_COMPAT + struct compat_utimbuf ubuf; + char *ptr = (char *)(unsigned long)THIS->uaddr; + + if (ptr == NULL) + THIS->__retvalue = 0; + else + if(_stp_copy_from_user((char*)&ubuf,ptr,sizeof(ubuf)) == 0) + THIS->__retvalue = ubuf.modtime; + else + THIS->__retvalue = 0; #endif %} diff --git a/tapset/ctime.stp b/tapset/ctime.stp index cd8e5026..96af4d47 100644 --- a/tapset/ctime.stp +++ b/tapset/ctime.stp @@ -4,7 +4,23 @@ * Takes an argument of seconds since the epoch as returned by * gettimeofday_s(). Returns a string of the form * - * "Wed Jun 30 21:49:008 1993" + * "Wed Jun 30 21:49:08 1993" + * + * The string will always be exactly 24 characters. If the time would + * be unreasonable far in the past (before what can be represented + * with a 32 bit offset in seconds from the epoch) the returned string + * will be "a long, long time ago...". If the time would be + * unreasonable far in the future the returned string will be "far far + * in the future..." (both these strings are also 24 characters wide). + * + * Note that the epoch (zero) corresponds to + * + * "Thu Jan 1 00:00:00 1970" + * + * The earliest full date given by ctime, corresponding to epochsecs + * -2147483648 is "Fri Dec 13 20:45:52 1901". The latest full date + * given by ctime, corresponding to epachsecs 2147483647 is + * "Tue Jan 19 03:14:07 2038". * * The abbreviations for the days of the week are ‘Sun’, ‘Mon’, ‘Tue’, * ‘Wed’, ‘Thu’, ‘Fri’, and ‘Sat’. The abbreviations for the months @@ -21,7 +37,7 @@ * tzcode maintained by Arthur David Olson. In newlib, asctime_r.c * doesn't have any author/copyright information. * - * Changes copyright (C) 2006 Red Hat Inc. + * Changes copyright (C) 2006, 2008 Red Hat Inc. */ function ctime:string(epochsecs:long) @@ -70,6 +86,25 @@ function ctime:string(epochsecs:long) int tm_year; /* year */ int tm_wday; /* day of the week */ + // Check that the numer of seconds is "reasonable". + // Otherwise (especially on 64bit machines) we will be spending + // way too much time calculating the correct year, month and + // day. Also we would like the returned string to always be 24 chars. + // So cap to what can be represented normally on a 32bit machine. + int64_t MAX_POS_SECS = 2147483647LL; + int64_t MIN_NEG_SECS = -2147483648LL; + + if (THIS->epochsecs > MAX_POS_SECS) + { + strlcpy(THIS->__retvalue, "far far in the future...", MAXSTRINGLEN); + return; + } + if (THIS->epochsecs < MIN_NEG_SECS) + { + strlcpy(THIS->__retvalue, "a long, long time ago...", MAXSTRINGLEN); + return; + } + lcltime = THIS->epochsecs; days = ((long)lcltime) / SECSPERDAY; diff --git a/tapset/nfs.stp b/tapset/nfs.stp index 87a2f4cc..ba6bde5f 100644 --- a/tapset/nfs.stp +++ b/tapset/nfs.stp @@ -890,7 +890,7 @@ probe nfs.aop.readpage = kernel.function ("nfs_readpage") ?, rsize = __nfs_server_rsize(__inode) name = "nfs.aop.readpage" - argstr = sprintf("%d,%d" , page_index,r_size) + argstr = sprintf("%d,%d" , page_index,rsize) size = 1 units = "pages" diff --git a/tapset/signal.stp b/tapset/signal.stp index ec947eb7..72ba9520 100644 --- a/tapset/signal.stp +++ b/tapset/signal.stp @@ -63,7 +63,7 @@ probe _signal.send.part2 = kernel.function("send_group_sigqueue") { name = "send_group_sigqueue" task = $p - # sinfo = $q->info + sinfo = 0 # $q->info shared = 1 send2queue = 1 } @@ -72,7 +72,7 @@ probe _signal.send.part3 = kernel.function("send_sigqueue") { name = "send_sigqueue" task = $p - # sinfo = $q->info + sinfo = 0 # $q->info shared = 0 send2queue = 1 } diff --git a/tapset/syscalls2.stp b/tapset/syscalls2.stp index 558e89bb..0db50347 100644 --- a/tapset/syscalls2.stp +++ b/tapset/syscalls2.stp @@ -1364,7 +1364,7 @@ probe syscall.semtimedop.return = kernel.function("sys_semtimedop").return ? { probe syscall.compat_sys_semtimedop = kernel.function("compat_sys_semtimedop") ? { name = "compat_sys_semtimedop" semid = $semid - sops_uaddr = tsems + sops_uaddr = $tsems nsops = $nsops timeout_uaddr = $timeout argstr = sprintf("%d, %p, %d, %s", $semid, $tsems, $nsops, @@ -2897,11 +2897,13 @@ probe syscall.ustat.return = # long sys_utime(char __user * filename, struct utimbuf __user * times) probe syscall.utime = kernel.function("sys_utime") ? { name = "utime" - filename_uaddr = $filename - filename = user_string($filename) - buf_uaddr = $times - buf_str = _struct_utimbuf_u($times) - argstr = sprintf("%s, %s", user_string_quoted($filename), buf_str) + filename_uaddr = pointer_arg(1) + filename = user_string_quoted(filename_uaddr) + buf_uaddr = pointer_arg(2) + actime = _struct_utimbuf_actime(buf_uaddr) + modtime = _struct_utimbuf_modtime(buf_uaddr) + argstr = sprintf("%s, [%s, %s]", filename, + ctime(actime), ctime(modtime)) } probe syscall.utime.return = kernel.function("sys_utime").return ? { name = "utime" @@ -2911,11 +2913,13 @@ probe syscall.utime.return = kernel.function("sys_utime").return ? { # long compat_sys_utime(char __user *filename, struct compat_utimbuf __user *t) probe syscall.compat_utime = kernel.function("compat_sys_utime") ? { name = "utime" - filename_uaddr = $filename - filename = user_string($filename) - buf_uaddr = $t - buf_str = _struct_compat_utimbuf_u($t) - argstr = sprintf("%s, %s", user_string_quoted($filename), _struct_compat_utimbuf_u($t)) + filename_uaddr = pointer_arg(1) + filename = user_string_quoted(filename_uaddr) + buf_uaddr = pointer_arg(2) + actime = _struct_compat_utimbuf_actime(buf_uaddr) + modtime = _struct_compat_utimbuf_modtime(buf_uaddr) + argstr = sprintf("%s, [%s, %s]", filename, + ctime(actime), ctime(modtime)) } probe syscall.compat_utime.return = kernel.function("compat_sys_utime").return ? { name = "utime" diff --git a/tapset/vfs.stp b/tapset/vfs.stp index 75b1b279..6073dffc 100644 --- a/tapset/vfs.stp +++ b/tapset/vfs.stp @@ -33,16 +33,10 @@ function __bdevname:string (bdev:long) %{ /* pure */ global __devnames function __find_bdevname:string(dev:long, bdev:long) { -# return "" - - __devname = __devnames[dev] - - if (__devname != null) - return __devname - - __devname = __devnames[dev] = __bdevname(bdev) - - return __devname + if (dev in __devnames) + return __devnames[dev] + else + return __devnames[dev] = __bdevname(bdev) } function ppos_pos:long (ppos:long) %{ /* pure */ diff --git a/tapset/x86_64/syscalls.stp b/tapset/x86_64/syscalls.stp index 418aaf23..c9ab617f 100644 --- a/tapset/x86_64/syscalls.stp +++ b/tapset/x86_64/syscalls.stp @@ -131,7 +131,7 @@ probe syscall.vm86_warning.return = kernel.function("sys32_vm86_warning").return # probe syscall.pipe32 = kernel.function("sys32_pipe") { name = "pipe" - argstr = sprintf("%p", fd) + argstr = sprintf("%p", $fd) } probe syscall.pipe32.return = kernel.function("sys32_pipe").return { name = "pipe" |