Opened 7 years ago

Closed 6 years ago

#8042 closed defect (fixed)

Reloaded md never be purged for platforms with unsigned time_t

Reported by: cypherpunks Owned by:
Priority: Medium Milestone: Tor: 0.2.4.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: easy tor-client
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

microdesc_cache_reload() calls microdescs_add_to_cache() with listed_at == -1, so md->last_listed was defined by annotation loaded from disk only.

  if (listed_at > 0) {
    SMARTLIST_FOREACH(descriptors, microdesc_t *, md,
                      md->last_listed = listed_at);

But if unsigned time_t then last_listed updated to 0xFF..FF value so that md never be purged by microdesc_cache_clean(). If such md was flushed to disk during rebuild cache then it will forever live.

Child Tickets

Change History (5)

comment:1 Changed 7 years ago by cypherpunks

Component: - Select a componentTor
Keywords: easy added
Milestone: Tor: 0.2.4.x-final

comment:2 Changed 7 years ago by rransom

POSIX (as of the 2003 edition) does not require that time_t be signed, but does use (time_t)-1 as a return value indicating an error.

comment:3 Changed 6 years ago by nickm

Status: newneeds_review

See branch "unsigned-time_t" in my public repo for a build warning that systems with unsigned time_t are not likely to work well with Tor, and a fix for this particular issue.

I suggest that we take only the warning for 0.2.4, and the fix for 0.2.5. The only living platform I've heard about where time_t is unsigned is OpenVMS, which we've never actually worked to the best of my knowledge. I don't think this represents a regression for any platform where Tor would otherwise work.

comment:4 Changed 6 years ago by nickm

Keywords: tor-client added

comment:5 Changed 6 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Still looks right. Merged it partially into 0.2.4 and completely into 0.2.5 as proposed above.

Note: See TracTickets for help on using tickets.