Debian bug report logs - #1539
strace source package does not compile
Package: strace; Reported by: Ian Jackson <iwj10@cus.cam.ac.uk>; 28 days old.
Message received at debian-bugs:
From cus.cam.ac.uk!iwj10 Tue Oct 3 12:33:49 1995
Return-Path: <iwj10@cus.cam.ac.uk>
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 <m0t0D4B-0002Z2Z@chiark.al.cl.cam.ac.uk>
(Debian /\oo/\ Smail3.1.29.1 #29.33); Tue, 3 Oct 95 20:31 BST
Message-Id: <m0t0D4B-0002Z2Z@chiark.al.cl.cam.ac.uk>
Date: Tue, 3 Oct 95 20:31 BST
From: Ian Jackson <iwj10@cus.cam.ac.uk>
To: Debian bugs submission address <debian-bugs@pixar.com>
Subject: strace source package does not compile
Package: strace
Version: 3.0-1
I needed to recompile strace so that it didn't use /proc/<pid>/mem to
get the arguments to system calls. This is because /proc/<pid>/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_<foo> for many system calls <foo>,
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/<pid>/mem - a gigantic security hole. Therefore, it may be a
good idea to have strace try to open /proc/<pid>/mem. However, since
there is an alternative strategy available it should use it if it
discovers - at run time - that /proc/<pid>/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 <linux/linkage.h>
-#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 <sys/ipc.h>
-#include <sys/msg.h>
#include <sys/sem.h>
+#include <sys/msg.h>
#include <sys/shm.h>
-#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
Acknowledgement sent to Ian Jackson <iwj10@cus.cam.ac.uk>
:
New bug report received and forwarded.
Full text available.
Report forwarded to debian-devel@pixar.com
:
Bug#1539
; Package strace
.
Full text available.
Ian Jackson /
iwj10@thor.cam.ac.uk,
with the debian-bugs tracking mechanism