Opened 4 years ago

Last modified 2 years ago

#17391 reopened defect

(Sandbox) Caught a bad syscall attempt (syscall time) (__NR_time not defined?)

Reported by: TORques Owned by:
Priority: Medium Milestone: Tor: unspecified
Component: Core Tor/Tor Version: Tor: unspecified
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I tried to run a Tor v0.2.8.0-alpha-dev mid relay in Linux 3.16.0-4-amd64 with the torrc option "Sandbox 1", but I only got this:

[warn] This version of Tor was built without support for sandboxing. To build with support for sandboxing on Linux, you must have libseccomp and its necessary header files (e.g. seccomp.h).

Seccomp is a feature of the Linux kernel that is enabled in (most) contemporary Linux distributions. It restricts a thread to a small number of system calls: read(), write(), exit() and sigreturn() - If the thread calls any other system call, the entire process gets terminated. now Seccomp is deprecated.

Starting with Linux 3.16, the new seccomp.2 a.k.a. Seccomp-BPF has a Berkeley Packet Filter (BPF) with optional allowed syscalls other than the above mentioned four syscalls. At the developers choice and according with the application specific tasks.

http://man7.org/linux/man-pages/man2/seccomp.2.html

  1. I want to know if the tor code is updated and ready for using the Seccomp-BPF to make the "Sandbox 1" operational and what exactly prerequisites and additional compiling parameters are needed to compile tor with the support for sandboxing.

Thank you.

Child Tickets

Change History (6)

comment:1 Changed 4 years ago by nickm

Seccomp support is implemented, and works fine for me. You might need to have libseccomp installed on your system, along with its development headers? The message you are seeing is the one that Tor delivers on Linux systems when it can't find libseccomp or its headers.

comment:2 Changed 4 years ago by nickm

Resolution: worksforme
Status: newclosed

comment:3 Changed 4 years ago by TORques

Thanks nickm, i compiled libseccomp and I have

libseccomp.a
libseccomp.la
libseccomp.so
libseccomp.so.0
libseccomp.so.0.0.0

in /usr/local/lib/
and

seccomp.h

in /usr/local/include/

Then I rebuilt tor http://paste.ubuntu.com/12882052/ with all required Seccomp libs and h files and I got this error:

Oct 20 22:09:34.000 [notice] Tor 0.2.8.0-alpha-dev (git-d939a83f5bc8ccf3) opening log file.
Oct 20 22:09:34.291 [notice] Tor v0.2.8.0-alpha-dev (git-d939a83f5bc8ccf3) running on Linux with Libevent 2.0.22-stable, OpenSSL 1.0.2d and Zlib 1.2.8.
Oct 20 22:09:34.291 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Oct 20 22:09:34.291 [notice] This version is not a stable Tor release. Expect more bugs than usual.
Oct 20 22:09:34.291 [notice] Read configuration file "/usr/local/etc/tor/torrc".
Oct 20 22:09:34.293 [notice] Based on detected system memory, MaxMemInQueues is set to 2904 MB. You can override this by setting MaxMemInQueues by hand.
Oct 20 22:09:34.293 [notice] Opening Socks listener on 127.0.0.1:9050
Oct 20 22:09:34.293 [notice] Opening Control listener on 127.0.0.1:9051
Oct 20 22:09:34.293 [notice] Opening OR listener on 0.0.0.0:9001
Oct 20 22:09:34.293 [notice] Opening Directory listener on 0.0.0.0:9030
Oct 20 22:09:34.000 [notice] Not disabling debugger attaching for unprivileged users.
Oct 20 22:09:34.000 [notice] Parsing GEOIP IPv4 file /usr/local/etc/tor/geoip.
Oct 20 22:09:34.000 [notice] Parsing GEOIP IPv6 file /usr/local/etc/tor/geoip6.
Oct 20 22:09:34.000 [notice] Configured to measure statistics. Look for the *-stats files that will first be written to the data directory in 24 hours from now.
============================================================ T= 1445368174
(Sandbox) Caught a bad syscall attempt (syscall time)
[0x56e536]
[0x843db7]
[0x843db7]
[0x777af4]
[0x777930]
[0x7798f7]
[0x6beea7]
[0x572a1a]
[0x572304]
[0x44dc7d]
[0x44ecf3]
[0x40686c]
[0x40acc3]
[0x4023cd]
[0x7f1760]
[0x4022a7]

I have no idea what is it. Any suggestion?

Last edited 4 years ago by TORques (previous) (diff)

comment:4 Changed 4 years ago by TORques

Resolution: worksforme
Status: closedreopened
Summary: torrc option "Sandbox 1" doesn't work in Tor v0.2.8.0-alpha-dev(Sandbox) Caught a bad syscall attempt (syscall time)
Type: enhancementdefect

comment:5 Changed 4 years ago by TORques

same thing using the Tor 0.2.7.4-rc (git-89a9d8c8d75dac08)
http://paste.ubuntu.com/12892295/

Oct 22 08:37:06.000 [notice] Tor 0.2.7.4-rc (git-89a9d8c8d75dac08) opening log file.
Oct 22 08:37:06.857 [notice] Tor v0.2.7.4-rc (git-89a9d8c8d75dac08) running on Linux with Libevent 2.0.22-stable, OpenSSL 1.0.2d and Zlib 1.2.8.
Oct 22 08:37:06.857 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Oct 22 08:37:06.857 [notice] Read configuration file "/usr/local/etc/tor/torrc".
Oct 22 08:37:06.860 [notice] Based on detected system memory, MaxMemInQueues is set to 2904 MB. You can override this by setting MaxMemInQueues by hand.
Oct 22 08:37:06.861 [notice] Opening Socks listener on 127.0.0.1:9050
Oct 22 08:37:06.861 [notice] Opening Control listener on 127.0.0.1:9051
Oct 22 08:37:06.861 [notice] Opening OR listener on 0.0.0.0:9001
Oct 22 08:37:06.861 [notice] Opening Directory listener on 0.0.0.0:9030
Oct 22 08:37:06.000 [warn] Your log may contain sensitive information - you're logging more than "notice". Don't log unless it serves an important reason. Overwrite the log afterwards.
Oct 22 08:37:06.000 [notice] Not disabling debugger attaching for unprivileged users.
Oct 22 08:37:06.000 [notice] Parsing GEOIP IPv4 file /usr/local/etc/tor/geoip.
Oct 22 08:37:06.000 [notice] Parsing GEOIP IPv6 file /usr/local/etc/tor/geoip6.
Oct 22 08:37:06.000 [notice] Configured to measure statistics. Look for the *-stats files that will first be written to the data directory in 24 hours from now.

============================================================ T= 1445492226
(Sandbox) Caught a bad syscall attempt (syscall time)
[0x56dabb]
[0x8433b7]
[0x8433b7]
[0x7770f4]
[0x776f30]
[0x778ef7]
[0x6be467]
[0x571f9f]
[0x571889]
[0x44d690]
[0x44e706]
[0x40684f]
[0x40aca6]
[0x4023cd]
[0x7f0d60]
[0x4022a7]

UPDATE: after some research I found tor was halted by seccomp/Sandbox with the log message: (Sandbox) Caught a bad syscall attempt (syscall time because the application /tor-0.2.7.4-rc/src/common/sandbox.c think __NR_time is not defined.

#ifdef __NR_time
  return seccomp_rule_add_1(ctx, SCMP_ACT_ALLOW, SCMP_SYS(time),
	SCMP_CMP(0, SCMP_CMP_EQ, 0));
#else
	return 0;
#endif

But I found in my linux that __NR_time is defined in "/usr/src/linux-headers-3.16.0-4-common/include/uapi/asm-generic/unistd.h"

#define __NR_time 1062
Last edited 4 years ago by TORques (previous) (diff)

comment:6 Changed 2 years ago by nickm

Summary: (Sandbox) Caught a bad syscall attempt (syscall time)(Sandbox) Caught a bad syscall attempt (syscall time) (__NR_time not defined?)
Note: See TracTickets for help on using tickets.