From bd9ebb3763b90a8ef429376ee578e0571371145f Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 18 Jun 2018 17:08:23 -0400 Subject: [PATCH 1/9] Use a rust build script to set linker options correctly for tests. We need this trick because some of our Rust tests depend on our C code, which in turn depend on other native libraries, which thereby pulls a whole mess of our build system into "cargo test". To solve this, we add a build script (build.rs) to set most of the options that we want based on the contents of config.rust. Some options can't be set, and need to go to the linker directly: we use a linker replacement (link_rust.sh) for these. Both config.rust and link_rust.sh are generated by autoconf for us. This patch on its own should enough to make the crypto test build, but not necessarily enough to make it pass. --- .gitignore | 2 + config.rust.in | 22 +++++ configure.ac | 20 +++++ link_rust.sh.in | 10 +++ src/rust/build.rs | 179 +++++++++++++++++++++++++++++++++++++ src/rust/crypto/Cargo.toml | 2 +- src/test/include.am | 7 +- 7 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 config.rust.in create mode 100644 link_rust.sh.in create mode 100644 src/rust/build.rs diff --git a/.gitignore b/.gitignore index c00fbe97e1..b3b13694af 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ uptime-*.json /autom4te.cache /build-stamp /compile +/config.rust /configure /Doxyfile /orconfig.h @@ -55,6 +56,7 @@ uptime-*.json /config.guess /config.sub /conftest* +/link_rust.sh /micro-revision.* /patch-stamp /stamp-h diff --git a/config.rust.in b/config.rust.in new file mode 100644 index 0000000000..4ca5351aec --- /dev/null +++ b/config.rust.in @@ -0,0 +1,22 @@ +# Used by our cargo build.rs script to get variables from autoconf. +# +# The "configure" script will generate "config.rust" from "config.rust.in", +# and then build.rs will read "config.rust". + +BUILDDIR=@BUILDDIR@ +TOR_LDFLAGS_zlib=@TOR_LDFLAGS_zlib@ +TOR_LDFLAGS_openssl=@TOR_LDFLAGS_openssl@ +TOR_LDFLAGS_libevent=@TOR_LDFLAGS_libevent@ +TOR_ZLIB_LIBS=@TOR_ZLIB_LIBS@ +TOR_LIB_MATH=@TOR_LIB_MATH@ +TOR_LIBEVENT_LIBS=@TOR_LIBEVENT_LIBS@ +TOR_OPENSSL_LIBS=@TOR_OPENSSL_LIBS@ +TOR_LIB_WS32=@TOR_LIB_WS32@ +TOR_LIB_GDI=@TOR_LIB_GDI@ +TOR_LIB_USERENV=@TOR_LIB_USERENV@ +CURVE25519_LIBS=@CURVE25519_LIBS@ +TOR_SYSTEMD_LIBS=@TOR_SYSTEMD_LIBS@ +TOR_LZMA_LIBS=@TOR_LZMA_LIBS@ +TOR_ZSTD_LIBS=@TOR_ZSTD_LIBS@ +LIBS=@LIBS@ +LDFLAGS=@LDFLAGS@ diff --git a/configure.ac b/configure.ac index 48ca5bae14..9ea1bc3215 100644 --- a/configure.ac +++ b/configure.ac @@ -1117,6 +1117,24 @@ if test "$fragile_hardening" = "yes"; then TOR_CHECK_CFLAGS([-fno-omit-frame-pointer]) fi +dnl Find the correct libraries to add in order to use the sanitizers. +dnl +dnl When building Rust, Cargo will run the linker with the -nodefaultlibs +dnl option, which will prevent the compiler from linking the sanitizer +dnl libraries it needs. We need to specify them manually. +dnl +dnl What's more, we need to specify them in a linker script rather than +dnl from build.rs: these options aren't allowed in the cargo:rustc-flags +dnl variable. +RUST_LINKER_OPTIONS="" +if test "x$CFLAGS_ASAN" != "x"; then + RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -static-libasan" +fi +if test "x$CFLAGS_UBSAN" != "x"; then + RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -static-libubsan" +fi +AC_SUBST(RUST_LINKER_OPTIONS) + CFLAGS_BUGTRAP="$CFLAGS_FTRAPV $CFLAGS_ASAN $CFLAGS_UBSAN" CFLAGS_CONSTTIME="$CFLAGS_FWRAPV" @@ -2266,6 +2284,8 @@ CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_z AC_CONFIG_FILES([ Doxyfile Makefile + config.rust + link_rust.sh contrib/dist/suse/tor.sh contrib/operator-tools/tor.logrotate contrib/dist/tor.sh diff --git a/link_rust.sh.in b/link_rust.sh.in new file mode 100644 index 0000000000..2b972fdf27 --- /dev/null +++ b/link_rust.sh.in @@ -0,0 +1,10 @@ +#!/bin/sh +# +# A linker script used when building Rust tests. Autoconf makes link_rust.sh +# from link_rust_sh.in, and uses it to pass extra options to the linker +# when linking Rust stuff. +# +# We'd like to remove the need for this, but build.rs doesn't let us pass +# -static-libasan and -static-libubsan to the linker. + +"$CCLD" @RUST_LINKER_OPTIONS@ "$@" diff --git a/src/rust/build.rs b/src/rust/build.rs new file mode 100644 index 0000000000..b943aa5535 --- /dev/null +++ b/src/rust/build.rs @@ -0,0 +1,179 @@ +//! Build script for Rust modules in Tor. +//! +//! We need to use this because some of our Rust tests need to use some +//! of our C modules, which need to link some external libraries. +//! +//! This script works by looking at a "config.rust" file generated by our +//! configure script, and then building a set of options for cargo to pass to +//! the compiler. + +use std::collections::HashMap; +use std::env; +use std::fs::File; +use std::io::prelude::*; +use std::io; +use std::path::PathBuf; + +/// Wrapper around a key-value map. +struct Config( + HashMap +); + +/// Locate a config.rust file generated by autoconf, starting in the OUT_DIR +/// location provided by cargo and recursing up the directory tree. Note that +/// we need to look in the OUT_DIR, since autoconf will place generated files +/// in the build directory. +fn find_cfg() -> io::Result { + let mut path = PathBuf::from(env::var("OUT_DIR").unwrap()); + loop { + path.push("config.rust"); + if path.exists() { + return Ok(path.to_str().unwrap().to_owned()); + } + path.pop(); // remove config.rust + if ! path.pop() { // can't remove last part of directory + return Err(io::Error::new(io::ErrorKind::NotFound, + "No config.rust")); + } + } +} + +impl Config { + /// Find the config.rust file and try to parse it. + /// + /// The file format is a series of lines of the form KEY=VAL, with + /// any blank lines and lines starting with # ignored. + fn load() -> io::Result { + let path = find_cfg()?; + let f = File::open(&path)?; + let reader = io::BufReader::new(f); + let mut map = HashMap::new(); + for line in reader.lines() { + let s = line?; + if s.trim().starts_with("#") || s.trim() == "" { + continue; + } + let idx = match s.find("=") { + None => { + return Err(io::Error::new(io::ErrorKind::InvalidData, + "missing =")); + }, + Some(x) => x + }; + let (var,eq_val) = s.split_at(idx); + let val = &eq_val[1..]; + map.insert(var.to_owned(), val.to_owned()); + } + Ok(Config(map)) + } + + /// Return a reference to the value whose key is 'key'. + /// + /// Panics if 'key' is not found in the configuration. + fn get(&self, key : &str) -> &str { + self.0.get(key).unwrap() + } + + /// Add a dependency on a static C library that is part of Tor, by name. + fn component(&self, s : &str) { + println!("cargo:rustc-link-lib=static={}", s); + } + + /// Add a dependency on a native library that is not part of Tor, by name. + fn dependency(&self, s : &str) { + println!("cargo:rustc-link-lib={}", s); + } + + /// Add a link path, relative to Tor's build directory. + fn link_relpath(&self, s : &str) { + let builddir = self.get("BUILDDIR"); + println!("cargo:rustc-link-search=native={}/{}", builddir, s); + } + + /// Add an absolute link path. + fn link_path(&self, s : &str) { + println!("cargo:rustc-link-search=native={}", s); + } + + /// Parse the CFLAGS in s, looking for -l and -L items, and adding + /// rust configuration as appropriate. + fn from_cflags(&self, s : &str) { + let mut next_is_lib = false; + let mut next_is_path = false; + for ent in self.get(s).split_whitespace() { + if next_is_lib { + self.dependency(ent); + next_is_lib = false; + } else if next_is_path { + self.link_path(ent); + next_is_path = false; + } else if ent == "-l" { + next_is_lib = true; + } else if ent == "-L" { + next_is_path = true; + } else if ent.starts_with("-L") { + self.link_path(&ent[2..]); + } else if ent.starts_with("-l") { + self.dependency(&ent[2..]); + } + } + } +} + +pub fn main() { + let cfg = Config::load().unwrap(); + let package = env::var("CARGO_PKG_NAME").unwrap(); + + match package.as_ref() { + "crypto" => { + // Right now, I'm having a separate configuration for each Rust + // package, since I'm hoping we can trim them down. Once we have a + // second Rust package that needs to use this build script, let's + // extract some of this stuff into a module. + // + // This is a ridiculous amount of code to be pulling in just + // to test our crypto library: modularity would be our + // friend here. + cfg.from_cflags("TOR_LDFLAGS_zlib"); + cfg.from_cflags("TOR_LDFLAGS_openssl"); + cfg.from_cflags("TOR_LDFLAGS_libevent"); + + cfg.link_relpath("src/common"); + cfg.link_relpath("src/ext/keccak-tiny"); + cfg.link_relpath("src/ext/keccak-tiny"); + cfg.link_relpath("src/ext/ed25519/ref10"); + cfg.link_relpath("src/ext/ed25519/donna"); + cfg.link_relpath("src/trunnel"); + + // Note that we can't pull in "libtor-testing", or else we + // will have dependencies on all the other rust packages that + // tor uses. We must be careful with factoring and dependencies + // moving forward! + cfg.component("or-crypto-testing"); + cfg.component("or-ctime-testing"); + cfg.component("or-testing"); + cfg.component("or-event-testing"); + cfg.component("or-ctime-testing"); + cfg.component("curve25519_donna"); + cfg.component("keccak-tiny"); + cfg.component("ed25519_ref10"); + cfg.component("ed25519_donna"); + cfg.component("or-trunnel-testing"); + + cfg.from_cflags("TOR_ZLIB_LIBS"); + cfg.from_cflags("TOR_LIB_MATH"); + cfg.from_cflags("TOR_OPENSSL_LIBS"); + cfg.from_cflags("TOR_LIBEVENT_LIBS"); + cfg.from_cflags("TOR_LIB_WS32"); + cfg.from_cflags("TOR_LIB_GDI"); + cfg.from_cflags("TOR_LIB_USERENV"); + cfg.from_cflags("CURVE25519_LIBS"); + cfg.from_cflags("TOR_LZMA_LIBS"); + cfg.from_cflags("TOR_ZSTD_LIBS"); + cfg.from_cflags("LIBS"); + }, + _ => { + panic!("No configuration in build.rs for package {}", package); + } + } +} diff --git a/src/rust/crypto/Cargo.toml b/src/rust/crypto/Cargo.toml index c0c5e7bf93..9d302ee3ba 100644 --- a/src/rust/crypto/Cargo.toml +++ b/src/rust/crypto/Cargo.toml @@ -4,6 +4,7 @@ authors = ["The Tor Project", name = "crypto" version = "0.0.1" publish = false +build = "../build.rs" [lib] name = "crypto" @@ -26,4 +27,3 @@ rand_core = { version = "=0.2.0-pre.0", default-features = false } [features] testing = ["tor_log/testing"] - diff --git a/src/test/include.am b/src/test/include.am index 2ae598b224..4146de73b1 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -10,7 +10,10 @@ TESTS_ENVIRONMENT = \ export TESTING_TOR_BINARY="$(TESTING_TOR_BINARY)"; \ export CARGO="$(CARGO)"; \ export EXTRA_CARGO_OPTIONS="$(EXTRA_CARGO_OPTIONS)"; \ - export CARGO_ONLINE="$(CARGO_ONLINE)"; + export CARGO_ONLINE="$(CARGO_ONLINE)"; \ + export CCLD="$(CCLD)"; \ + chmod +x "$(abs_top_builddir)/link_rust.sh"; \ + export RUSTFLAGS="-C linker=$(abs_top_builddir)/link_rust.sh"; TESTSCRIPTS = \ src/test/fuzz_static_testcases.sh \ @@ -347,7 +350,7 @@ src_test_test_bt_cl_LDADD = src/common/libor-testing.a \ src/trace/libor-trace.a \ $(rust_ldadd) \ @TOR_LIB_MATH@ \ - @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ + @TOR_LIB_WS32@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ src_test_test_bt_cl_CFLAGS = $(AM_CFLAGS) $(TEST_CFLAGS) src_test_test_bt_cl_CPPFLAGS= $(src_test_AM_CPPFLAGS) $(TEST_CPPFLAGS) From 901ada7e5f5cd98d94c98dac55e471d0a71b740b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 17:08:00 -0400 Subject: [PATCH 2/9] Fix bugs in rust digest tests --- src/rust/crypto/digests/sha2.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/rust/crypto/digests/sha2.rs b/src/rust/crypto/digests/sha2.rs index 62863aaa44..1e6b8e0e86 100644 --- a/src/rust/crypto/digests/sha2.rs +++ b/src/rust/crypto/digests/sha2.rs @@ -154,7 +154,7 @@ impl Input for Sha512 { // FIXME: Once const generics land in Rust, we should genericise calling // crypto_digest_get_digest in external::crypto_digest. impl FixedOutput for Sha512 { - type OutputSize = U32; + type OutputSize = U64; fn fixed_result(self) -> GenericArray { let buffer: [u8; DIGEST512_LEN] = get_512_bit_digest(self.engine); @@ -178,6 +178,9 @@ mod test { fn sha256_digest() { let mut h: Sha256 = Sha256::new(); let mut result: [u8; DIGEST256_LEN] = [0u8; DIGEST256_LEN]; + let expected = [151, 223, 53, 136, 181, 163, 242, 75, 171, 195, + 133, 27, 55, 47, 11, 167, 26, 157, 205, 222, 212, + 59, 20, 185, 208, 105, 97, 191, 193, 112, 125, 157]; h.input(b"foo"); h.input(b"bar"); @@ -187,7 +190,7 @@ mod test { println!("{:?}", &result[..]); - assert_eq!(&result[..], &b"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"[..]); + assert_eq!(result, expected); } #[test] @@ -200,6 +203,12 @@ mod test { let mut h: Sha512 = Sha512::new(); let mut result: [u8; DIGEST512_LEN] = [0u8; DIGEST512_LEN]; + let expected = [203, 55, 124, 16, 176, 245, 166, 44, 128, 54, 37, 167, + 153, 217, 233, 8, 190, 69, 231, 103, 245, 209, 71, 212, 116, + 73, 7, 203, 5, 89, 122, 164, 237, 211, 41, 160, 175, 20, 122, + 221, 12, 244, 24, 30, 211, 40, 250, 30, 121, 148, 38, 88, 38, + 179, 237, 61, 126, 246, 240, 103, 202, 153, 24, 90]; + h.input(b"foo"); h.input(b"bar"); h.input(b"baz"); @@ -208,6 +217,6 @@ mod test { println!("{:?}", &result[..]); - assert_eq!(&result[..], &b"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"[..]); + assert_eq!(&result[..], &expected[..]); } } From 592e8ac395fc29113774fb15ca0227699d14e080 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 17:16:44 -0400 Subject: [PATCH 3/9] Disable doctests in src/rust/crypto module. These all need C linking to work, and so far, rustdoc does not seem to respect cargo setting about build scripts or RUSTOPTIONS. --- src/rust/crypto/digests/sha2.rs | 8 ++++---- src/rust/crypto/lib.rs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rust/crypto/digests/sha2.rs b/src/rust/crypto/digests/sha2.rs index 1e6b8e0e86..03e0843dc0 100644 --- a/src/rust/crypto/digests/sha2.rs +++ b/src/rust/crypto/digests/sha2.rs @@ -43,7 +43,7 @@ pub struct Sha256 { /// /// # Examples /// -/// ``` +/// ```rust,no_run /// use crypto::digests::sha2::{Sha256, Digest}; /// /// let mut hasher: Sha256 = Sha256::default(); @@ -66,7 +66,7 @@ impl BlockInput for Sha256 { /// /// # Examples /// -/// ``` +/// ```rust,no_run /// use crypto::digests::sha2::{Sha256, Digest}; /// /// let mut hasher: Sha256 = Sha256::default(); @@ -110,7 +110,7 @@ pub struct Sha512 { /// /// # Examples /// -/// ``` +/// ```rust,no_run /// use crypto::digests::sha2::{Sha512, Digest}; /// /// let mut hasher: Sha512 = Sha512::default(); @@ -133,7 +133,7 @@ impl BlockInput for Sha512 { /// /// # Examples /// -/// ``` +/// ```rust,no_run /// use crypto::digests::sha2::{Sha512, Digest}; /// /// let mut hasher: Sha512 = Sha512::default(); diff --git a/src/rust/crypto/lib.rs b/src/rust/crypto/lib.rs index d120635b95..f72a859dd7 100644 --- a/src/rust/crypto/lib.rs +++ b/src/rust/crypto/lib.rs @@ -9,7 +9,7 @@ //! The `digests` module contains submodules for specific hash digests //! and extendable output functions. //! -//! ``` +//! ```rust,no_run //! use crypto::digests::sha2::*; //! //! let mut hasher: Sha256 = Sha256::default(); @@ -43,4 +43,3 @@ extern crate tor_log; pub mod digests; // Unfortunately named "digests" plural to avoid name conflict with the digest crate pub mod rand; - From 3a640520996ae45ed32f483432af735187bb7ee5 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 17:28:28 -0400 Subject: [PATCH 4/9] Fix memory leak in CryptoDigest type If you're owning a C pointer, you need to implement Drop. --- src/rust/external/crypto_digest.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/rust/external/crypto_digest.rs b/src/rust/external/crypto_digest.rs index 4eae1550a2..3e8801f203 100644 --- a/src/rust/external/crypto_digest.rs +++ b/src/rust/external/crypto_digest.rs @@ -140,7 +140,7 @@ extern "C" { fn crypto_digest_new() -> *mut crypto_digest_t; fn crypto_digest256_new(algorithm: digest_algorithm_t) -> *mut crypto_digest_t; fn crypto_digest512_new(algorithm: digest_algorithm_t) -> *mut crypto_digest_t; - fn crypto_digest_free(digest: *mut crypto_digest_t); + fn crypto_digest_free_(digest: *mut crypto_digest_t); fn crypto_digest_add_bytes(digest: *mut crypto_digest_t, data: *const c_char, len: size_t); fn crypto_digest_get_digest(digest: *mut crypto_digest_t, out: *mut c_char, out_len: size_t); fn crypto_digest_dup(digest: *const crypto_digest_t) -> *mut crypto_digest_t; @@ -292,6 +292,14 @@ impl CryptoDigest { } } +impl Drop for CryptoDigest { + fn drop(&mut self) { + unsafe { + crypto_digest_free_(self.0 as *mut crypto_digest_t); + } + } +} + /// Get the 256-bit digest output of a `crypto_digest_t`. /// /// # Inputs From 6c3ad4cae8b967f6dc9ee98f5b01de9e327e9880 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 17:53:09 -0400 Subject: [PATCH 5/9] Use different RUST_LINKER_OPTIONS for sanitizers These appear to work for me. --- configure.ac | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index f976cdd42d..606bceeda5 100644 --- a/configure.ac +++ b/configure.ac @@ -1128,11 +1128,20 @@ dnl What's more, we need to specify them in a linker script rather than dnl from build.rs: these options aren't allowed in the cargo:rustc-flags dnl variable. RUST_LINKER_OPTIONS="" -if test "x$CFLAGS_ASAN" != "x"; then - RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -static-libasan" -fi -if test "x$CFLAGS_UBSAN" != "x"; then - RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -static-libubsan" +if test "x$have_clang" = "xyes"; then + if test "x$CFLAGS_ASAN" != "x"; then + RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_ASAN" + fi + if test "x$CFLAGS_UBSAN" != "x"; then + RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_UBSAN" + fi +else + if test "x$CFLAGS_ASAN" != "x"; then + RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lasan" + fi + if test "x$CFLAGS_UBSAN" != "x"; then + RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lubsan" + fi fi AC_SUBST(RUST_LINKER_OPTIONS) From d110f9c9a684e2ab030a65b1366dfb0f037a8279 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 18:02:49 -0400 Subject: [PATCH 6/9] Add a leak suppression for backtrace_alloc This appears to be an internal rust thing: I don't know why it's leaking. We should investigate further. --- src/test/include.am | 1 + src/test/rust_supp.txt | 1 + src/test/test_rust.sh | 3 +-- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 src/test/rust_supp.txt diff --git a/src/test/include.am b/src/test/include.am index 4146de73b1..4fe222b550 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -364,6 +364,7 @@ EXTRA_DIST += \ src/test/fuzz_static_testcases.sh \ src/test/slownacl_curve25519.py \ src/test/zero_length_keys.sh \ + src/test/rust_supp.txt \ src/test/test_keygen.sh \ src/test/test_key_expiration.sh \ src/test/test_zero_length_keys.sh \ diff --git a/src/test/rust_supp.txt b/src/test/rust_supp.txt new file mode 100644 index 0000000000..7fa50f3fb1 --- /dev/null +++ b/src/test/rust_supp.txt @@ -0,0 +1 @@ +leak:backtrace_alloc diff --git a/src/test/test_rust.sh b/src/test/test_rust.sh index 4795258d06..b1eae7d5f2 100755 --- a/src/test/test_rust.sh +++ b/src/test/test_rust.sh @@ -3,6 +3,7 @@ set -e +export LSAN_OPTIONS=suppressions=${abs_top_srcdir}/src/test/rust_supp.txt for cargo_toml_dir in "${abs_top_srcdir:-../../..}"/src/rust/*; do if [ -e "${cargo_toml_dir}/Cargo.toml" ]; then @@ -16,5 +17,3 @@ for cargo_toml_dir in "${abs_top_srcdir:-../../..}"/src/rust/*; do done exit $exitcode - - From 8f3712cf6e02bb7e7a8ad9570fda3f6904c7d181 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 19:05:11 -0400 Subject: [PATCH 7/9] eol@eof is still the law in 0.3.4 :( --- src/common/util.c | 1 + src/or/control.c | 1 + src/or/geoip.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/common/util.c b/src/common/util.c index 26b76c31f6..dece5877f1 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -5375,3 +5375,4 @@ tor_ntohll(uint64_t a) { return tor_htonll(a); } + diff --git a/src/or/control.c b/src/or/control.c index ae54689c0b..bb68925f8c 100644 --- a/src/or/control.c +++ b/src/or/control.c @@ -7736,3 +7736,4 @@ control_testing_set_global_event_mask(uint64_t mask) global_event_mask = mask; } #endif /* defined(TOR_UNIT_TESTS) */ + diff --git a/src/or/geoip.c b/src/or/geoip.c index c66bee0faa..d59043a7f6 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -1884,3 +1884,4 @@ geoip_free_all(void) memset(geoip_digest, 0, sizeof(geoip_digest)); memset(geoip6_digest, 0, sizeof(geoip6_digest)); } + From e084afde80a844328a1eeef33d732e0f0a0d9eda Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 19:16:25 -0400 Subject: [PATCH 8/9] Allow spaces in CCLD in linker.sh Hello71 spotted this first. --- link_rust.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/link_rust.sh.in b/link_rust.sh.in index 2b972fdf27..59f4142baa 100644 --- a/link_rust.sh.in +++ b/link_rust.sh.in @@ -7,4 +7,4 @@ # We'd like to remove the need for this, but build.rs doesn't let us pass # -static-libasan and -static-libubsan to the linker. -"$CCLD" @RUST_LINKER_OPTIONS@ "$@" +$CCLD @RUST_LINKER_OPTIONS@ "$@" From 01d0bf180344b213b3bf43d8e40dc9c8e4990976 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 20 Jun 2018 19:32:01 -0400 Subject: [PATCH 9/9] add build.rs to EXTRA_DIST --- src/rust/include.am | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rust/include.am b/src/rust/include.am index 5fd9741e01..5e5b0b3faf 100644 --- a/src/rust/include.am +++ b/src/rust/include.am @@ -1,6 +1,7 @@ include src/rust/tor_rust/include.am EXTRA_DIST +=\ + src/rust/build.rs \ src/rust/Cargo.toml \ src/rust/Cargo.lock \ src/rust/.cargo/config.in \