lua: align the allocated memory#6599
Merged
lizan merged 5 commits intoenvoyproxy:masterfrom Apr 16, 2019
Merged
Conversation
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Dhi Aurrahman <dio@tetrate.io> Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Member
|
@lizan do you think this will make those remaining ASAN issues I was encountering a while back go away? |
mattklein123
requested changes
Apr 16, 2019
Member
mattklein123
left a comment
There was a problem hiding this comment.
Thanks, glad to see this fixed. Few small comments.
/wait
| } | ||
|
|
||
| template <typename T> inline T* alignAndCast(void* mem) { | ||
| size_t size = maximumSpaceNeededToAlign<T>(); |
Member
There was a problem hiding this comment.
nit: const or just inline the call below.
Member
Author
There was a problem hiding this comment.
4th parameter of std::align takes size_t& so this cannot be a const or inlined.
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Member
Author
|
@htuch I missed you comment, what are the remaining ASAN issues? |
Member
Member
Author
|
@htuch possibly, let me try on that |
Member
|
Thanks @lizan 🙇 |
duderino
pushed a commit
to istio/envoy
that referenced
this pull request
Aug 13, 2019
Description: This patch aligns the memory that is allocated by Lua. Previously, without alignment, Envoy experienced segfault when constructing `StreamWrapperHandler` using the placement new operator on the pre-allocated (via `new_luauserdata` API) memory by Lua. Risk Level: Medium for Lua users. Testing: Enable test in UBSAN on Linux as well. Docs Changes: N/A Release Notes: N/A Fixes envoyproxy#5551 Signed-off-by: Lizan Zhou <lizan@tetrate.io> Signed-off-by: Piotr Sikora <piotrsikora@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
This patch aligns the memory that is allocated by Lua. Previously, without alignment, Envoy experienced segfault when constructing
StreamWrapperHandlerusing the placement new operator on the pre-allocated (vianew_luauserdataAPI) memory by Lua.Risk Level: Medium for Lua users.
Testing: Enable test in UBSAN on Linux as well.
Docs Changes: N/A
Release Notes: N/A
Fixes #5551