7

i need to torify (using torsocks) a python deamon app.
tested on macos everything works fine, on linux i have this error:

1507484799 WARNING torsocks[9]: [syscall] Unsupported syscall number 217. Denying the call (in tsocks_syscall() at syscall.c:488)
1507484800 ERROR torsocks[6]: Unable to resolve. Status reply: 4 (in socks5_recv_resolve_ptr_reply() at socks5.c:829)
Segmentation fault

what should i investigate?

robert laing
  • 1,331
  • 2
  • 12
  • 19

1 Answers1

6

Update:

My patch was accepted into the Torsocks source code. If you are getting an error for unsupported syscall 217, get the newest Torsocks code: https://gitweb.torproject.org/torsocks.git.

If you are getting an error for a different unsupported syscall, please make a ticket on the bugtracker: https://trac.torproject.org/projects/tor/newticket


A patch was recently developed to make torsocks support exactly this syscall (217: getdents64). The patch hasn't been accepted into the main build yet but you can easily build it yourself. Just clone this git repo: https://github.com/seisvelas/torsocks and follow the build instructions.

The patch should (hopefully) be a part of official torsocks very soon. You can follow the bug report on the tracker here: https://trac.torproject.org/projects/tor/ticket/28861

If you're wondering why this happens, it's because torsocks has a whitelist of which syscalls are allowed. Version 3 of torsocks hopefully should address this problem by using seccomp/pledge but is currently very early in development. In the meantime, syscalls that don't represent security issues can be manually added to the whitelist. Since getdents and getdents64 (the latter being the syscall that gave OP his issue) seem unproblematic to me I developed the linked patch and am currently awaiting its acceptance into the main torsocks codebase.

Alex V
  • 3,416
  • 2
  • 33
  • 52
  • 3
    I realize this question is pretty old but since people still run into this issue I thought it might be helpful to have a good explanation here of why this happens and what people can do about it in the meantime. – Alex V Dec 20 '18 at 01:35
  • I installed `torsocks` via the git repo successfully but it still runs into the same `217` error. do I have to purge an old installation (that probably came with `tor`)? – bomben Sep 07 '20 at 05:52
  • My bad. It was installed in `/usr/local/bin/torsocks` whereas the original `/usr/bin/torsocks` that came with `tor` was still linked. – bomben Sep 07 '20 at 05:59
  • I get `1599458451 PERROR torsocks[5647]: socks5 libc connect: Connection refused (in socks5_connect() at socks5.c:202) ERROR: Unable to download webpage: (caused by URLError(gaierror(-4, 'Non-recoverable failure in name resolution'),))` after running it with `torsocks youtube-dl`. – bomben Sep 07 '20 at 06:02
  • Well, I got the error because I had `tor` removed before. After installing it again it connects. But it's still not working as espected regarding certain aspects which I will not discuss on SO. :) – bomben Sep 07 '20 at 06:07
  • You don't need Torsocks for youtube-dl, youtube-dl itself has an option to connect via a socks5 proxy. https://github.com/ytdl-org/youtube-dl/tree/c3bcd206eb031de30179c88ac7acd806a477ceae#network-options – Alex V Sep 08 '20 at 15:33
  • See also https://gitlab.torproject.org/tpo/core/torsocks/-/issues/30658 for syscalls 292, 293 and 332 – Linas Jan 26 '21 at 05:12