-
Notifications
You must be signed in to change notification settings - Fork 5
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
Parse abort in Modernish under virtualization #5
Comments
From running Modernish in a Vagrant VM. |
NB that it seems to always be the exact same failure, i.e., a bad call to (Why is it okay on native... built without some stack protections? Virtualization catches memory errors?) |
I'm running it on native GNU/Linux and the crash happens even though the install script does not report it. I had to run Smallest and simplest reproducer I found, which also happens to be a close approximation of what went through my head trying to debug this:
Both |
lol! Thanks for finding a reproducer for this---I've been trying to find the root cause of this bug for some time, and this is a helpful lead. That reproducer closely matches my feelings about this bug, too. The stackmarks are allocation lists rooted in the C call stack. I suspect that the core bug is that allocating those stackmarks in OCaml breaks some invariants, since GC will eventually relocate them. (But the crashes are predictable enough that I'm not 100% confident that's what's happening.) In any case, popping should be idempotent: popping means "unroll all allocations up to here". Maybe a double free is corrupting things? |
Adding: looking back at my stack trace above, it does seem like either a double free or a moved pointer... so the correct fix is most likely to avoid the double pop in the two |
On error, It looks like this:
If the reproducer is even a single character shorter, it no longer crashes as the input fits into the stackbase. In this case both The pop in |
Ahhhhhhh! (To paraphrase your reproducer.) Yes, I put it in as a "surely we can just pop all the back to the root stackmark on every parse", not thinking about reentrancy. I think you're right: your reproducer must be just big enough to force some allocations to exist past the root. I really appreciate you pushing away on this! It seems like the right choice here is to never pop in |
Running
./install -s smoosh
in Docker yields a parse abort. It's probably related to the other parse aborts we've seen, which I suspect is a mishandling of erroneous parsing ineval
.The text was updated successfully, but these errors were encountered: