Skip to content

wasm: Fix potential segfault when reading filter_state#17880

Merged
ggreenway merged 1 commit intoenvoyproxy:mainfrom
lavignes:fix-wasm-segfault
Dec 3, 2021
Merged

wasm: Fix potential segfault when reading filter_state#17880
ggreenway merged 1 commit intoenvoyproxy:mainfrom
lavignes:fix-wasm-segfault

Conversation

@lavignes
Copy link
Copy Markdown
Contributor

Signed-off-by: Scott LaVigne lavignes@amazon.com

Commit Message: Fix potential segfault when reading filter_state
Additional Description: Adding a needed null-check when reading the filter_state property from a WASM filter.
Risk Level: low
Testing: I have a repro for the crash and tested the fix via: https://github.com/lavignes/proxy-wasm-crash-example
Docs Changes: n/a
Release Notes: n/a
Platform Specific Features: n/a

I was experimenting with a WASM network filter and ran into a case where my WASM plugin was crashing Envoy. Here's a minimal repro: https://github.com/lavignes/proxy-wasm-crash-example. I also got confirmation by @PiotrSikora that it would be safe to just open a PR publicly.

Other properties check for non-null `info` before attempting
to read since it can be null.

Signed-off-by: LaVigne, Scott <lavignes@amazon.com>
Copy link
Copy Markdown
Contributor

@kyessenov kyessenov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it would be good to have a test for the crash. I assume it's calling out during configuration or creationg.

Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, code LGTM, but like @kyessenov said, a test case would be appreciated.

Take a look at test/extensions/filters/network/wasm/test_data/close_stream_rust.rs and how it's used in tests - you can do pretty much the same with your reproducer.

@lavignes
Copy link
Copy Markdown
Contributor Author

lavignes commented Aug 26, 2021

Of course. Let me add a test. I wasn't sure where this was tested but after @kyessenov called this out, I figured it out. I'll update this :)

@mathetake
Copy link
Copy Markdown
Member

kindly ping @lavignes, are you still around to add tests here?

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot added the stale stalebot believes this issue/PR has not been touched recently label Oct 22, 2021
Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this in (since it's a real issue) and we can add tests in a follow-up PR.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 3, 2021

This pull request has been automatically closed because it has not had activity in the last 37 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@github-actions github-actions bot closed this Nov 3, 2021
@PiotrSikora
Copy link
Copy Markdown
Contributor

@envoyproxy/senior-maintainers could someone reopen this and merge it? Thanks!

@ggreenway ggreenway reopened this Dec 3, 2021
@github-actions github-actions bot removed the stale stalebot believes this issue/PR has not been touched recently label Dec 3, 2021
Copy link
Copy Markdown
Member

@ggreenway ggreenway left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving per @PiotrSikora 's approval as extension owner.

@ggreenway ggreenway enabled auto-merge (squash) December 3, 2021 00:03
@ggreenway ggreenway merged commit e2e0a74 into envoyproxy:main Dec 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants