Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14819 closed defect (fixed)

Thread refactoring breaks linking with --disable-threads

Reported by: teor Owned by: Sebastian
Priority: High Milestone: Tor: 0.2.6.x-final
Component: Core Tor/Tor Version: Tor: 0.2.6.2-alpha
Severity: Keywords: regression
Cc: nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

The recent refactoring (?) of the threads code appears to break linking with ./configure --disable-threads on OS X 10.10 with clang-3.7 (git, MacPorts).

  CCLD     src/or/tor
Undefined symbols for architecture x86_64:
  "_tor_cond_wait", referenced from:
      _worker_thread_main in libor.a(workqueue.o)
  "_spawn_func", referenced from:
      _threadpool_new in libor.a(workqueue.o)
  "_tor_cond_signal_all", referenced from:
      _threadpool_queue_update in libor.a(workqueue.o)
  "_tor_cond_uninit", referenced from:
      _tor_cond_free in libor.a(compat_threads.o)
  "_tor_cond_init", referenced from:
      _tor_cond_new in libor.a(compat_threads.o)
      _threadpool_new in libor.a(workqueue.o)
  "_tor_get_thread_id", referenced from:
      _tor_set_openssl_thread_id in libor-crypto.a(crypto.o)
      _set_main_thread in libor.a(compat_threads.o)
      _in_main_thread in libor.a(compat_threads.o)
  "_tor_mutex_init_nonrecursive", referenced from:
      _tor_mutex_new_nonrecursive in libor.a(compat_threads.o)
      _threadpool_new in libor.a(workqueue.o)
  "_tor_mutex_uninit", referenced from:
      _clean_up_backtrace_handler in libor.a(backtrace.o)
      _tor_mutex_free in libor.a(compat_threads.o)
      _threadpool_new in libor.a(workqueue.o)
  "_tor_mutex_init", referenced from:
      _init_logging in libor.a(log.o)
      _configure_backtrace_handler in libor.a(backtrace.o)
      _tor_mutex_new in libor.a(compat_threads.o)
      _replyqueue_new in libor.a(workqueue.o)
  "_tor_mutex_acquire", referenced from:
      _logv in libor.a(log.o)
      _tor_log_update_sigsafe_err_fds in libor.a(log.o)
      _tor_log_get_logfile_names in libor.a(log.o)
      _logs_free_all in libor.a(log.o)
      _add_stream_log in libor.a(log.o)
      _logs_set_domain_logging in libor.a(log.o)
      _add_temp_log in libor.a(log.o)
      ...
  "_tor_mutex_release", referenced from:
      _logv in libor.a(log.o)
      _tor_log_update_sigsafe_err_fds in libor.a(log.o)
      _tor_log_get_logfile_names in libor.a(log.o)
      _logs_free_all in libor.a(log.o)
      _add_stream_log in libor.a(log.o)
      _logs_set_domain_logging in libor.a(log.o)
      _add_temp_log in libor.a(log.o)
      ...
  "_tor_cond_signal_one", referenced from:
      _threadpool_queue_work in libor.a(workqueue.o)
  "_tor_threads_init", referenced from:
      _tor_main in libtor.a(main.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [src/or/tor] Error 1
make: *** [all] Error 2

Child Tickets

Change History (7)

comment:1 Changed 4 years ago by nickm

Actually, I don't think we want to support --disable-threads any more. See #12439 .

The right fix here is to remove the last vestiges of --disable-threads.

comment:2 Changed 4 years ago by Sebastian

Owner: set to Sebastian
Status: newassigned

comment:3 Changed 4 years ago by Sebastian

Woah. This is a messup in 29ac883606d6d5ebfdcc2efceb2b4b60ee6a8916 - it added the removed code back in for ticket #11016. This is a regression in 0.2.6.2. Fix forthcoming

comment:4 Changed 4 years ago by Sebastian

Status: assignedneeds_review

branch bug14819 in my repo

comment:5 Changed 4 years ago by teor

OK, the only scenario where --disable-threads has been useful for me is in the instrumented fuzzer afl. It works much better if the app doesn't run threads or fork.

But the right fix for afl is to create a main() that only loads the target code for fuzzing - which is required for decent fuzzing speed anyway.

comment:6 Changed 4 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged; thanks!

comment:7 Changed 4 years ago by nickm

Keywords: regression added
Note: See TracTickets for help on using tickets.