-
Notifications
You must be signed in to change notification settings - Fork 38.7k
qa: Initialize lockstack to prevent null pointer deref #13300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Fixes: #13263 |
|
Nice, thanks for this fix. I don't feel qualified to review the code change itself. But, I did verify that the patch appears to fix #13263 for me too. Thanks! |
|
If it's a static variable initialized at startup, maybe do away with the pointer? |
promag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Empact that should work but maybe consider this patch as a "fix". Also keeping it as a smart pointer is more flexible IMO.
utACK fa6a9b5.
src/sync.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess MakeUnique/std::make_unique is not that relevant here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, const static?
fa6a9b5 to
fa9da85
Compare
|
utACK fa9da85, statically allocated does look better. Not sure about the new variable name - is a static variable also global? |
|
utACK fa9da85 |
|
@promag My rule of thumb is "everything is a global unless it is a class member". Couldn't yet find any issues with that rule :p |
|
utACK fa9da85 |
|
Thread-local is a very special kind of global, but as for variable naming it's fine, it has global scope from the perspective of the compiler. utACK fa9da85 |
fa9da85 qa: Initialize lockstack to prevent null pointer deref (MarcoFalke) Pull request description: It is currently impossible to call debug methods such as `AssertLock(Not)Held` on a thread without running into undefined behavior, unless a lock was pushed on the stack in this thread. Initializing the global `lockstack` seems to fix both issues. Tree-SHA512: 8cb76b22cb31887ddf15742fdc790f01e8f04ed837367d0fd4996535748d124342e8bfde68952b903847b96ad33406c64907a53ebab9646f78d97fa4365c3061
Github-Pull: bitcoin#13300 Rebased-From: fa9da85
Github-Pull: bitcoin#13300 Rebased-From: fa9da85
… deref fa9da85 qa: Initialize lockstack to prevent null pointer deref (MarcoFalke) Pull request description: It is currently impossible to call debug methods such as `AssertLock(Not)Held` on a thread without running into undefined behavior, unless a lock was pushed on the stack in this thread. Initializing the global `lockstack` seems to fix both issues. Tree-SHA512: 8cb76b22cb31887ddf15742fdc790f01e8f04ed837367d0fd4996535748d124342e8bfde68952b903847b96ad33406c64907a53ebab9646f78d97fa4365c3061
It is currently impossible to call debug methods such as
AssertLock(Not)Heldon a thread without running into undefined behavior, unless a lock was pushed on the stack in this thread.Initializing the global
lockstackseems to fix both issues.