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

[CLOSED] Verify operand stack check #12

Closed
aionbot opened this issue Dec 4, 2018 · 4 comments
Closed

[CLOSED] Verify operand stack check #12

aionbot opened this issue Dec 4, 2018 · 4 comments

Comments

@aionbot
Copy link

aionbot commented Dec 4, 2018

Issue created by yulongaion (on Wednesday May 09, 2018 at 14:02 GMT)

Write a test case to verify the behavior the following opcodes

push
push
push
jump 0

Make sure it won't break our assumption over the total stack size measurement

@aionbot
Copy link
Author

aionbot commented Dec 4, 2018

Comment by JunhanHu-aion (on Wednesday May 09, 2018 at 17:42 GMT)

Can confirm that java.lang.VerifyError will be raised by VM in case of a operand stack overflow.
I'm investigating how to properly use asm library to set the max operand stack size. MethodVisitor.visitMaxs() seems not setting the limit as we intended.

@aionbot
Copy link
Author

aionbot commented Dec 4, 2018

Comment by jeff-aion (on Wednesday May 09, 2018 at 18:00 GMT)

I believe that is over-ridden by built-in ASM logic, via new ClassWriter(ClassWriter.COMPUTE_FRAMES);
We might need that for things other than operand stack and variable count, though. I think it is also used to compute the stack map, which is probably tricky to do manually.

@aionbot
Copy link
Author

aionbot commented Dec 4, 2018

Comment by JunhanHu-aion (on Wednesday May 09, 2018 at 21:25 GMT)

Test created as org.aion.avm.core.instrument.BytecodeVerificationTest
Local variable table overflow and Operand stack overflow can be detected by JVM before execution.

@aionbot
Copy link
Author

aionbot commented Dec 4, 2018

Comment by JunhanHu-aion (on Thursday May 10, 2018 at 15:47 GMT)

Confirmed the loop cases wont break the verifier. Stack map frame can stop the loop from keeping push to the operand stack. Test cases created inside BVT.

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

No branches or pull requests

2 participants