MarcoFalke
commented at 1:27 pm on April 3, 2021:
member
This fixes an UB (which results in a crash with sanitizers enabled). Can be reproduced by cherry-picking the test without the other code changes. The fix:
Adds an Assert to transform the UB into a clean crash, even when sanitizers are disabled
Adds an early-fail condition to avoid the crash
MarcoFalke
commented at 1:30 pm on April 3, 2021:
member
jamesob
commented at 1:37 pm on April 3, 2021:
member
Thanks for catching this. Why change behavior not to allow waiting for the headers to load?
MarcoFalke
commented at 2:03 pm on April 3, 2021:
member
I couldn’t find a code path that needs this behavior, so it seemed odd to keep the dead code. Note that in your parent PR the RPC does the waiting, so it doesn’t have to be done again in validation.
Edit: See max_secs_to_wait_for_headers in commit 1cf452104cd1c06ddba4001714f01d0516b864e9
Ouch555 changes_requested
Ouch555
commented at 2:07 pm on April 3, 2021:
none
Remove authorizationToken
MarcoFalke force-pushed
on Apr 3, 2021
jamesob
commented at 2:12 pm on April 3, 2021:
member
Note that in your parent PR the RPC does the waiting, so it doesn’t have to be done again in validation.
Oh good point. I guess if we add some flag that allows specifying a snapshot to load (absent RPC) we’ll have to add some similar code to init, but we can cross that bridge when we come to it.
In any case, concept ACK. Will test later today.
MarcoFalke
commented at 2:25 pm on April 3, 2021:
member
we can cross that bridge when we come to it
Indeed, I was never a fan of the “idle-loop” inside validation (See #19806 (review)), so moving it to the caller (if needed at all) seems the way to go.
DrahtBot added the label
Validation
on Apr 3, 2021
ryanofsky approved
ryanofsky
commented at 4:01 pm on April 3, 2021:
member
Code review ACKfafcddcd5311064c2e98679dd08be059ef25b318. All changes look good, but I don’t know when the bug happens in practice or how it was discovered.
Also it would be nice to have just the minimal fix and test together in same commit so it is more clear how the bug can be triggered and how it is fixed. Then it would be good to have the other cleanups in separate commits. IIUC:
The bugfix is the new if (!snapshot_start_block) check in PopulateAndValidateSnapshot, triggered by the new test passing base hash uint256::ONE.
Assert in GetUTXOStats adds an additional check at the point where the segfault previously happened
Removing the header wait loop is dead code removal and bit of a design change (good change breaking up a big function)
refactor: Prefer clean assert over UB in coinstatsfa8fffebe8
Fix assumeutxo crash due to missing base_blockhashfa9b74f5ea
MarcoFalke force-pushed
on Apr 4, 2021
MarcoFalke
commented at 5:40 am on April 4, 2021:
member
separate commits
Thanks, force pushed so that the Assert is a separate commit, no code changes.
DrahtBot
commented at 6:47 am on April 4, 2021:
member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, this pull request conflicts with the following ones:
#21584 (Fix assumeutxo crash due to invalid base_blockhash by MarcoFalke)
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
jamesob approved
jamesob
commented at 5:59 pm on April 5, 2021:
member
ryanofsky
commented at 1:39 am on April 6, 2021:
member
Code review ACKfa9b74f5ea89624e052934c48391b5076a87ffef with no code changes since last review, just splitting up combocommit a little.
This fixes an UB (which results in a crash with sanitizers enabled). Can be reproduced by cherry-picking the test without the other code changes.
Look good, though I’m curious if the crash was happening before the new test. Was the bug causing a different crash in another test? Or was it just discovered reading code?
MarcoFalke
commented at 6:13 am on April 6, 2021:
member
was it just discovered reading code?
This particular one was discovered by a fuzz target, which I wrote after I discovered a crash with code review: #21585
MarcoFalke merged this
on Apr 7, 2021
MarcoFalke closed this
on Apr 7, 2021
MarcoFalke deleted the branch
on Apr 7, 2021
sidhujag referenced this in commit
48fab0494b
on Apr 7, 2021
practicalswift
commented at 4:05 pm on April 9, 2021:
contributor
Post merge cr ACKfa9b74f5ea89624e052934c48391b5076a87ffef
was it just discovered reading code?
This particular one was discovered by a fuzz target, which I wrote after I discovered a crash with code review: #21585
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-12-19 00:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me