Commit Graph

233 Commits

Author SHA1 Message Date
Nick Mathewson
97324a731f Merge remote-tracking branch 'tor-github/pr/431' into maint-0.3.5 2018-10-30 09:35:07 -04:00
Nick Mathewson
262b0fe7a0 Merge remote-tracking branch 'tor-github/pr/381' into maint-0.3.5 2018-10-30 08:39:57 -04:00
cypherpunks
bfab7b9d35 rust/tor_log: fix C_RUST_COUPLED documentation
This file was moved in 97b15a1d7c
and moved again in e7f5f48d68.
2018-10-24 09:02:04 -04:00
Nick Mathewson
289a7dbac3 Merge branch 'maint-0.3.4' into maint-0.3.5 2018-10-23 19:21:44 -04:00
Nick Mathewson
7edc594ee7 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-10-23 19:18:23 -04:00
Nick Mathewson
1ae9116601 Merge remote-tracking branch 'onionk/rust-protocommas1' into maint-0.3.5 2018-10-19 14:20:57 -04:00
Alex Crichton
38d644c94b Remove rlib+staticlib configuration for Rust crates
Only the final crate needs to be a `staticlib`, no need for all the
intermediate steps to produce staticlibs!
2018-10-01 22:58:44 -07:00
Alex Crichton
757a2360a4 Remove [features] from workspace Cargo.toml
Unfortunately Cargo doesn't actually parse these! Cargo should probably
print a warning saying they're not used...
2018-10-01 22:57:38 -07:00
Alex Crichton
74c1e44746 Fix segfaults related to sanitizers+jemalloc
It looks to be the case that Rust's standard allocator, jemalloc, is
incompatible with sanitizers. The incompatibility, for whatever reason,
seems to cause segfaults at runtime when jemalloc is linked with
sanitizers.

Without actually trying to figure out what's going on here this commit
instead takes the hammer of "let's remove jemalloc when testing". The
`tor_allocate` crate now by default switches to the system allocator
(eventually this will want to be the tor allocator). Most crates then
link to `tor_allocate` ot pick this up, but the `smartlist` crate had to
manually switch to the system allocator in testing and the `external`
crate had to be sure to link to `tor_allocate`.

The final gotcha here is that this patch also switches to
unconditionally passing `--target` to Cargo. For weird and arcane
reasons passing `--target` with the host target of the compiler (which
Cargo otherwise uses as the default) is different than not passing
`--target` at all. This ensure that our custom `RUSTFLAGS` with
sanitizer options doesn't make its way into build scripts, just the
final testing artifacts.
2018-10-01 22:55:59 -07:00
cypherpunks
5e74db95c2 rust: run rustfmt 2018-09-24 18:00:56 +00:00
cypherpunks
b91bc1babc rust/protover: remove redundant ExceedsMax checks
This is already checked elsewhere.
2018-09-24 14:30:43 +00:00
cypherpunks
42558df7c8 rust/protover: return C-allocated string in protover_all_supported()
The result of CString::into_raw() is not safe to free
with free() except under finicky and fragile circumstances
that we definitely don't meet right now.

This was missed in be583a34a3.
2018-09-21 05:16:22 +00:00
cypherpunks
db89b4b152 rust/protover: fix null deref in protover_all_supported()
Fortunately with the current callers it couldn't happen in practice.

Fix on d1820c1516.
2018-09-21 04:57:26 +00:00
teor
7bf9c93ab3 Merge remote-tracking branch 'nickm/bug27741_033' into bug27741_035
Resolve conflicts due to rustfmt, and run rustfmt on the merged code.
2018-09-18 23:32:57 +10:00
Nick Mathewson
52191064ac Merge branch 'maint-0.3.4' 2018-09-18 08:33:13 -04:00
Nick Mathewson
2ddbaf9cdc Merge branch 'maint-0.3.3' into maint-0.3.4 2018-09-18 08:31:14 -04:00
Nick Mathewson
80ad15921c Remove extraneous argument from Rust protover_compute_vote()
This argument was added to match an older idea for the C api, but we
decided not to do it that way in C.

Fixes bug 27741; bugfix on 0.3.3.6 / TROVE-2018-005 fix.
2018-09-17 11:57:56 -04:00
Nick Mathewson
a8ac21fbb5 Don't try to link C from rust doctests for nss detection
This is really annoying, since we can't use cfg(test) for doctests.
2018-09-16 14:34:31 -04:00
Nick Mathewson
991bec67ee When Tor is compiled with NSS, don't claim support for LinkAuth=1
Closes ticket 27288
2018-09-16 13:28:29 -04:00
cypherpunks
1ed5e009cb rust/protover: reject extra commas
The C implementation had gotten this wrong too, in a slightly different way.

Introduced in 5af03c1ef3.

Fixes #27197; bugfix on 0.3.3.3-alpha.
2018-09-15 23:19:31 +00:00
cypherpunks
5c47f725b0 rust/protover: delete ProtoSet::retain
As the comment noted, it was horribly inefficient.
2018-09-14 15:10:22 +00:00
cypherpunks
c613d55134 rust/protover: use .and_not_in() instead of .retain() in all_supported()
.retain() would allocating a Vec of billions of integers and check them
one at a time to separate the supported versions from the unsupported.
This leads to a memory DoS.

Closes ticket 27206. Bugfix on e6625113c9.
2018-09-14 15:08:55 +00:00
cypherpunks
578f7326ed rust/protover: add ProtoSet::and_not_in()
This is a way more efficient version of retain().
2018-09-14 15:08:54 +00:00
Nick Mathewson
82b1282772 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-09-14 09:25:34 -04:00
cypherpunks
bf9dc697fa Merge branch 'rust-protokeyword1-034' into rust-protokeyword1-035 2018-09-14 02:33:59 +00:00
cypherpunks
574d59c640 Merge branch 'rust-protokeyword1' into rust-protokeyword1-034 2018-09-14 02:26:31 +00:00
cypherpunks
7c26f88fd7 rust/protover: validate unknown protocol names use only allowed characters 2018-09-13 16:33:58 +00:00
Nick Mathewson
f308e81fa7 Merge branch 'maint-0.3.4' 2018-09-12 17:25:40 -04:00
Nick Mathewson
f8d5fb42a3 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-09-12 17:24:41 -04:00
cypherpunks
03c4d0ab9c rust/protover: fix check for overlapping ranges
Closes ticket 27649. Bugfix on e6625113c9.
2018-09-12 02:47:59 +00:00
cypherpunks
b88a2f28ae rust/protover: remove version zero from tests
This isn't legal according to dir-spec.txt.

We can write separate tests for it if the spec
is changed to make it legal.
2018-09-12 02:47:59 +00:00
Nick Mathewson
0db5c54957 Merge branch 'nss_squashed' into nss_merge 2018-09-04 20:21:07 -04:00
Nick Mathewson
bf5704051c Merge remote-tracking branch 'teor/travis-osx-master' 2018-08-21 20:04:13 -04:00
Nick Mathewson
aac1e17f22 Merge remote-tracking branch 'teor/travis-osx-034' into maint-0.3.4 2018-08-21 20:04:03 -04:00
Nick Mathewson
f0633bc491 Merge remote-tracking branch 'teor/travis-osx-033' into maint-0.3.3 2018-08-21 20:03:56 -04:00
Nick Mathewson
700f5bcc43 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-08-17 09:38:26 -04:00
Nick Mathewson
e0b8c53f56 Merge branch 'maint-0.3.4' 2018-08-17 09:38:26 -04:00
Nick Mathewson
87aacbfbba Merge remote-tracking branch 'onionk/rust-protospace' into maint-0.3.3 2018-08-17 09:38:08 -04:00
cypherpunks
7b7dd9ae1c rust/protover: don't accept whitespace in ProtoSet::from_str()
It's impossible for spaces to get here, since spaces are used as
separators between individual protocol entries higher up.

And it shouldn't ignore whitespace that isn't a literal space
character, because that would differ from the C implementation.

These were added in 9925d2e687.

Fixes #27177. Bugfix on 0.3.3.5-rc.
2018-08-17 13:34:03 +00:00
Nick Mathewson
ac721bd3b4 Merge branch 'maint-0.3.3' into maint-0.3.4 2018-08-17 09:29:46 -04:00
Nick Mathewson
bedc0b0b8f Merge branch 'maint-0.3.4' 2018-08-17 09:29:46 -04:00
cypherpunks
cc93f175ed rust/protover: fix hyphen parsing bug in ProtoSet::from_str()
It was parsing "1-2-3" as if it were 1-2, ignoring the 2nd hyphen
and everything after.

Introduced in d1820c1516.

Fixes #27164; bugfix on 0.3.3.1-alpha.
2018-08-17 13:27:24 +00:00
cypherpunks
fc7fed6155 rust/protover: fix docs for UnvalidatedProtoEntry::from_str
This got shuffled around in b786b146ed
and hasn't been accurate since 124caf28e6.
2018-08-17 02:38:23 +00:00
cypherpunks
e65a4fa42c rust/protover: fix parsing docs
The function takes an already validated utf-8 string, and
it never checks if the version numbers are an empty string.
That parse error happens later.

Fix on 701c2b69f5
2018-08-17 02:38:23 +00:00
cypherpunks
7bb658a633 rust/protover: fix ProtoEntry::from_str docs
Texxt was copied from a function that returned a single
tuple in 88b2f170e4.
2018-08-17 02:38:23 +00:00
cypherpunks
6b609ce435 rust: run rustfmt 2018-08-16 08:42:57 -04:00
cypherpunks
ceac10fc3d rust: max_width=100, other rustfmt settings. #27071
These are the 12 stable and documented configuration options,
set to their default values.

use_small_heuristics is only stabilized in rustfmt 0.9, so maintain
support for 0.8.x for now by commenting it out.

comment_width is unstable and did nothing, since wrap_comments defaults
to false.

Default values gotten from `rustfmt --print-config default rustfmt.toml`.

e7932fa9c2/Configurations.md
2018-08-16 08:42:57 -04:00
cypherpunks
fef2ba2267 rust/docs: fix critical typo for missing_docs lint
Fix typo from fe66d06a45.
The exclamation point is what lets an attribute apply to
an entire crate, without the ! it's practically a placebo.

Fix on commits af182d4ab5 and
b6059297d7, and note there are
still missing docs in both crypto and protover, for now.

https://doc.rust-lang.org/reference/attributes.html
2018-08-16 08:42:57 -04:00
teor
ace98493bd
Merge branch 'travis-osx-034' into travis-osx-master
Replace master .travis.yml with 034 .travis.yml.
All the changes in master have been backported to the
034 .travis.yml already.

Replace master src/test/test_rust.sh with 034
src/test/test_rust.sh, which was backported from
master. One 033/034-specific commit needs to be
reverted.
2018-08-10 13:28:19 +10:00
teor
6e0be81211
Merge branch 'travis-osx-033' into travis-osx-034
Replace 034 .travis.yml with 033 .travis.yml.
Subsequent commits will restore 034 functionality.

Replace 034 src/test/test_rust.sh with 033
src/test/test_rust.sh, which was backported from
master.
2018-08-10 13:15:16 +10:00