summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@cvs.openbsd.org>2016-03-01 16:26:07 +0000
committerChristian Weisgerber <naddy@cvs.openbsd.org>2016-03-01 16:26:07 +0000
commit6b8431091ca21b067ef815a8c4fd98e7cedc9994 (patch)
tree28cc6b8c134843fd2cfc54f54df18da7787815f7 /bin
parent5cda9fc7c70a72ba4557fd403e4ee0dadc7af613 (diff)
drop Linux emulation support; ok sthen@ visa@
Diffstat (limited to 'bin')
-rw-r--r--bin/systrace/Makefile4
-rw-r--r--bin/systrace/linux-translate.c381
-rw-r--r--bin/systrace/linux-translate.h43
-rw-r--r--bin/systrace/linux_socketcall.h196
-rw-r--r--bin/systrace/openbsd-syscalls.c7
-rw-r--r--bin/systrace/register.c69
-rw-r--r--bin/systrace/systrace-translate.c87
-rw-r--r--bin/systrace/systrace.h5
8 files changed, 6 insertions, 786 deletions
diff --git a/bin/systrace/Makefile b/bin/systrace/Makefile
index fe8c1dc0a21..a614d8c68e8 100644
--- a/bin/systrace/Makefile
+++ b/bin/systrace/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.15 2006/07/02 12:34:15 sturm Exp $
+# $OpenBSD: Makefile,v 1.16 2016/03/01 16:26:06 naddy Exp $
PROG= systrace
CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../../sys
@@ -9,7 +9,7 @@ DPADD+= ${LIBEVENT}
LDADD+= -levent
SRCS= cradle.c filter.c intercept-translate.c intercept.c \
- linux-translate.c openbsd-syscalls.c util.c \
+ openbsd-syscalls.c util.c \
policy.c systrace-errno.h systrace-error.c \
systrace-translate.c systrace.c alias.c register.c \
parse.y lex.l
diff --git a/bin/systrace/linux-translate.c b/bin/systrace/linux-translate.c
deleted file mode 100644
index 0c24ba165bc..00000000000
--- a/bin/systrace/linux-translate.c
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Copyright 2002 Marius Aamodt Eriksen <marius@umich.edu>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niels Provos.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/tree.h>
-#include <sys/socket.h>
-#include <stdint.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <pwd.h>
-#include <err.h>
-#include <netdb.h>
-
-#include <compat/linux/linux_socket.h>
-#include <compat/linux/linux_types.h>
-#include <compat/linux/linux_fcntl.h>
-#include "linux_socketcall.h"
-
-#include "intercept.h"
-#include "systrace.h"
-
-extern struct intercept_system intercept;
-
-/* XXX register_t */
-#define ARGSIZE(n) ((n) * sizeof(unsigned long))
-static unsigned char socketcall_argsize[18] = {
- ARGSIZE(0), /* none */
- ARGSIZE(3), /* LINUX_SYS_socket */
- ARGSIZE(3), /* LINUX_SYS_bind */
- ARGSIZE(3), /* LINUX_SYS_connect */
- ARGSIZE(2), /* LINUX_SYS_listen */
- ARGSIZE(3), /* LINUX_SYS_accept */
- ARGSIZE(3), /* LINUX_SYS_getsockname */
- ARGSIZE(3), /* LINUX_SYS_getpeername */
- ARGSIZE(4), /* LINUX_SYS_socketpair */
- ARGSIZE(4), /* LINUX_SYS_send */
- ARGSIZE(4), /* LINUX_SYS_recv */
- ARGSIZE(6), /* LINUX_SYS_sendto */
- ARGSIZE(6), /* LINUX_SYS_recvfrom */
- ARGSIZE(2), /* LINUX_SYS_shutdown */
- ARGSIZE(5), /* LINUX_SYS_setsockopt */
- ARGSIZE(5), /* LINUX_SYS_getsockopt */
- ARGSIZE(3), /* LINUX_SYS_sendmsg */
- ARGSIZE(3) /* LINUX_SYS_recvmsg */
-};
-
-/* ARGSUSED */
-static int
-get_socketcall(struct intercept_translate *trans, int fd, pid_t pid, void *addr)
-{
- int call = (intptr_t)addr;
-
- systrace_switch_alias("linux", "socketcall", "linux",
- linux_socketcall_names[call]);
-
- /* We don't want to print the argument .. */
- trans->trans_valid = 0;
- return (0);
-}
-
-/* ARGSUSED */
-static int
-print_socketcall(char *buf, size_t buflen, struct intercept_translate *tl)
-{
- return (0);
-}
-
-static int
-get_socketcall_args(struct intercept_translate *trans, int fd, pid_t pid,
- void *addr)
-{
- int call = (intptr_t)trans->trans_addr2;
- unsigned long argsize;
-
- if (call != (intptr_t)trans->user) {
- trans->trans_valid = 0;
- return (0);
- }
-
- argsize = socketcall_argsize[call];
-
- if ((trans->trans_data = malloc(argsize)) == NULL)
- return (-1);
-
- if (intercept.io(fd, pid, INTERCEPT_READ, addr,
- trans->trans_data, argsize) == -1) {
- free(trans->trans_data);
- return (-1);
- }
-
- return (0);
-}
-
-static int
-print_socktype(char *buf, size_t buflen, struct intercept_translate *tl)
-{
- char *what = NULL;
- unsigned long *args = tl->trans_data;
- int type = args[1];
-
- switch (type) {
- case SOCK_STREAM:
- what = "SOCK_STREAM";
- break;
- case SOCK_DGRAM:
- what = "SOCK_DGRAM";
- break;
- case SOCK_RAW:
- what = "SOCK_RAW";
- break;
- case SOCK_SEQPACKET:
- what = "SOCK_SEQPACKET";
- break;
- case SOCK_RDM:
- what = "SOCK_RDM";
- break;
- default:
- snprintf(buf, buflen, "SOCK_UNKNOWN(%d)", type);
- break;
- }
-
- if (what != NULL)
- strlcpy(buf, what, buflen);
-
- return (0);
-}
-
-static int
-print_sockdom(char *buf, size_t buflen, struct intercept_translate *tl)
-{
- char *what = NULL;
- unsigned long *args = tl->trans_data;
- int domain = args[0];
-
- switch (domain) {
- case LINUX_AF_UNIX:
- what = "AF_UNIX";
- break;
- case LINUX_AF_INET:
- what = "AF_INET";
- break;
- case LINUX_AF_INET6:
- what = "AF_INET6";
- break;
- default:
- snprintf(buf, buflen, "AF_UNKNOWN(%d)", domain);
- break;
- }
-
- if (what != NULL)
- strlcpy(buf, what, buflen);
-
- return (0);
-}
-
-static int
-get_sockaddr(struct intercept_translate *trans, int fd, pid_t pid,
- void *addr)
-{
- struct sockaddr_storage sa;
- socklen_t len;
- void *sockaddr_addr;
- unsigned long *args;
- int call = (intptr_t)trans->trans_addr2;
-
- if (get_socketcall_args(trans, fd, pid, addr) == -1)
- return (-1);
-
- if (trans->trans_valid == 0)
- return (0);
-
- args = trans->trans_data;
-
- len = call == LINUX_SYS_sendto ? args[5] : args[2];
- sockaddr_addr = (void *)(call == LINUX_SYS_sendto ? args[4] : args[1]);
-
- if (len == 0 || len > sizeof(struct sockaddr_storage))
- return (-1);
-
- if (intercept.io(fd, pid, INTERCEPT_READ, sockaddr_addr,
- (void *)&sa, len) == -1)
- return (-1);
-
- free(trans->trans_data);
- trans->trans_data = malloc(len);
- if (trans->trans_data == NULL)
- return (-1);
- trans->trans_size = len;
- memcpy(trans->trans_data, &sa, len);
-
- return (0);
-}
-
-#ifndef offsetof
-#define offsetof(s, e) ((size_t)&((s *)0)->e)
-#endif
-
-static int
-print_sockaddr(char *buf, size_t buflen, struct intercept_translate *tl)
-{
- char host[NI_MAXHOST];
- char serv[NI_MAXSERV];
- struct linux_sockaddr *linux_sa = tl->trans_data;
- struct sockaddr sa;
- socklen_t len = (socklen_t)tl->trans_size;
-
- /* XXX - Niels */
- tl->trans_size = 0;
-
- buf[0] = '\0';
-
- switch (linux_sa->sa_family) {
- case LINUX_AF_UNIX:
- if (len <= offsetof(struct linux_sockaddr, sa_data))
- return (-1);
- len -= offsetof(struct linux_sockaddr, sa_data);
- if (buflen < len + 1)
- len = buflen - 1;
- memcpy(buf, linux_sa->sa_data, len);
- buf[len] = '\0';
- return (0);
- case LINUX_AF_INET:
- case LINUX_AF_INET6:
- break;
- default:
- snprintf(buf, buflen, "family(%d)", linux_sa->sa_family);
- return (0);
- }
-
- memcpy(&sa.sa_family, &linux_sa->sa_family, sizeof(sa.sa_family));
- memcpy(&sa.sa_data, &linux_sa->sa_data, sizeof(sa.sa_data));
-#ifdef HAVE_SOCKADDR_SA_LEN
- sa.sa_len = len;
-#endif /* HAVE_SOCKADDR_SA_LEN */
- if (getnameinfo(&sa, len,
- host, sizeof(host), serv, sizeof(serv),
- NI_NUMERICHOST | NI_NUMERICSERV)) {
- warn("getnameinfo");
- return (-1);
- }
-
- snprintf(buf, buflen, "inet-[%s]:%s", host, serv);
-
- return (0);
-}
-
-static int
-get_msghdr(struct intercept_translate *trans, int fd, pid_t pid,
- void *addr)
-{
- struct msghdr msg;
- int len = sizeof(struct msghdr);
- unsigned long *args;
-
- if (get_socketcall_args(trans, fd, pid, addr) == -1)
- return (-1);
-
- if (trans->trans_valid == 0)
- return (0);
-
- args = trans->trans_data;
- if (intercept.io(fd, pid, INTERCEPT_READ, (void *)args[1],
- (void *)&msg, len) == -1)
- return (-1);
-
- if (msg.msg_name == NULL) {
- trans->trans_data = NULL;
- trans->trans_size = 0;
- return (0);
- }
-
- trans->trans_size = msg.msg_namelen;
- trans->trans_data = malloc(len);
- if (trans->trans_data == NULL)
- return (-1);
- if (intercept.io(fd, pid, INTERCEPT_READ, msg.msg_name,
- (void *)trans->trans_data, trans->trans_size) == -1)
- return (-1);
-
- return (0);
-}
-
-static int
-print_msghdr(char *buf, size_t buflen, struct intercept_translate *tl)
-{
- int res = 0;
- if (tl->trans_size == 0) {
- snprintf(buf, buflen, "<unknown>");
- } else {
- res = print_sockaddr(buf, buflen, tl);
- /*
- * disable replacement of this argument because it's two levels
- * deep and we cant replace that far.
- */
- tl->trans_size = 0;
-
- /* TODO: make this less of a hack */
- }
-
- return (res);
-}
-
-struct intercept_translate ic_linux_socket_sockdom = {
- "sockdom",
- get_socketcall_args, print_sockdom,
- -1,
- .user = (void *)LINUX_SYS_socket
-};
-
-struct intercept_translate ic_linux_socket_socktype = {
- "socktype",
- get_socketcall_args, print_socktype,
- -1,
- .user = (void *)LINUX_SYS_socket
-};
-
-struct intercept_translate ic_linux_connect_sockaddr = {
- "sockaddr",
- get_sockaddr, print_sockaddr,
- -1,
- .user = (void *)LINUX_SYS_connect
-};
-
-struct intercept_translate ic_linux_bind_sockaddr = {
- "sockaddr",
- get_sockaddr, print_sockaddr,
- -1,
- .user = (void *)LINUX_SYS_bind
-};
-
-struct intercept_translate ic_linux_sendto_sockaddr = {
- "sockaddr",
- get_sockaddr, print_sockaddr,
- -1,
- .user = (void *)LINUX_SYS_sendto
-};
-
-struct intercept_translate ic_linux_sendmsg_sockaddr = {
- "sockaddr",
- get_msghdr, print_msghdr,
- -1,
- .user = (void *)LINUX_SYS_sendmsg
-};
-
-struct intercept_translate ic_linux_socketcall_catchall = {
- "call",
- get_socketcall, print_socketcall,
-};
diff --git a/bin/systrace/linux-translate.h b/bin/systrace/linux-translate.h
deleted file mode 100644
index a65664b850e..00000000000
--- a/bin/systrace/linux-translate.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2002 Marius Aamodt Eriksen <marius@umich.edu>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Niels Provos.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-#ifndef LINUX_TRANSLATE_H
-#define LINUX_TRANSLATE_H
-
-extern struct intercept_translate ic_linux_socket_sockdom;
-extern struct intercept_translate ic_linux_socket_socktype;
-extern struct intercept_translate ic_linux_connect_sockaddr;
-extern struct intercept_translate ic_linux_sendto_sockaddr;
-extern struct intercept_translate ic_linux_sendmsg_sockaddr;
-extern struct intercept_translate ic_linux_socketcall_catchall;
-extern struct intercept_translate ic_linux_bind_sockaddr;
-
-#endif /* LINUX_TRANSLATE_H */
diff --git a/bin/systrace/linux_socketcall.h b/bin/systrace/linux_socketcall.h
deleted file mode 100644
index be5337ee084..00000000000
--- a/bin/systrace/linux_socketcall.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/* $OpenBSD: linux_socketcall.h,v 1.1 2006/07/02 12:34:15 sturm Exp $ */
-/* $NetBSD: linux_socketcall.h,v 1.1 1995/02/28 23:26:05 fvdl Exp $ */
-
-/*
- * Copyright (c) 1995 Frank van der Linden
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project
- * by Frank van der Linden
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _LINUX_SOCKETCALL_H
-#define _LINUX_SOCKETCALL_H
-
-/*
- * Values passed to the Linux socketcall() syscall, determining the actual
- * action to take.
- */
-char *linux_socketcall_names[] = {
- NULL,
-#define LINUX_SYS_socket 1
- "socket",
-#define LINUX_SYS_bind 2
- "bind",
-#define LINUX_SYS_connect 3
- "connect",
-#define LINUX_SYS_listen 4
- "listen",
-#define LINUX_SYS_accept 5
- "accept",
-#define LINUX_SYS_getsockname 6
- "getsockname",
-#define LINUX_SYS_getpeername 7
- "getpeername",
-#define LINUX_SYS_socketpair 8
- "socketpair",
-#define LINUX_SYS_send 9
- "send",
-#define LINUX_SYS_recv 10
- "recv",
-#define LINUX_SYS_sendto 11
- "sendto",
-#define LINUX_SYS_recvfrom 12
- "recvfrom",
-#define LINUX_SYS_shutdown 13
- "shutdown",
-#define LINUX_SYS_setsockopt 14
- "setsockopt",
-#define LINUX_SYS_getsockopt 15
- "getsockopt",
-#define LINUX_SYS_sendmsg 16
- "sendmsg",
-#define LINUX_SYS_recvmsg 17
- "recvmsg" };
-
-/*
- * Structures for the arguments of the different system calls. This looks
- * a little better than copyin() of all values one by one.
- */
-struct linux_socket_args {
- int domain;
- int type;
- int protocol;
-};
-
-struct linux_bind_args {
- int s;
- struct sockaddr *name;
- int namelen;
-};
-
-struct linux_connect_args {
- int s;
- struct sockaddr *name;
- int namelen;
-};
-
-struct linux_listen_args {
- int s;
- int backlog;
-};
-
-struct linux_accept_args {
- int s;
- struct sockaddr *addr;
- int *namelen;
-};
-
-struct linux_getsockname_args {
- int s;
- struct sockaddr *addr;
- int *namelen;
-};
-
-struct linux_getpeername_args {
- int s;
- struct sockaddr *addr;
- int *namelen;
-};
-
-struct linux_socketpair_args {
- int domain;
- int type;
- int protocol;
- int *rsv;
-};
-
-struct linux_send_args {
- int s;
- void *msg;
- int len;
- int flags;
-};
-
-struct linux_recv_args {
- int s;
- void *msg;
- int len;
- int flags;
-};
-
-struct linux_sendto_args {
- int s;
- void *msg;
- int len;
- int flags;
- struct sockaddr *to;
- int tolen;
-};
-
-struct linux_recvfrom_args {
- int s;
- void *buf;
- int len;
- int flags;
- struct sockaddr *from;
- int *fromlen;
-};
-
-struct linux_shutdown_args {
- int s;
- int how;
-};
-
-struct linux_getsockopt_args {
- int s;
- int level;
- int optname;
- void *optval;
- int *optlen;
-};
-
-struct linux_setsockopt_args {
- int s;
- int level;
- int optname;
- void *optval;
- int optlen;
-};
-
-struct linux_sendmsg_args {
- int s;
- struct msghdr *msg;
- int flags;
-};
-
-struct linux_recvmsg_args {
- int s;
- struct msghdr *msg;
- int flags;
-};
-
-#endif /* _LINUX_SOCKETCALL_H */
diff --git a/bin/systrace/openbsd-syscalls.c b/bin/systrace/openbsd-syscalls.c
index 55934b63aa4..1dc71d22e59 100644
--- a/bin/systrace/openbsd-syscalls.c
+++ b/bin/systrace/openbsd-syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openbsd-syscalls.c,v 1.46 2015/12/09 19:36:17 mmcc Exp $ */
+/* $OpenBSD: openbsd-syscalls.c,v 1.47 2016/03/01 16:26:06 naddy Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -32,8 +32,6 @@
#include <sys/syscall.h>
-#include <compat/linux/linux_syscall.h>
-
#define KTRACE
#define PTRACE
#define NFSCLIENT
@@ -42,8 +40,6 @@
#define SYSVMSG
#define SYSVSHM
#include <kern/syscalls.c>
-
-#include <compat/linux/linux_syscalls.c>
#undef KTRACE
#undef PTRACE
#undef NFSCLIENT
@@ -76,7 +72,6 @@ struct emulation {
static struct emulation emulations[] = {
{ "native", syscallnames, SYS_MAXSYSCALL },
- { "linux", linux_syscallnames, LINUX_SYS_MAXSYSCALL },
{ NULL, NULL, 0 }
};
diff --git a/bin/systrace/register.c b/bin/systrace/register.c
index 2a422438fb3..5b18a946f27 100644
--- a/bin/systrace/register.c
+++ b/bin/systrace/register.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: register.c,v 1.26 2015/06/24 03:38:51 guenther Exp $ */
+/* $OpenBSD: register.c,v 1.27 2016/03/01 16:26:06 naddy Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -39,7 +39,6 @@
#include "intercept.h"
#include "systrace.h"
-#include "linux-translate.h"
#define X(x) if ((x) == -1) \
err(1, "%s:%d: intercept failed", __func__, __LINE__)
@@ -269,72 +268,6 @@ systrace_initcb(void)
intercept_register_translation("native", "linkat", 3,
&ic_translate_unlinknameat);
- X(intercept_register_sccb("linux", "open", trans_cb, NULL));
- tl = intercept_register_translink("linux", "open", 0);
- intercept_register_translation("linux", "open", 1, &ic_linux_oflags);
- alias = systrace_new_alias("linux", "open", "linux", "fswrite");
- systrace_alias_add_trans(alias, tl);
-
- X(intercept_register_sccb("linux", "stat", trans_cb, NULL));
- tl = intercept_register_translink("linux", "stat", 0);
- alias = systrace_new_alias("linux", "stat", "linux", "fsread");
- systrace_alias_add_trans(alias, tl);
- X(intercept_register_sccb("linux", "lstat", trans_cb, NULL));
- tl = intercept_register_translink("linux", "lstat", 0);
- alias = systrace_new_alias("linux", "lstat", "linux", "fsread");
- systrace_alias_add_trans(alias, tl);
- X(intercept_register_sccb("linux", "execve", trans_cb, NULL));
- intercept_register_translink("linux", "execve", 0);
- X(intercept_register_sccb("linux", "access", trans_cb, NULL));
- tl = intercept_register_translink("linux", "access", 0);
- alias = systrace_new_alias("linux", "access", "linux", "fsread");
- systrace_alias_add_trans(alias, tl);
- X(intercept_register_sccb("linux", "symlink", trans_cb, NULL));
- intercept_register_transstring("linux", "symlink", 0);
- intercept_register_translink("linux", "symlink", 1);
- X(intercept_register_sccb("linux", "link", trans_cb, NULL));
- intercept_register_translink("linux", "link", 0);
- intercept_register_translink("linux", "link", 1);
- X(intercept_register_sccb("linux", "readlink", trans_cb, NULL));
- tl = intercept_register_translink("linux", "readlink", 0);
- alias = systrace_new_alias("linux", "readlink", "linux", "fsread");
- systrace_alias_add_trans(alias, tl);
- X(intercept_register_sccb("linux", "rename", trans_cb, NULL));
- intercept_register_translink("linux", "rename", 0);
- intercept_register_translink("linux", "rename", 1);
- X(intercept_register_sccb("linux", "mkdir", trans_cb, NULL));
- tl = intercept_register_translink("linux", "mkdir", 0);
- alias = systrace_new_alias("linux", "mkdir", "linux", "fswrite");
- systrace_alias_add_trans(alias, tl);
- X(intercept_register_sccb("linux", "rmdir", trans_cb, NULL));
- tl = intercept_register_translink("linux", "rmdir", 0);
- alias = systrace_new_alias("linux", "rmdir", "linux", "fswrite");
- systrace_alias_add_trans(alias, tl);
- X(intercept_register_sccb("linux", "unlink", trans_cb, NULL));
- tl = intercept_register_translink("linux", "unlink", 0);
- alias = systrace_new_alias("linux", "unlink", "linux", "fswrite");
- systrace_alias_add_trans(alias, tl);
- X(intercept_register_sccb("linux", "chmod", trans_cb, NULL));
- intercept_register_translink("linux", "chmod", 0);
- intercept_register_translation("linux", "chmod", 1, &ic_modeflags);
-
- X(intercept_register_sccb("linux", "socketcall", trans_cb, NULL));
- alias = systrace_new_alias("linux", "socketcall", "linux", "_socketcall");
- tl = intercept_register_translation("linux", "socketcall", 1, &ic_linux_socket_sockdom);
- systrace_alias_add_trans(alias, tl);
- tl = intercept_register_translation("linux", "socketcall", 1, &ic_linux_socket_socktype);
- systrace_alias_add_trans(alias, tl);
- tl = intercept_register_translation("linux", "socketcall", 1, &ic_linux_connect_sockaddr);
- systrace_alias_add_trans(alias, tl);
- tl = intercept_register_translation("linux", "socketcall", 1, &ic_linux_bind_sockaddr);
- systrace_alias_add_trans(alias, tl);
- tl = intercept_register_translation("linux", "socketcall", 0, &ic_linux_socketcall_catchall);
- systrace_alias_add_trans(alias, tl);
-
- X(intercept_register_sccb("linux", "kill", trans_cb, NULL));
- intercept_register_translation("linux", "kill", 0, &ic_pidname);
- intercept_register_translation("linux", "kill", 1, &ic_signame);
-
X(intercept_register_execcb(execres_cb, NULL));
X(intercept_register_pfreecb(policyfree_cb, NULL));
}
diff --git a/bin/systrace/systrace-translate.c b/bin/systrace/systrace-translate.c
index d381a30a539..96cc7a16b10 100644
--- a/bin/systrace/systrace-translate.c
+++ b/bin/systrace/systrace-translate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace-translate.c,v 1.25 2015/01/16 00:19:12 deraadt Exp $ */
+/* $OpenBSD: systrace-translate.c,v 1.26 2016/03/01 16:26:06 naddy Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -46,9 +46,6 @@
#include <pwd.h>
#include <err.h>
-#include "../../sys/compat/linux/linux_types.h"
-#include "../../sys/compat/linux/linux_fcntl.h"
-
#include "intercept.h"
#include "systrace.h"
@@ -58,7 +55,6 @@
} while (0)
static int print_oflags(char *, size_t, struct intercept_translate *);
-static int linux_print_oflags(char *, size_t, struct intercept_translate *);
static int print_modeflags(char *, size_t, struct intercept_translate *);
static int print_number(char *, size_t, struct intercept_translate *);
static int print_uname(char *, size_t, struct intercept_translate *);
@@ -115,49 +111,6 @@ print_oflags(char *buf, size_t buflen, struct intercept_translate *tl)
}
static int
-linux_print_oflags(char *buf, size_t buflen, struct intercept_translate *tl)
-{
- char str[32], *p;
- int flags = (intptr_t)tl->trans_addr;
- int isread = 0;
-
- p = str;
- switch (flags & LINUX_O_ACCMODE) {
- case LINUX_O_RDONLY:
- strlcpy(p, "ro", str + sizeof str - p);
- isread = 1;
- break;
- case LINUX_O_WRONLY:
- strlcpy(p, "wo", str + sizeof str - p);
- break;
- case LINUX_O_RDWR:
- strlcpy(p, "rw", str + sizeof str - p);
- break;
- default:
- strlcpy(p, "--", str + sizeof str - p);
- break;
- }
-
- /* XXX - Open handling of alias */
- if (isread)
- systrace_switch_alias("linux", "open", "linux", "fsread");
- else
- systrace_switch_alias("linux", "open", "linux", "fswrite");
-
- p += 2;
-
- FL(LINUX_O_APPEND, 'a');
- FL(LINUX_O_CREAT, 'c');
- FL(LINUX_O_TRUNC, 't');
-
- *p = '\0';
-
- strlcpy(buf, str, buflen);
-
- return (0);
-}
-
-static int
print_modeflags(char *buf, size_t buflen, struct intercept_translate *tl)
{
int mode = (intptr_t)tl->trans_addr;
@@ -353,11 +306,9 @@ print_signame(char *buf, size_t buflen, struct intercept_translate *tl)
case SIGWINCH:
name = "SIGWINCH";
break;
-#ifndef __linux__
case SIGINFO:
name = "SIGINFO";
break;
-#endif /* !__linux__ */
case SIGUSR1:
name = "SIGUSR1";
break;
@@ -422,32 +373,6 @@ print_fcntlcmd(char *buf, size_t buflen, struct intercept_translate *tl)
return (0);
}
-struct linux_i386_mmap_arg_struct {
- unsigned long addr;
- unsigned long len;
- unsigned long prot;
- unsigned long flags;
- unsigned long fd;
- unsigned long offset;
-};
-
-static int
-get_linux_memprot(struct intercept_translate *trans, int fd, pid_t pid,
- void *addr)
-{
- struct linux_i386_mmap_arg_struct arg;
- size_t len = sizeof(arg);
- extern struct intercept_system intercept;
-
- if (intercept.io(fd, pid, INTERCEPT_READ, addr,
- (void *)&arg, len) == -1)
- return (-1);
-
- trans->trans_addr = (void *)arg.prot;
-
- return (0);
-}
-
static int
print_memprot(char *buf, size_t buflen, struct intercept_translate *tl)
{
@@ -620,11 +545,6 @@ struct intercept_translate ic_oflags = {
NULL, print_oflags,
};
-struct intercept_translate ic_linux_oflags = {
- "oflags",
- NULL, linux_print_oflags,
-};
-
struct intercept_translate ic_modeflags = {
"mode",
NULL, print_modeflags,
@@ -680,11 +600,6 @@ struct intercept_translate ic_memprot = {
NULL, print_memprot,
};
-struct intercept_translate ic_linux_memprot = {
- "prot",
- get_linux_memprot, print_memprot,
-};
-
struct intercept_translate ic_fileflags = {
"flags",
NULL, print_fileflags,
diff --git a/bin/systrace/systrace.h b/bin/systrace/systrace.h
index 2f9b9d75da0..9ec8952c61e 100644
--- a/bin/systrace/systrace.h
+++ b/bin/systrace/systrace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace.h,v 1.27 2006/07/02 12:34:15 sturm Exp $ */
+/* $OpenBSD: systrace.h,v 1.28 2016/03/01 16:26:06 naddy Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -243,11 +243,8 @@ extern struct intercept_translate ic_pidname;
extern struct intercept_translate ic_signame;
extern struct intercept_translate ic_fcntlcmd;
extern struct intercept_translate ic_memprot;
-extern struct intercept_translate ic_linux_memprot;
extern struct intercept_translate ic_fileflags;
-extern struct intercept_translate ic_linux_oflags;
-
int requestor_start(char *, int);
#endif /* _SYSTRACE_H_ */