aboutsummaryrefslogtreecommitdiff
path: root/src/common
Commit message (Collapse)AuthorAge
* Log the name of the failing syscall on failureNick Mathewson2014-04-16
|
* Sandbox: permit O_NONBLOCK and O_NOCTTY for files we refuseNick Mathewson2014-04-16
| | | | | | OpenSSL needs this, or RAND_poll() will kill the process. Also, refuse with EACCESS, not errno==-1 (!).
* Don't allow change to ConnLimit while sandbox is activeNick Mathewson2014-04-16
|
* Use SCMP_CMP_MASKED_EQ to allow flags, not force themNick Mathewson2014-04-16
| | | | | | | | | Older versions of Libevent are happy to open SOCK_DGRAM sockets non-cloexec and non-nonblocking, and then set those flags afterwards. It's nice to be able to allow a flag to be on or off in the sandbox without having to enumerate all its values. Also, permit PF_INET6 sockets. (D'oh!)
* Get Libevent's PRNG functioning under the linux sandboxNick Mathewson2014-04-16
| | | | | | | | | | | | | | Libevent uses an arc4random implementation (I know, I know) to generate DNS transaction IDs and capitalization. But it liked to initialize it either with opening /dev/urandom (which won't work under the sandbox if it doesn't use the right pointer), or with sysctl({CTL_KERN,KERN_RANDOM,RANDOM_UUIC}). To make _that_ work, we were permitting sysctl unconditionally. That's not such a great idea. Instead, we try to initialize the libevent PRNG _before_ installing the sandbox, and make sysctl always fail with EPERM under the sandbox.
* Make sure everything using an interned string is preceded by a logNick Mathewson2014-04-16
| | | | | (It's nice to know what we were about to rename before we died from renaming it.)
* Introduce arg-counting macros to wrap seccomp_rule_add()Nick Mathewson2014-04-16
| | | | | | | | | | | | | | The compiler doesn't warn about this code: rc = seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(openat), 1, SCMP_CMP(0, SCMP_CMP_EQ, AT_FDCWD), SCMP_CMP(1, SCMP_CMP_EQ, param->value), SCMP_CMP(2, SCMP_CMP_EQ, O_RDONLY|...)); but note that the arg_cnt argument above is only 1. This means that only the first filter (argument 0 == AT_FDCWD) is actually checked! This patch also fixes the above error in the openat() filter. Earlier I fixed corresponding errors in filters for rename() and mprotect().
* Fix sandbox protection for renameNick Mathewson2014-04-16
| | | | (We were only checking the first parameter of each rename call.)
* Upgrade warning about missing interned string for sandboxNick Mathewson2014-04-16
|
* Have sandbox string protection include multi-valued parmeters.Nick Mathewson2014-04-16
|
* Clean up sandbox structures a bitNick Mathewson2014-04-16
| | | | | | Drop pindex,pindex2 as unused. Admit a type to avoid using a void*
* Add missing rename function for non-linux platformsNick Mathewson2014-04-16
|
* Drop 'fr' parameter from sandbox code.Nick Mathewson2014-04-16
| | | | | | | | | Appearently, the majority of the filenames we pass to sandbox_cfg_allow() functions are "freeable right after". So, consider _all_ of them safe-to-steal, and add a tor_strdup() in the few cases that aren't. (Maybe buggy; revise when I can test.)
* Add 'rename' to the sandboxed syscallsNick Mathewson2014-04-16
| | | | | | (If we don't restrict rename, there's not much point in restricting open, since an attacker could always use rename to make us open whatever they want.)
* Only intern one copy of each magic string for the sandboxNick Mathewson2014-04-16
| | | | | If we intern two copies of a string, later calls to sandbox_intern_string will give the wrong one sometimes.
* Fix some initial sandbox issues.Nick Mathewson2014-04-16
| | | | | Allow files that weren't in the list; Allow the _sysctl syscall; allow accept4 with CLOEXEC and NONBLOCK.
* Only expose clean_backtrace() if we'll implement itNick Mathewson2014-04-16
| | | | | | Fixes windows compilation; bug not in any released Tor. Bugfix on cc9e86db.
* Merge remote-tracking branch 'public/bug11465'Nick Mathewson2014-04-15
|\
| * Log a backtrace when the sandbox finds a failureNick Mathewson2014-04-10
| | | | | | | | | | | | | | This involves some duplicate code between backtrace.c and sandbox.c, but I don't see a way around it: calling more functions would mean adding more steps to our call stack, and running clean_backtrace() against the wrong point on the stack.
| * Make the sandbox code allow the writev() syscall.Nick Mathewson2014-04-10
| | | | | | | | Tor doesn't use it directly, but the glibc backtrace-to-fd code does
* | Uplift status.c unit test coverage with new test cases and macros.dana koch2014-04-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new set of unit test cases are provided, as well as introducing an alternative paradigm and macros to support it. Primarily, each test case is given its own namespace, in order to isolate tests from each other. We do this by in the usual fashion, by appending module and submodule names to our symbols. New macros assist by reducing friction for this and other tasks, like overriding a function in the global namespace with one in the current namespace, or declaring integer variables to assist tracking how many times a mock has been called. A set of tests for a small-scale module has been included in this commit, in order to highlight how the paradigm can be used. This suite gives 100% coverage to status.c in test execution.
* | Merge remote-tracking branch 'public/bug11513_024'Nick Mathewson2014-04-15
|\ \ | |/ |/|
| * New sort order for server choice of ciphersuites.Nick Mathewson2014-04-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 175b2678, we allowed servers to recognize clients who are telling them the truth about their ciphersuites, and select the best cipher from on that list. This implemented the server side of proposal 198. In bugs 11492, 11498, and 11499, cypherpunks found a bunch of mistakes and omissions and typos in the UNRESTRICTED_SERVER_CIPHER_LIST we had. In #11513, I found a couple more. Rather than try to hand-edit this list, I wrote a short python script to generate our ciphersuite preferences from the openssl headers. The new rules are: * Require forward secrecy. * Require RSA (since our servers only configure RSA keys) * Require AES or 3DES. (This means, reject RC4, DES, SEED, CAMELLIA, and NULL.) * No export ciphersuites. Then: * Prefer AES to 3DES. * If both suites have the same cipher, prefer ECDHE to DHE. * If both suites have the same DHE group type, prefer GCM to CBC. * If both suites have the same cipher mode, prefer SHA384 to SHA256 to SHA1. * If both suites have the same digest, prefer AES256 to AES128.
* | Merge remote-tracking branch 'public/update_ciphers_ff28'Nick Mathewson2014-04-08
|\ \
| * | Update ciphers.inc to match ff28Nick Mathewson2014-04-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The major changes are to re-order some ciphers, to drop the ECDH suites (note: *not* ECDHE: ECDHE is still there), to kill off some made-up stuff (like the SSL_RSA_FIPS_WITH_3DES_EDE_CBC_SHA suite), to drop some of the DSS suites... *and* to enable the ECDHE+GCM ciphersuites. This change is autogenerated by get_mozilla_ciphers.py from Firefox 28 and OpenSSL 1.0.1g. Resolves ticket 11438.
| * | Teach the get_mozilla_ciphers.py script to parse recent firefoxenNick Mathewson2014-04-08
| |/
* | Merge remote-tracking branch 'public/bug10363_024_squashed'Nick Mathewson2014-04-07
|\ \
| * | Another 10363 instance: this one in tor_memmem fallback codeNick Mathewson2014-04-07
| | |
* | | Merge remote-tracking branch 'public/bug10801_024'Nick Mathewson2014-04-05
|\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: src/common/address.c src/or/config.c
| * | | Make tor_addr_port_parse handle portless IPv6 addresses correctly.Nick Mathewson2014-04-05
| | | | | | | | | | | | | | | | | | | | (Not a bugfix on any Tor release; before 10801_024, it didn't handle portless addresses at all.)
| * | | Don't do a DNS lookup on a bridge line addressNick Mathewson2014-03-27
| | |/ | |/| | | | | | | Fixes bug 10801; bugfix on 07bf274d in 0.2.0.1-alpha.
* | | Merge remote-tracking branch 'public/bug4645'Nick Mathewson2014-04-01
|\ \ \ | | | | | | | | | | | | | | | | Conflicts: src/or/dirserv.c
| * | | Removing is_internal_IP() function. Resolves ticket 4645.rl19872014-02-03
| | | |
* | | | Merge remote-tracking branch 'public/bug11232'Nick Mathewson2014-04-01
|\ \ \ \
| * | | | Fix a ubsan warning in addr_mask_get_bitsNick Mathewson2014-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ubsan doesn't like us to do (1u<<32) when 32 is wider than unsigned. Fortunately, we already special-case addr_mask_get_bits(0), so we can just change the loop bounds.
| * | | | Fix a ubsan warning in our ctypes replacementsNick Mathewson2014-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | ubsan doesn't like 1<<31, since that's an undefined integer overflow. Instead, we should do 1u<<31.
| * | | | memarea.c: use flexible array member for memNick Mathewson2014-03-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This make clang's memory sanitizer happier that we aren't reading off the end of a char[1]. We hadn't replaced the char[1] with a char[FLEXIBLE_ARRAY_MEMBER] before because we were doing a union trick to force alignment. Now we use __attribute__(aligned) where available, and we do the union trick elsewhere. Most of this patch is just replacing accesses to (x)->u.mem with (x)->U_MEM, where U_MEM is defined as "u.mem" or "mem" depending on our implementation.
* | | | | Merge branch 'bug8787_squashed'Nick Mathewson2014-03-31
|\ \ \ \ \
| * | | | | Handle tor_munmap_file(NULL) consistentlyNick Mathewson2014-03-31
| | | | | |
| * | | | | Check strftime() return in tortls.cAndrea Shepard2014-03-31
| | | | | |
| * | | | | Eliminate lseek() with unchecked return in tor_mmap_file()Andrea Shepard2014-03-31
| | | | | |
| * | | | | Always check returns from unlink()Andrea Shepard2014-03-31
| | | | | |
| * | | | | Add return value and assert for null parameter to tor_munmap_file()Andrea Shepard2014-03-31
| | | | | |
* | | | | | Fix warnings from doxygenNick Mathewson2014-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of these are simple. The only nontrivial part is that our pattern for using ENUM_BF was confusing doxygen by making declarations that didn't look like declarations.
* | | | | | Never run crypto_early_init() more than onceRoger Dingledine2014-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we had set up all the infrastructure to avoid calling it after the first time, but didn't actually use it.
* | | | | | Merge remote-tracking branch 'public/bug9683_rebased'Nick Mathewson2014-03-23
|\ \ \ \ \ \ | | |/ / / / | |/| | | |
| * | | | | Test code for implementation of faster circuit_unlink_all_from_channelNick Mathewson2014-03-14
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This contains the obvious implementation using the circuitmux data structure. It also runs the old (slow) algorithm and compares the results of the two to make sure that they're the same. Needs review and testing.
* / / / / whitespace fixRoger Dingledine2014-03-23
|/ / / /
* | | | Fix some leaks/missed checks in the unit testsNick Mathewson2014-03-13
| | | | | | | | | | | | | | | | Coverity spotted these.
* | | | Fix whitespace errors, all of them mine.Nick Mathewson2014-03-05
| | | |