Debian bug report logs - #1539 , boring messages ----------------------------------------------------------------------- Message sent to debian-devel@pixar.com: Subject: Bug#1539: strace source package does not compile Reply-To: Ian Jackson , debian-bugs@pixar.com Resent-From: Ian Jackson Resent-To: debian-devel@pixar.com Resent-Date: Tue, 03 Oct 1995 19:48:02 GMT Resent-Message-ID: Resent-Sender: iwj10@cus.cam.ac.uk X-Debian-PR-Package: strace X-Debian-PR-Keywords: Received: via spool for debian-bugs; Tue, 03 Oct 1995 19:48:02 GMT Received: with rfc822 via encapsulated-mail; Tue, 03 Oct 1995 19:35:03 GMT Received: from pixar.com by mongo.pixar.com with smtp (Smail3.1.28.1 #15) id m0t0D65-000Aw3C; Tue, 3 Oct 95 12:33 PDT Received: from bootes.cus.cam.ac.uk by pixar.com with SMTP id AA09043 (5.67b/IDA-1.5 for debian-bugs-pipe@mongo.pixar.com); Tue, 3 Oct 1995 12:33:27 -0700 Received: by bootes.cus.cam.ac.uk (Smail-3.1.29.0 #36) id m0t0D5J-000BzQC; Tue, 3 Oct 95 20:33 BST Received: by chiark id (Debian /\oo/\ Smail3.1.29.1 #29.33); Tue, 3 Oct 95 20:31 BST Message-Id: Date: Tue, 3 Oct 95 20:31 BST From: Ian Jackson To: Debian bugs submission address Package: strace Version: 3.0-1 I needed to recompile strace so that it didn't use /proc//mem to get the arguments to system calls. This is because /proc//mem is only available to root on my system, since having it available to anyone else is a security hole in even the most recent development kernels. (See the thread about my /proc paranoia patch on linux-kernel.) "Fine", I thought, "I'll just reconfigure it to use some variant of ptrace to get at the data". That bit was easy - I just copied the `old-style SunOS' code, which looked quite plausible and compiled OK. However, most of the rest of the strace source package is a screaming horror. It uses #define __KERNEL__ in several places, obviously to get at constants that probably ought to be in the general namespace. It uses in its own namespace sys_ for many system calls , which clashes with the stuff you get when you say __KERNEL__. It doesn't appear to be compatible at all with my current kernel, which is 1.2.13. Below is a diff of the changes I made to the strace source tree before giving up. Note that I'm not sure whether my portability changes were going in the right direction. I think my ptrace fix was, though. Could the strace package maintaner and the program's author please get together and produce a version that (a) compiles and (b) works on secure systems. (It is possible that the procfs will be made secure in a forthcoming kernel version in a way that doesn't make it - including /proc//mem - a gigantic security hole. Therefore, it may be a good idea to have strace try to open /proc//mem. However, since there is an alternative strategy available it should use it if it discovers - at run time - that /proc//mem doesn't work.) Ian. Only in /usr/local/src/strace-3.0: Makefile Only in /usr/local/src/strace-3.0: config.h Only in /usr/local/src/strace-3.0: config.status Only in /usr/local/src/strace-3.0: desc.o Only in /usr/local/src/strace-3.0: file.o Only in /usr/local/src/strace-3.0: io.o diff -ru /usr/local/src/strace-3.0/ipc.c /u/ian/download/strace-3.0/ipc.c --- /usr/local/src/strace-3.0/ipc.c Tue Oct 3 20:20:09 1995 +++ /u/ian/download/strace-3.0/ipc.c Sat Mar 12 23:11:45 1994 @@ -38,33 +38,10 @@ #ifdef LINUX #define __KERNEL__ -#include -#define sys_semop x_sys_semop -#define sys_semget x_sys_semget -#define sys_semctl x_sys_semctl -#define sys_shmget x_sys_shmget -#define sys_shmctl x_sys_shmctl -#define sys_shmat x_sys_shmat -#define sys_shmdt x_sys_shmdt -#define sys_msgget x_sys_msgget -#define sys_msgctl x_sys_msgctl -#define sys_msgsnd x_sys_msgsnd -#define sys_msgrcv x_sys_msgrcv #include -#include #include +#include #include -#undef sys_msgget -#undef sys_msgctl -#undef sys_msgsnd -#undef sys_msgrcv -#undef sys_semop -#undef sys_semget -#undef sys_semctl -#undef sys_shmget -#undef sys_shmctl -#undef sys_shmat -#undef sys_shmdt #undef __KERNEL__ static struct xlat msgctl_flags[] = { Only in /usr/local/src/strace-3.0: ipc.c~ Only in /usr/local/src/strace-3.0: ipc.o Only in /usr/local/src/strace-3.0/linux: Makefile Only in /usr/local/src/strace-3.0/linux: errnoent.h Only in /usr/local/src/strace-3.0/linux: ioctlent.raw Only in /usr/local/src/strace-3.0: strace.o diff -ru /usr/local/src/strace-3.0/syscall.c /u/ian/download/strace-3.0/syscall.c --- /usr/local/src/strace-3.0/syscall.c Tue Oct 3 20:07:50 1995 +++ /u/ian/download/strace-3.0/syscall.c Sat Mar 12 23:11:57 1994 @@ -475,7 +475,6 @@ tprintf("= %#x", tcp->u_rval); } else if (!(sys_res & RVAL_NONE) && u_error) { -#ifdef THIS_IS_NOT_IN_LINUX_1_2_13 #ifdef LINUX switch (u_error) { case ERESTARTSYS: @@ -489,7 +488,6 @@ break; default: #endif /* LINUX */ -#endif /* THIS_IS_NOT_IN_LINUX_1_2_13 */ tprintf("= -1 "); if (u_error < nerrnos && u_error < sys_nerr) tprintf("%s (%s)", errnoent[u_error], @@ -502,12 +500,10 @@ sys_errlist[u_error]); else tprintf("E??? (errno %d)", u_error); -#ifdef THIS_IS_NOT_IN_LINUX_1_2_13 #ifdef LINUX break; } #endif /* LINUX */ -#endif /* THIS_IS_NOT_IN_LINUX_1_2_13 */ } else { if (sys_res & RVAL_NONE) Only in /usr/local/src/strace-3.0: syscall.c~ Only in /usr/local/src/strace-3.0: syscall.o diff -ru /usr/local/src/strace-3.0/util.c /u/ian/download/strace-3.0/util.c --- /usr/local/src/strace-3.0/util.c Tue Oct 3 20:01:04 1995 +++ /u/ian/download/strace-3.0/util.c Mon Mar 21 05:45:46 1994 @@ -474,30 +474,6 @@ { #ifdef LINUX -#define LINUXPARANOIDPROC -#ifdef LINUXPARANOIDPROC -/* This bit of code copied from the SunOS4 oldway version */ - int pid = tcp->pid; - int n, m; - union { - int val; - char x[4]; - } u; - - if (addr & 3) { - /* addr not a multiple of 4 */ - n = addr - (addr & -4); /* residue */ - addr &= -4; /* residue */ - u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0); - memcpy(laddr, &u.x[n], m = MIN(4 - n, len)); - addr += 4, laddr += m, len -= m; - } - while (len) { - u.val = ptrace(PTRACE_PEEKDATA, pid, (char *) addr, 0); - memcpy(laddr, u.x, m = MIN(4, len)); - addr += 4, laddr += m, len -= m; - } -#else /* !LINUXPARANOIDPROC */ if (tcp->pfd == -2) return -1; if (tcp->pfd == -1) { @@ -513,7 +489,6 @@ lseek(tcp->pfd, addr, 0); if (read(tcp->pfd, laddr, len) == -1) return -1; -#endif /* !LINUXPARANOIDPROC */ #endif /* LINUX */ #ifdef SUNOS4 Only in /usr/local/src/strace-3.0: util.c~ Only in /usr/local/src/strace-3.0: util.o Only in /usr/local/src/strace-3.0: version.o ----------------------------------------------------------------------- Message sent: From: iwj10@thor.cam.ac.uk (Ian Jackson) To: Ian Jackson Subject: Bug#1539: Acknowledgement (was: strace source package does not compile) In-Reply-To: References: Thank you for the problem report you have sent regarding Debian GNU/Linux. This is an automatically generated reply, to let you know your message has been received. It is being forwarded to the developers' mailing list for their attention; they will reply in due course. If you wish to submit further information on your problem, please send it to debian-bugs@pixar.com, but please ensure that the Subject line of your message starts with "Bug#1539" or "Re: Bug#1539" so that we can identify it as relating to the same problem. Please do not reply to the address at the top of this message, unless you wish to report a problem with the bug-tracking system. Ian Jackson (maintainer, debian-bugs) ----------------------------------------------------------------------- Ian Jackson / iwj10@thor.cam.ac.uk , with the debian-bugs tracking mechanism This page last modified 07:43:01 GMT Wed 01 Nov