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 integer overflow in BPF conditional jumps #9

Merged
merged 3 commits into from
Apr 10, 2019

Conversation

starius
Copy link
Contributor

@starius starius commented Apr 1, 2019

If the list of syscalls is too long (>256) then the library sends incorrect
BPF code and this results in crashes, because some syscalls are denied. This
commit fixes the crash by splitting the list of syscalls into groups of
size 256 in Policy.Assemble. Also I found another similar overflow in
SyscallGroup.Assemble and fixed it as well.

@andrewkroh
Copy link
Member

@starius Thanks for the patch. Would it be possible for you to add a test case to filter_test.go for this issue. Having a test case will help with reviewing and prevent a future regression. Thanks!

@andrewkroh andrewkroh added review Ready for reviews bug Something isn't working labels Apr 1, 2019
If the list of syscalls is too long (>256) then the library sends incorrect
BPF code and this results in crashes, because some syscalls are denied. This
commit fixes the crash by splitting the list of syscalls into groups of
size 256 in Policy.Assemble. Also I found another similar overflow in
SyscallGroup.Assemble and fixed it as well.
@starius
Copy link
Contributor Author

starius commented Apr 2, 2019

@andrewkroh tests added.

@starius
Copy link
Contributor Author

starius commented Apr 9, 2019

@andrewkroh
Ping :-)

@andrewkroh andrewkroh merged commit 083a05f into elastic:master Apr 10, 2019
@andrewkroh
Copy link
Member

I looked over the generated byte code and everything LGTM. Thank you!

@starius starius deleted the fix-overflow branch April 10, 2019 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working review Ready for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants