From axp-list-request@redhat.com Thu Sep 24 21:33:23 1998 Received: from adler.unix-ag.uni-siegen.de (adler.unix-ag.uni-siegen.de [141.99.42.52]) by vmax.unix-ag.uni-siegen.de (Spoolhost) with ESMTP id VAA20828 for ; Thu, 24 Sep 1998 21:33:16 +0200 Received: from mail2.redhat.com (mail2.redhat.com [199.183.24.247]) by adler.unix-ag.uni-siegen.de (Mailhost) with SMTP id VAA30065 for ; Thu, 24 Sep 1998 21:33:13 +0200 Received: (qmail 29374 invoked by uid 501); 24 Sep 1998 19:22:07 -0000 Resent-Date: 24 Sep 1998 19:22:07 -0000 Resent-Cc: recipient list not shown: ; MBOX-Line: From axp-list-request@redhat.com Thu Sep 24 15:22:07 1998 Message-ID: <19980924211047.32722@alpha.franken.de> Date: Thu, 24 Sep 1998 21:10:47 +0200 From: Thomas Bogendoerfer To: Richard Black Cc: axp-list@redhat.com, bugs@redhat.com Subject: Re: Another bug in strace-3.1 References: <19980922013531.28943@alpha.franken.de> <9809231748.AA00702@bathurst> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.85 In-Reply-To: <9809231748.AA00702@bathurst>; from Richard Black on Wed, Sep 23, 1998 at 06:48:19PM +0100 Resent-Message-ID: <"KdGFz2.0.gA7.Vlf2s"@mail2.redhat.com> Resent-From: axp-list@redhat.com Reply-To: axp-list@redhat.com X-Mailing-List: archive/latest/822 X-Loop: axp-list@redhat.com Precedence: list Resent-Sender: axp-list-request@redhat.com X-URL: http://www.redhat.com Status: RO On Wed, Sep 23, 1998 at 06:48:19PM +0100, Richard Black wrote: > Many thanks to Thomas for his patches, though I have looked on ftp.redhat.com > and can only find strace-3.1-5. this sucks. strace-3.1-7 is on my PowerTools CD, but I couldn't find it on ftp.redhat.com either. There are more newer SRPMS on the PowerTools CD, which are _not_ on ftp.redhat.com:-( > Here is another problem -- the fstat (and related) calls appear to report > something wrong i.e. neither the contents of the stat buffer before the call, > nor the contents after the call. This happens on *both* intel and alpha. that's a mismatch between kernel structures and glibc structures. Below is a fix this problem. I've uploaded a SRPM, a Intel RPM and an Alpha RPM of the fixed strace. You can find them in ftp://ftp.franken.de/pub/people/tsbogend/strace/strace-3.1-9.*.rpm Thomas. diff -ru strace-3.1-orig/file.c strace-3.1/file.c --- strace-3.1-orig/file.c Thu Sep 24 12:15:39 1998 +++ strace-3.1/file.c Thu Sep 24 20:54:43 1998 @@ -413,8 +413,9 @@ } #endif -#ifdef LINUXSPARC +#ifdef LINUX /* Ugly, bug GLIBC makes this necessary. */ +#ifdef LINUXSPARC struct kernel_stat { unsigned short int st_dev; @@ -437,13 +438,59 @@ unsigned long int __unused5; }; #endif +#ifdef ALPHA +struct kernel_stat +{ + unsigned int st_dev; + unsigned int st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_rdev; + long st_size; + unsigned long st_atime; + unsigned long st_mtime; + unsigned long st_ctime; + unsigned int st_blksize; + int st_blocks; + unsigned int st_flags; + unsigned int st_gen; +}; +#endif +#ifdef I386 +struct kernel_stat +{ + unsigned short st_dev; + unsigned short __pad1; + unsigned long st_ino; + unsigned short st_mode; + unsigned short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned short st_rdev; + unsigned short __pad2; + unsigned long st_size; + unsigned long st_blksize; + unsigned long st_blocks; + unsigned long st_atime; + unsigned long __unused1; + unsigned long st_mtime; + unsigned long __unused2; + unsigned long st_ctime; + unsigned long __unused3; + unsigned long __unused4; + unsigned long __unused5; +}; +#endif +#endif static void printstat(tcp, addr) struct tcb *tcp; -int addr; +long addr; { -#ifdef LINUXSPARC +#ifdef LINUX struct kernel_stat statbuf; #else struct stat statbuf; @@ -460,7 +506,7 @@ return; } if (syserror(tcp) || !verbose(tcp)) { - tprintf("%#x", addr); + tprintf("%#lx", addr); return; } if (umove(tcp, addr, &statbuf) < 0) { diff -ru strace-3.1-orig/linux/alpha/syscallent.h strace-3.1/linux/alpha/syscallent.h --- strace-3.1-orig/linux/alpha/syscallent.h Thu Sep 24 12:15:39 1998 +++ strace-3.1/linux/alpha/syscallent.h Thu Sep 24 12:21:35 1998 @@ -119,8 +119,8 @@ { 2, 0, sys_sethostname, "sethostname" }, /* 88 */ { 0, 0, sys_getdtablesize, "getdtablesize" }, /* 89 */ { 2, 0, sys_dup2, "dup2" }, /* 90 */ - { 2, 0, sys_fstat, "fstat" }, /* 91 */ - { 3, 0, sys_fcntl, "fcntl" }, /* 92 */ + { 2, TF, sys_fstat, "fstat" }, /* 91 */ + { 3, TF, sys_fcntl, "fcntl" }, /* 92 */ { 5, 0, sys_select, "select" }, /* 93 */ { 5, 0, printargs, "SYS_94" }, /* 94 */ { 1, 0, sys_fsync, "fsync" }, /* 95 */ -- See, you not only have to be a good coder to create a system like Linux, you have to be a sneaky bastard too ;-) [Linus Torvalds in <4rikft$7g5@linux.cs.Helsinki.FI>] -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com