mozilla / mozilla/authenticator-rs

TSAN shows a data race in the unit tests

Open
#25 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
316
Forks
82
Avg merge
4d 20h
Merged PRs (30d)
1

Description

RUSTFLAGS="-Z sanitizer=thread" rustup run nightly cargo test

running 4 tests
test u2fprotocol::tests::test_init_device ... ok
test u2fprotocol::tests::test_ping_device ... ok
test u2fprotocol::tests::test_sendapdu ... ok
==================
WARNING: ThreadSanitizer: data race (pid=35046)
  Write of size 8 at 0x7e8000284070 by thread T4:
    #0 memmove <null>:65020504 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0xc206)
    #1 pthread_setname_np <null>:63970968 (libsystem_pthread.dylib:x86_64+0x421a)

  Previous write of size 8 at 0x7e8000284070 by thread T1:
    #0 memmove <null>:65020504 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0xc206)
    #1 pthread_setname_np <null>:63970968 (libsystem_pthread.dylib:x86_64+0x421a)

  Thread T4 (tid=5431922, running) created by main thread at:
    #0 pthread_create <null>:65020504 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x7121)
    #1 std::sys::imp::thread::Thread::new::hb0ee40c469bc0ac1 thread.rs:72 (u2fhid-67c8d56994e664bc:x86_64+0x10006d575)
    #2 __rust_maybe_catch_panic lib.rs:98 (u2fhid-67c8d56994e664bc:x86_64+0x10007176c)
    #3 start <null>:63965880 (libdyld.dylib:x86_64+0x5234)

  Thread T1 (tid=5431919, finished) created by main thread at:
    #0 pthread_create <null>:65020504 (libclang_rt.tsan_osx_dynamic.dylib:x86_64+0x7121)
    #1 std::sys::imp::thread::Thread::new::hb0ee40c469bc0ac1 thread.rs:72 (u2fhid-67c8d56994e664bc:x86_64+0x10006d575)
    #2 __rust_maybe_catch_panic lib.rs:98 (u2fhid-67c8d56994e664bc:x86_64+0x10007176c)
    #3 start <null>:63965880 (libdyld.dylib:x86_64+0x5234)

SUMMARY: ThreadSanitizer: data race (libsystem_pthread.dylib:x86_64+0x421a) in pthread_setname_np
==================
test u2fprotocol::tests::test_sendrecv_multiple ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported command, RUSTFLAGS="-Z sanitizer=thread" rustup run nightly cargo test, and inspect the four tests under u2fprotocol::tests, especially their thread activity. Done means ThreadSanitizer no longer reports the pthread_setname_np race and all four tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.