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 segfaults in release build C-variadic fns #58985

Merged
merged 1 commit into from
Mar 9, 2019

Conversation

dlrobertson
Copy link
Contributor

@dlrobertson dlrobertson commented Mar 7, 2019

va_start and va_end must be called to initialize/cleanup the
"spoofed" VaList in a Rust defined C-variadic function even if
the VaList is not used.

r? @alexreg
Fixes: #58980

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 7, 2019
@dlrobertson
Copy link
Contributor Author

dlrobertson commented Mar 7, 2019

@alexreg #58980 is actually very similar to that ICE I hit towards the end of the development of the original PR. I took the wrong route in fixing it which allows the segfault to happen. The segfault occurs because the "spoofed" VaList is not initalized with va_start nor is it cleaned up with va_end, but the user can still pass the VaList argument to functions within the Rust defined C-variadic function.

@dlrobertson dlrobertson force-pushed the fix_58980 branch 2 times, most recently from 6abae8c to 1c47274 Compare March 7, 2019 05:06
`va_start` and `va_end` must be called to initialize/cleanup the
"spoofed" `VaList` in a Rust defined C-variadic function even if
the `VaList` is not used.
@alexreg
Copy link
Contributor

alexreg commented Mar 7, 2019

@bors r+ p=1 fixes feature that is broken in release mode

@bors
Copy link
Contributor

bors commented Mar 7, 2019

📌 Commit 1d72037 has been approved by alexreg

@bors
Copy link
Contributor

bors commented Mar 7, 2019

🌲 The tree is currently closed for pull requests below priority 500, this pull request will be tested once the tree is reopened

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 7, 2019
@bors
Copy link
Contributor

bors commented Mar 8, 2019

⌛ Testing commit 1d72037 with merge b2ea6c8...

bors added a commit that referenced this pull request Mar 8, 2019
Fix segfaults in release build C-variadic fns

`va_start` and `va_end` must be called to initialize/cleanup the
"spoofed" `VaList` in a Rust defined C-variadic function even  if
the `VaList` is not used.

r? @alexreg
Fixes: #58980
@bors
Copy link
Contributor

bors commented Mar 9, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: alexreg
Pushing b2ea6c8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 9, 2019
@bors bors merged commit 1d72037 into rust-lang:master Mar 9, 2019
@dlrobertson dlrobertson deleted the fix_58980 branch March 9, 2019 02:36
@workingjubilee workingjubilee added the F-c_variadic `#![feature(c_variadic)]` label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-c_variadic `#![feature(c_variadic)]` merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segfault when using C compatible variadic functions
5 participants