Conversation
c42f
left a comment
There was a problem hiding this comment.
I need some more context here. In what circumstances can we have bt_size == 0? I assume this is valid (or at least unavoidable) in come cases?
I'd argue that we should be preserving the exception on the stack, even if we couldn't capture the backtrace.
Fair enough the context I have encountered this in is #33255. Looking at it again it originates from: Lines 253 to 255 in 3f5d56a Which is a |
Codecov Report
@@ Coverage Diff @@
## master #33259 +/- ##
=======================================
Coverage 75.78% 75.78%
=======================================
Files 380 380
Lines 66452 66452
=======================================
Hits 50359 50359
Misses 16093 16093Continue to review full report at Codecov.
|
c42f
left a comment
There was a problem hiding this comment.
Oh, I see. I did follow your xref originally but I somehow failed to see your comment and I got confused. Sorry about that!
So this is the safe_restore codepath... yes, the assert is invalid in that case. I'm fine with just removing it, though it would probably make a tad more sense to change it to
assert((e && ptls->bt_size != 0) || ptls->safe_restore);if you can be bothered. Either way I'm happy.
I was thinking about that, but it would make more sense to me to add this invariant close to where it is needed. |
|
Good point. The tricky thing is that this was trying to check an invariant on data coming out of the signal handlers. Hence having it in sig throw is the first place it could intercept that program state. But I messed it up for the exact reason you describe! |
x-ref: 31e76c2dc85#r35077818