10000 reorder variables on stack by roikol · Pull Request #1281 · aquasecurity/tracee · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

reorder variables on stack #1281

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

Merged
merged 2 commits into from
Dec 20, 2021
Merged

Conversation

roikol
Copy link
Contributor
@roikol roikol commented Dec 19, 2021

related to #1237
@yanivagman and i did some investigating on the bug.
we understood that the order of the variables on the stack solves the issue.
there's probably a bug somewhere with CORE+clang that creates some overflow or stack override.
changing the order of the variables avoids the override.

@roikol roikol requested a review from rafaeldtinoco December 19, 2021 15:05
Copy link
Collaborator
yanivagman commented Dec 19, 2021

This might be related to small amount of registers of BPF arch and the register pressure during compilation. That usually happens because of bound checks that, sometimes, use shadow registers to keep track of boundaries (afaict). When reorganizing the stack you mitigate the pressure and, sometimes, it helps indeed. CPU V3 is better at this afaik. Even if that is the case, it should be handled, or failed, at compilation time (instead of generation a faulty binary).

Yet this shouldn't cause a bug in functionality (wrong output), but possibly verifier issues. What we see here shouldn't happen. The fact that we change the order of the variables on the stack shouldn't cause the output to be different - there must be a bug somewhere related to CO-RE (in clang?), and it might be related to the registers allocation like you suggest. By the way, changing the optimization (0-3) didn't help with this issue

@yanivagman
Copy link
Collaborator

I'm going to merge this, but let's keep #1237 open until we figure out why this fixes it.
We should understand the root cause to avoid such bugs in the future

@yanivagman yanivagman merged commit be3ef0c into aquasecurity:main Dec 20, 2021
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

Successfully merging this pull request may close these issues.

3 participants
0