Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14740 closed defect (fixed)

Segmentation fault on scheduler domain messages

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

Description

The introduction of the scheduler in d438cf1ec9d5de08b8a8fffd7c38b66134fd337c has no string representing these types of domain messages. The list of domains (in src/common/log.c) is currently

static const char *domain_list[] = {
  "GENERAL", "CRYPTO", "NET", "CONFIG", "FS", "PROTOCOL", "MM",
  "HTTP", "APP", "CONTROL", "CIRC", "REND", "BUG", "DIR", "DIRSERV",
  "OR", "EDGE", "ACCT", "HIST", "HANDSHAKE", "HEARTBEAT", "CHANNEL", NULL
};

This should include a string for the scheduler domain. The segmentation fault is reproducible by executing Tor as tor --LogMessageDomains 1 --Log debug.

Child Tickets

Change History (7)

comment:1 Changed 6 years ago by dgoulet

Milestone: Tor: 0.2.6.x-final
Priority: normalmajor

I can reproduce this with git master. Changing this one to major issue.

comment:2 Changed 6 years ago by yawning

Status: newneeds_review

Easy to fix, since cypherpunks gave a detailed report and repo case.

My branch at: https://github.com/Yawning/tor/compare/bug14740

  • Adds "SCHED" to domain_list.
  • Adds the sanity check to the logging code that should have caught this.

Tested both with "SCHED" and without, and verified that the right thing happens.

comment:3 Changed 6 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Applied; thanks!

comment:4 Changed 6 years ago by nickm

Tweaked in 3f993dacc141a105d3e520cf1901dbb635c29ea2

comment:5 Changed 6 years ago by cypherpunks

Wouldn't a size_t cast be more appropriate when comparing with results of sizeof?

comment:6 Changed 6 years ago by nickm

Arguably, but keep in mind that the value here is the log2 of a uint32_t.

comment:7 Changed 6 years ago by cypherpunks

It should never overflow, that is correct but the data type is there for a reason. OTOH the current solution works so i'll leave this ticket be.

Note: See TracTickets for help on using tickets.