got this today at a stable hardened Gentoo linux server:
mr-fox ~ # cat x.log Jun 14 21:19:55.000 [warn] sandbox_intern_string(): Bug: No interned sandbox parameter found for /etc/tor/torrc.d/ (on Tor 0.3.1.3-alpha dc47d936d47ffc25)Jun 14 21:19:55.000 [warn] sandbox_intern_string(): Bug: No interned sandbox parameter found for /etc/tor/torrc.d/ (on Tor 0.3.1.3-alpha dc47d936d47ffc25)============================================================ T= 1497467995(Sandbox) Caught a bad syscall attempt (syscall open)/usr/bin/tor(+0x18e5f5)[0x55ec9b7a75f5]/lib64/libc.so.6(opendir+0x11)[0x7f5dfe271421]/lib64/libc.so.6(opendir+0x11)[0x7f5dfe271421]/usr/bin/tor(tor_listdir+0x32)[0x55ec9b7a32e2]/usr/bin/tor(+0x179080)[0x55ec9b792080]/usr/bin/tor(config_get_lines_include+0x38)[0x55ec9b792258]/usr/bin/tor(options_init_from_string+0x1df)[0x55ec9b716d0f]/usr/bin/tor(options_init_from_torrc+0x1f1)[0x55ec9b717221]/usr/bin/tor(+0x4f399)[0x55ec9b668399]/usr/lib64/libevent-2.1.so.6(+0x23749)[0x7f5dff649749]/usr/lib64/libevent-2.1.so.6(event_base_loop+0x57f)[0x7f5dff64a5ef]/usr/bin/tor(do_main_loop+0x24d)[0x55ec9b66693d]/usr/bin/tor(tor_main+0x1c3d)[0x55ec9b66a32d]/usr/bin/tor(main+0x28)[0x55ec9b661d18]/lib64/libc.so.6(__libc_start_main+0xfc)[0x7f5dfe1d972c]/usr/bin/tor(_start+0x29)[0x55ec9b661d69]
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
I'm having some problems fixing this one. I tried to change the sandbox code to allow adding more filters at runtime but it seems that the rules added after the initial seccomp initialization are being ignored.
More specifically, the problem I am having is the following (I am using the example in the above comments):
When the config is reloaded, the filter that allows opening /etc/tor/torrc.d/ appears to be installed correctly (sb_open adds the filter to the context and seccomp_load returns 0 when loading the context)
However, when open is called with /etc/tor/torrc.d/, the process is still killed
I've checked the value of the pointer to the "/etc/tor/torrc.d/" string and it is the same on sb_open when the rule is added and on the tor_listdir function, where opendir is called, which then calls the open syscall.
I believe the problem is related to adding filters after the initial seccomp initialization.
It would be great if someone who has some understanding of the sandbox code and libseccomp could take a look at this too.
A seccomp filter may return any of the following values. If multiple
filters exist, the return value for the evaluation of a given system
call will always use the highest precedent value. (For example,
SECCOMP_RET_KILL will always take precedence.)
SECCOMP_RET_ALLOW has the lowest precedence out of all of the filter actions. Essentially, "you can't loosen restrictions by installing an additional filter".
This means that the best thing that can be done in this case is to check for all includes in the config files before setting up the sandbox and include rules for those.
Reloading the configuration after adding more %includes or even more files to already included folders will not be possible if the sandbox is enabled.
This means that the best thing that can be done in this case is to check for all includes in the config files before setting up the sandbox and include rules for those.
In the long term, there's certainly ways to make this work, but it will involve using IPC and a separate process, or a separate sandboxing mechanism for filesystem access. Either of those changes would be objectively superior to what's done currently, but would be rather involved.
Reloading the configuration after adding more %includes or even more files to already included folders will not be possible if the sandbox is enabled.
Indeed. There's already certain preferences that are incompatible with the sandbox all together, or with reloads, so supporting it to the limits of the existing code and documenting the caveats may be sufficient.
smartlist_t *opened_files = smartlist_new(); memleak on error.
Fixed.
Why adding this? SCMP_SYS(getdents),
readdir which is called by tor_listdir uses getdents on my test system (Ubuntu 16.10 64bits).
This problem is not related to this ticket but it should be fixed too. I can create a different ticket and patch for it if you prefer.
Yes, I think 0.3.2 or 0.3.3 might be better, with a possible backport if it works out. The fix looks good to me, but it's subtle and we could have missed something, so it's best to try it in a pre-alpha first.
We closed legacy/trac#25677 (moved) as a duplicate. (Though it was reported on 0.3.2.10, which it isn't fixed in. I guess if we get too many reports, we should reconsider whether to backport.)