Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin J. Thompson
Tor
Commits
13455c0f
Commit
13455c0f
authored
7 years ago
by
Nick Mathewson
Browse files
Options
Downloads
Plain Diff
Merge branch 'maint-0.3.2'
parents
e622f208
cf5ab593
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/or/hs_service.c
+33
-17
33 additions, 17 deletions
src/or/hs_service.c
with
33 additions
and
17 deletions
src/or/hs_service.c
+
33
−
17
View file @
13455c0f
...
...
@@ -1819,6 +1819,15 @@ intro_point_should_expire(const hs_service_intro_point_t *ip,
static
void
cleanup_intro_points
(
hs_service_t
*
service
,
time_t
now
)
{
/* List of intro points to close. We can't mark the intro circuits for close
* in the modify loop because doing so calls
* hs_service_intro_circ_has_closed() which does a digest256map_get() on the
* intro points map (that we are iterating over). This can't be done in a
* single iteration after a MAP_DEL_CURRENT, the object will still be
* returned leading to a use-after-free. So, we close the circuits and free
* the intro points after the loop if any. */
smartlist_t
*
ips_to_free
=
smartlist_new
();
tor_assert
(
service
);
/* For both descriptors, cleanup the intro points. */
...
...
@@ -1828,7 +1837,6 @@ cleanup_intro_points(hs_service_t *service, time_t now)
DIGEST256MAP_FOREACH_MODIFY
(
desc
->
intro_points
.
map
,
key
,
hs_service_intro_point_t
*
,
ip
)
{
const
node_t
*
node
=
get_node_from_intro_point
(
ip
);
origin_circuit_t
*
ocirc
=
hs_circ_service_get_intro_circ
(
ip
);
int
has_expired
=
intro_point_should_expire
(
ip
,
now
);
/* We cleanup an intro point if it has expired or if we do not know the
...
...
@@ -1849,26 +1857,34 @@ cleanup_intro_points(hs_service_t *service, time_t now)
remember_failing_intro_point
(
ip
,
desc
,
approx_time
());
}
/* Remove intro point from descriptor map
. We'll
add it to the
failed
*
map if we retried it too many times
. */
/* Remove intro point from descriptor map
and
add it to the
list of
*
ips to free for which we'll also try to close the intro circuit
. */
MAP_DEL_CURRENT
(
key
);
service_intro_point_free
(
ip
);
/* XXX: Legacy code does NOT do that, it keeps the circuit open until
* a new descriptor is uploaded and then closed all expiring intro
* point circuit. Here, we close immediately and because we just
* discarded the intro point, a new one will be selected, a new
* descriptor created and uploaded. There is no difference to an
* attacker between the timing of a new consensus and intro point
* rotation (possibly?). */
if
(
ocirc
&&
!
TO_CIRCUIT
(
ocirc
)
->
marked_for_close
)
{
/* After this, no new cells will be handled on the circuit. */
circuit_mark_for_close
(
TO_CIRCUIT
(
ocirc
),
END_CIRC_REASON_FINISHED
);
}
continue
;
smartlist_add
(
ips_to_free
,
ip
);
}
}
DIGEST256MAP_FOREACH_END
;
}
FOR_EACH_DESCRIPTOR_END
;
/* Go over the intro points to free and close their circuit if any. */
SMARTLIST_FOREACH_BEGIN
(
ips_to_free
,
hs_service_intro_point_t
*
,
ip
)
{
/* See if we need to close the intro point circuit as well */
/* XXX: Legacy code does NOT close circuits like this: it keeps the circuit
* open until a new descriptor is uploaded and then closed all expiring
* intro point circuit. Here, we close immediately and because we just
* discarded the intro point, a new one will be selected, a new descriptor
* created and uploaded. There is no difference to an attacker between the
* timing of a new consensus and intro point rotation (possibly?). */
origin_circuit_t
*
ocirc
=
hs_circ_service_get_intro_circ
(
ip
);
if
(
ocirc
&&
!
TO_CIRCUIT
(
ocirc
)
->
marked_for_close
)
{
circuit_mark_for_close
(
TO_CIRCUIT
(
ocirc
),
END_CIRC_REASON_FINISHED
);
}
/* Cleanup the intro point */
service_intro_point_free
(
ip
);
}
SMARTLIST_FOREACH_END
(
ip
);
smartlist_free
(
ips_to_free
);
}
/* Set the next rotation time of the descriptors for the given service for the
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment