[tbb-dev] TASK03: more detailed analysis for ' --enable-rust ' on x86-android target

WU RUXU wrxzzj at gmail.com
Mon Feb 5 03:21:11 UTC 2018


Hi all

   I have debug --enable-rust in tor-0.3.2.9 on x86-android target, with
compare with arm-android target, find more details about this issue.

debug output on x86-android in ffi.rs:

Feb 05 02:01:00.161 [notice] Tor can't help you if you use it wrong! Learn
how to be safe at https://www.torproject.org/download/download#warning
 RustString self 0xbf8ec7f8
 RUST: rust_welcome_string Tor is running with Rust integration. Please
report any bugs you encouter. 0xbf8ec7f8
 C: &rust_str = 0xbf8ec870, rust_str = 0xa889a880 //printf(" C: &rust_str =
%p, rust_str = %p\n", &rust_str, rust_str);
Segmentation fault
// when I try to print str:RustString address in rust_str_get, as following
pub unsafe extern "C" fn rust_str_get(str: RustString) -> *const c_char {
    println!(" RUST: rust_str_get &str = {:p} ", &str);

debug output on arm-android in ffi.rs:

Feb 05 10:12:01.092 [notice] Tor can't help you if you use it wrong! Learn
how to be safe at https://www.torproject.org/download/download#warning
 RustString self 0xbe810814
 RUST: rust_welcome_string Tor is running with Rust integration. Please
report any bugs you encouter. 0xbe810814
 C: &rust_str = 0xbe810890, rust_str = 0xb66eb000
 RUST: rust_str_get &str = 0xbe810810 //println!(" RUST: rust_str_get &str
= {:p} ", &str);
 //? I don't known why the address is different with the address return in
rust_welcome_string
//    but two address is very close
//    in C code, the address of rust_str is also very close to the address
in RUST, it make sense.
 RustString self 0xbe810810
 RUST: rust_str_get str = Tor is running with Rust integration. Please
report any bugs you encouter.
Feb 05 10:12:01.093 [notice] Tor is running with Rust integration. Please
report any bugs you encouter.

Compare the two debug output, rust_str return from rust_welcome_string is
correct on two target.
but in rust_str_get, rust_str passed from C code is invalid on x86-android
target.
the RUST code runing very well on x86-android target, only have issue work
with C code
--
Thanks
PGP Fingerprint: F7BA D6CE 6592 77C7 0D2E  3BD5 5479 A15E B305 B8FE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-dev/attachments/20180205/b44e0bc6/attachment.html>


More information about the tbb-dev mailing list