% torsocks mutt
1544962729 WARNING torsocks[21365]: [syscall] Unsupported syscall number 217. Denying the call (in tsocks_syscall() at syscall.c:568)
1544962729 WARNING torsocks[21367]: [syscall] Unsupported syscall number 217. Denying the call (in tsocks_syscall() at syscall.c:568)
1544962729 WARNING torsocks[21369]: [syscall] Unsupported syscall number 217. Denying the call (in tsocks_syscall() at syscall.c:568)
1544962729 WARNING torsocks[21371]: [syscall] Unsupported syscall number 217. Denying the call (in tsocks_syscall() at syscall.c:568)
1544962729 WARNING torsocks[21373]: [syscall] Unsupported syscall number 217. Denying the call (in tsocks_syscall() at syscall.c:568)
When I compiled that getdents example code and attempted to run it through standard torsocks this happened:
hc01@HC01:~$ /usr/bin/torsocks ./a.out [Dec 19 16:31:02] WARNING torsocks[16567]: [syscall] Unsupported syscall number 78.Denying the call (in tsocks_syscall() at syscall.c:465)getdents: Function not implemented
When I modified the code to use getdents64, I received the same error from torsocks. With my patch it ran properly. I'm going to bother David Goulet and set this ticket to 'needs review' to see if my patch is safe and can be accepted upstream.
As a side note for why I think this merits whitelisting (unless there's a security issue with torsocks enabling getdents that I'm not aware of): A quick Google of the error msg plus the getdents and getdents64 syscall numbers reveals that a lot of people complain about applications failing bc of lack of getdents support in torsocks.
Pretty lengthy threads can be found on a number of forums in which people unsuccessfully guess at why torsocks fails on some system call, to the point where it seems prudent that we amend the error message to include a link to some torsocks documentation explaining the nature of the whitelist system. Most forum threads I found re the error message came to incorrect conclusions about the cause of the error. But for now, considering getdents/getdents64 seem to be a very major cause of application incompatibility I think it's a great candidate for inclusion in the whitelist.
Hi! I get the following error. Did you possibly miss to commit a header file?
make[2]: Entering directory '/home/user/torsocks-seisvelas/src/lib' CC syscall.lo syscall.c: In function ‘handle_getdents’: syscall.c:453:29: error: ‘TSOCKS_NR_GETDENTS’ undeclared (first use in this function) return tsocks_libc_syscall(TSOCKS_NR_GETDENTS, fd, dirp, count); ^~~~~~~~~~~~~~~~~~ syscall.c:453:29: note: each undeclared identifier is reported only once for each function it appears insyscall.c: In function ‘handle_getdents64’:syscall.c:468:29: error: ‘TSOCKS_NR_GETDENTS64’ undeclared (first use in this function) return tsocks_libc_syscall(TSOCKS_NR_GETDENTS64, fd, dirp, count); ^~~~~~~~~~~~~~~~~~~~syscall.c: In function ‘tsocks_syscall’:syscall.c:592:7: error: ‘TSOCKS_NR_GETDENTS’ undeclared (first use in this function) case TSOCKS_NR_GETDENTS: ^~~~~~~~~~~~~~~~~~syscall.c:595:7: error: ‘TSOCKS_NR_GETDENTS64’ undeclared (first use in this function) case TSOCKS_NR_GETDENTS64: ^~~~~~~~~~~~~~~~~~~~Makefile:470: recipe for target 'syscall.lo' failed
edit: After applying this commit i get the same output as above.
$ /usr/bin/torsocks --versionTorsocks 2.2.0/usr/bin/torsocks ./a.out1546704938 WARNING torsocks[9687]: [syscall] Unsupported syscall number 141. Denying the call (in tsocks_syscall() at syscall.c:488)getdents: Function not implementedtorsocks# make install$ torsocks --versionTorsocks 2.3.0$ torsocks ./a.out1546704119 WARNING torsocks[9431]: [syscall] Unsupported syscall number 141. Denying the call (in tsocks_syscall() at syscall.c:568)getdents: Function not implementedtorsocks-seisvelas# make install$ torsocks ./a.out--------------- nread=628 --------------- inode# file type d_reclen d_off d_name 659085 regular 24 59533437 autogen.sh 688747 directory 20 282648487 tests 688742 directory 20 386899293 include 659424 regular 20 416462606 Makefile 659390 regular 24 437768886 configure 688719 directory 16 518915911 .git 659474 regular 20 553246746 libtool 659079 regular 24 613726131 .travis.yml 659080 regular 24 652068980 ChangeLog 688718 directory 16 1055405100 . 659184 regular 28 1127103152 config.status 659102 regular 24 1139214666 gpl-2.0.txt 688741 directory 20 1204858234 extras 659082 regular 20 1257734922 LICENSE 659081 regular 20 1304322103 INSTALL 659083 regular 24 1335198446 Makefile.am 659084 regular 24 1995239999 README.md 688743 directory 16 2094777189 src 659089 regular 24 2147483647 configure.a
The getdents64() should be using struct linux_dirent64 according to the man page.
The unsigned int count; seems to have an extra white space at the start. And the unsigned int fd; in both functions has a extra white space at the end.
Looks great. Can I ask you one last thing. To squash together all commits into one? I see 7 commits with roughly the same title so it doesn't tell us much about what it is or does.
If you have question about it, let me know on IRC/email or I can do it myself if you prefer. Whatever suits you!
Hmmm... that branch still has all the commits that are supposed to be merged into a single one. Can you git rebase -i and squash them all into one? I can't merge it like that :S