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

stack overflow handler specific openbsd change. #87528

Merged
merged 1 commit into from
Oct 9, 2021
Merged

stack overflow handler specific openbsd change. #87528

merged 1 commit into from
Oct 9, 2021

Conversation

devnexen
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Collaborator

r? @joshtriplett

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 27, 2021
@rust-log-analyzer

This comment has been minimized.

@@ -143,11 +143,17 @@ mod imp {
}

unsafe fn get_stackp() -> *mut libc::c_void {
#[cfg(target_os = "openbsd")]
let flags = MAP_PRIVATE | MAP_ANON | libc::MAP_STACK;
// OpenBSD requires this flag for stack mapping
Copy link
Member

Choose a reason for hiding this comment

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

"this flag" is referring to MAP_STACK? If so the comment is on the wrong line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed :)

@the8472
Copy link
Member

the8472 commented Jul 27, 2021

The PR title and description could use some improvement. After all every commit implicitly is a change. And why is it needed? Is OpenBSD broken without it or is it only a correctness fix that currently doesn't make a difference but may do so in the future? If it's the latter shouldn't it also be applied on linux since the manpage there says that

However, by employing this flag, applications can ensure that they transparently obtain support if the flag is implemented in the future.

0,
);
// OpenBSD requires this flag for stack mapping
// otherwise the said mapping will fail is a no-op in most systems
Copy link
Member

Choose a reason for hiding this comment

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

s/is/as

Copy link
Member

Choose a reason for hiding this comment

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

s/in/on
reads nicer I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure thing

#[cfg(target_os = "openbsd")]
let flags = MAP_PRIVATE | MAP_ANON | libc::MAP_STACK;
#[cfg(not(target_os = "openbsd"))]
let flags = MAP_PRIVATE | MAP_ANON;
Copy link
Member

Choose a reason for hiding this comment

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

Linux supports MAP_STACK too. It is a no-op on all architectures. FreeBSD supports it too. For example macOS doesn't support it though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes but not necessary on these oses plus solaris/illumos does not have it and I believe haiku neither.

Copy link
Member

Choose a reason for hiding this comment

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

yes but not necessary

Not currently necessary. A future architecture may need it. That is why it exists as no-op at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok can add for linux, netbsd but I m less sure about FreeBSD the flag is working but does not seem to work well with null start addresses, seems little usage difference.

On this platform, when doing stack allocation, MAP_STACK is needed
 otherwise the mapping fails.
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 15, 2021
@inquisitivecrystal inquisitivecrystal added T-libs Relevant to the library team, which will review and decide on the PR/issue. O-openbsd Operating system: OpenBSD labels Aug 24, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 13, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 3, 2021
@joshtriplett
Copy link
Member

Seems reasonable, and consistent with the OpenBSD documentation.

@bors r+

@bors
Copy link
Contributor

bors commented Oct 4, 2021

📌 Commit 853ffc7 has been approved by joshtriplett

@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 Oct 4, 2021
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 4, 2021
stack overflow handler specific openbsd change.
@workingjubilee
Copy link
Member

workingjubilee commented Oct 4, 2021

Appears to not work with all Unix libcs? #89529

[RUSTC-TIMING] addr2line test:false 0.596
[RUSTC-TIMING] core test:false 27.851
[RUSTC-TIMING] gimli test:false 6.055
[RUSTC-TIMING] object test:false 6.197
error[E0425]: cannot find value `MAP_STACK` in crate `libc`
   --> library/std/src/sys/unix/stack_overflow.rs:150:52
    |
150 |         let flags = MAP_PRIVATE | MAP_ANON | libc::MAP_STACK;
    |                                                    ^^^^^^^^^ not found in `libc`
For more information about this error, try `rustc --explain E0425`.
[RUSTC-TIMING] std test:false 2.972
error: could not compile `std` due to previous error
Build completed unsuccessfully in 0:06:57

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 4, 2021
@devnexen
Copy link
Contributor Author

devnexen commented Oct 4, 2021

it might needs a libc update ... it is present since the 0.2.102 release (or updating the current PR to not enabling on netbsd).

@devnexen
Copy link
Contributor Author

devnexen commented Oct 4, 2021

having lost the original repo since, I opted for libc update, anyway it would have been needed at some point.

devnexen added a commit to devnexen/rust that referenced this pull request Oct 5, 2021
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 6, 2021
…d, r=dtolnay

library std, libc dependency update

to solve rust-lang#87528 build.
Manishearth added a commit to Manishearth/rust that referenced this pull request Oct 6, 2021
…d, r=dtolnay

library std, libc dependency update

to solve rust-lang#87528 build.
@JohnTitor
Copy link
Member

The libc dependency now has been updated, @bors r=joshtriplett

@bors
Copy link
Contributor

bors commented Oct 7, 2021

📌 Commit 853ffc7 has been approved by joshtriplett

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 7, 2021
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 8, 2021
stack overflow handler specific openbsd change.
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Oct 9, 2021
stack overflow handler specific openbsd change.
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 9, 2021
…laumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#75644 (Add 'core::array::from_fn' and 'core::array::try_from_fn')
 - rust-lang#87528 (stack overflow handler specific openbsd change.)
 - rust-lang#88436 (std: Stabilize command_access)
 - rust-lang#89614 (Update to Unicode 14.0)
 - rust-lang#89664 (Add documentation to boxed conversions)
 - rust-lang#89700 (Fix invalid HTML generation for higher bounds)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3e4f956 into rust-lang:master Oct 9, 2021
@rustbot rustbot added this to the 1.57.0 milestone Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-openbsd Operating system: OpenBSD S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.