Skip to content

Fix assertion failure when shard_roll_to_valid() iterates to the end#786

Merged
zakird merged 1 commit intozmap:mainfrom
droe:droe/fix-shard-crash
Feb 16, 2024
Merged

Fix assertion failure when shard_roll_to_valid() iterates to the end#786
zakird merged 1 commit intozmap:mainfrom
droe:droe/fix-shard-crash

Conversation

@droe
Copy link
Contributor

@droe droe commented Feb 16, 2024

Prevents shard->current from wrapping around from 0 (ZMAP_SHARD_DONE) to -1 and causing an assertion failure in the constraint lookup code:

Assertion failed: (index < con->root->count), function constraint_lookup_index, file constraint.c, line 253.

This situation only manifested if one of the send threads happened to get a range containing no usable elements, which is extremely unlikely in normal ZMap use cases, but occurred relatively frequently when scanning only very few targets, such as a /29, using multiple send threads, i.e. #threads ≈ #targets.

Prevents shard->current from wrapping around from 0 (ZMAP_SHARD_DONE) to
-1 and causing an assertion failure in the constraint lookup code:

Assertion failed: (index < con->root->count), function constraint_lookup_index, file constraint.c, line 253.

This situation only manifested if one of the send threads happened to
get a range containing no usable elements, which is extremely unlikely
in normal ZMap use cases, but occurred frequently when scanning only
very few targets using multiple send threads, i.e. #threads ≈ #targets.
@zakird zakird merged commit 7287647 into zmap:main Feb 16, 2024
@droe droe deleted the droe/fix-shard-crash branch March 11, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants