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

Rollup of 9 pull requests #127892

Merged
merged 31 commits into from
Jul 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
2f305ff
Remove an unnecessary `?`.
nnethercote Jul 16, 2024
48cdfc3
Inline `Parser::parse_item_common_`.
nnethercote Jul 16, 2024
d247489
Reorder `Parser::parse_expr_dot_or_call_with` arguments.
nnethercote Jul 16, 2024
96cc9c9
Inline and remove `Parser::parse_and_disallow_postfix_after_cast`.
nnethercote Jul 16, 2024
96b39f1
Inline and remove `Parser::parse_expr_dot_or_call_with_`.
nnethercote Jul 16, 2024
8cb6bc3
Fix a comment.
nnethercote Jul 16, 2024
9c4f3db
Remove references to `maybe_whole_expr`.
nnethercote Jul 16, 2024
17c70a9
unix: split stack_overflow::install_main_guard by os
workingjubilee Jul 17, 2024
e285c95
unix: stack_start_aligned is a safe fn
workingjubilee Jul 17, 2024
6ed563d
unix: clean up install_main_guard_freebsd
workingjubilee Jul 17, 2024
d47cb26
unix: unsafe-wrap install_main_guard_default
workingjubilee Jul 17, 2024
21dc49c
ptr::metadata: avoid references to extern types
RalfJung Jul 17, 2024
f9c0d33
ptr::metadata: update comment on vtable_ptr work-around
RalfJung Jul 17, 2024
99f879c
Document the column numbers for the dbg! macro
Kriskras99 Jul 17, 2024
1d40d4c
Fix precise capturing suggestion for hidden type when APITs are involved
compiler-errors Jul 12, 2024
f3f0b57
Commonize `uname -m` results for `aarch64` in docker runner
tgross35 Jul 16, 2024
e1852d0
Unignore cg_gcc fmt
GuillaumeGomez Jul 12, 2024
261d92c
Align cg_gcc rustfmt.toml with rust's
GuillaumeGomez Jul 17, 2024
12bedc3
Ignore files in cg_gcc example folder
GuillaumeGomez Jul 17, 2024
213782d
Format cg_gcc with same formatting parameters
GuillaumeGomez Jul 17, 2024
553279b
Add support for literals
c410-f3r Jul 17, 2024
37257b4
style-guide: Clarify version-sorting
joshtriplett Jul 17, 2024
e6f0caf
Rollup merge of #127542 - c410-f3r:concat-again, r=petrochenkov
tgross35 Jul 18, 2024
973d92c
Rollup merge of #127652 - GuillaumeGomez:cg-gcc-fmt, r=Urgau
tgross35 Jul 18, 2024
b5771e7
Rollup merge of #127664 - compiler-errors:precise-capturing-better-su…
tgross35 Jul 18, 2024
fa13036
Rollup merge of #127806 - nnethercote:parser-improvements, r=spastorino
tgross35 Jul 18, 2024
d76ec07
Rollup merge of #127828 - tgross35:docker-aarch64-uname, r=onur-ozkan
tgross35 Jul 18, 2024
3c4f820
Rollup merge of #127845 - workingjubilee:actually-break-up-big-ass-st…
tgross35 Jul 18, 2024
c36a39c
Rollup merge of #127859 - RalfJung:ptr-dyn-metadata, r=scottmcm
tgross35 Jul 18, 2024
8bb0578
Rollup merge of #127861 - Kriskras99:patch-1, r=tgross35
tgross35 Jul 18, 2024
7c63526
Rollup merge of #127875 - joshtriplett:style-guide-clarify-sorting, r…
tgross35 Jul 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
unix: unsafe-wrap install_main_guard_default
workingjubilee committed Jul 17, 2024
commit d47cb26ddd6574de6c81caf9fdaadef1a108628a
21 changes: 12 additions & 9 deletions library/std/src/sys/pal/unix/stack_overflow.rs
Original file line number Diff line number Diff line change
@@ -419,6 +419,7 @@ mod imp {
Some(stackaddr - page_size..stackaddr)
}

#[forbid(unsafe_op_in_unsafe_fn)]
unsafe fn install_main_guard_default(page_size: usize) -> Option<Range<usize>> {
// Reallocate the last page of the stack.
// This ensures SIGBUS will be raised on
@@ -429,19 +430,21 @@ mod imp {
// read/write permissions and only then mprotect() it to
// no permissions at all. See issue #50313.
let stackptr = stack_start_aligned(page_size)?;
let result = mmap64(
stackptr,
page_size,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON | MAP_FIXED,
-1,
0,
);
let result = unsafe {
mmap64(
stackptr,
page_size,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON | MAP_FIXED,
-1,
0,
)
};
if result != stackptr || result == MAP_FAILED {
panic!("failed to allocate a guard page: {}", io::Error::last_os_error());
}

let result = mprotect(stackptr, page_size, PROT_NONE);
let result = unsafe { mprotect(stackptr, page_size, PROT_NONE) };
if result != 0 {
panic!("failed to protect the guard page: {}", io::Error::last_os_error());
}