Skip to content
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

Fix the terrible Reloc info through disassembly hack #5

Open
vivanishin opened this issue Mar 11, 2016 · 0 comments
Open

Fix the terrible Reloc info through disassembly hack #5

vivanishin opened this issue Mar 11, 2016 · 0 comments

Comments

@vivanishin
Copy link
Member

During the lowering process we encounter pointers (object locations) which are to be encoded into the instruction stream (if we want to conform with what v8 already expects). For each of them a proper relocation info is created and attached to the Code object. The problem is in order to generate relocation info we have to know where in the instruction stream our pointer ends up. Which we only get to know after the code has been generated.

Our current implementation is OK for a proof-of-concept, but is not OK for production. We disassemle the code and search for mov imm64 and look if the immediate is in our map. This can cause bugs if we somehow end up having some constant (say, a bit mask coming from JS) equal to one of our addresses. The probability is very low. And this makes it really dangerous.

The proper approach is to use the patchpoint llvm intrinsic (or a similar new intrinsic just for that). Alternatively we can modify the format and parsing of Reloc info (stop having the pointer constatns in the instruction stream). See comments to this question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant