-
Notifications
You must be signed in to change notification settings - Fork 14k
More robust stack protector testing #147115
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
Conversation
|
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I'm looking this and gonna give some comments, expecting in the next week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please split the PR into multiple commits according to the logical organization of the test, which makes it easier for others to review.
And if your tests are coming from llvm tests, could you write something like a sheet to explain if these result in rustc are all expected?
| fn dummy(_: ...) -> i32; | ||
|
|
||
| static STR: [u8; 1]; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comments about why we need these extern functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names of these functions have no special meaning; they simply correspond to the corresponding test functions in LLVM, because parameter passing checks are also an important part of checking whether stack protector is working properly (e.g., sspstrong).
| // #[repr(C)] | ||
| // struct A { | ||
| // data: [u8; 2], | ||
| // } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these code left here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edited. Because it became unnecessary due to unnecessary testing.
| } | ||
|
|
||
| // Note: test2 | ||
| // struct -> flat aggregate -> array |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These codes too, please add some comments to explain why keep these codes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The corresponding comments have been removed. The following explains why these tests are considered unnecessary.
test2/4: The struct structures in test2 and test4 will be "flat aggregated" into arrays, becoming identical to those in test1 and test3.
test17: There is no such type in rustc corresponding to '%struct.vec = type { <4 x i32> }' in LLVM.
test22: [2 x i8] in struct will be automatically optimized to i16 and will not trigger the sspstrong.
test23: [2 x i8] nested in several layers of structs and unions: same as test22.
test24: Variable sized alloca (VLA): see https://github.com/rust-lang/rfcs/pull/1909
test28/29/30/31: These tests were originally used to verify whether the 'basic' mode worked correctly. Since the community has decided to remove the 'basic' mode, these tests will also become useless.
|
|
||
| // CHECK-LABEL: test3{{:|\[}} | ||
| #[no_mangle] | ||
| pub fn test3(a: *const u8) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make these test function names more meaningful? Or add some comments to explain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each function has been commented accordingly.
This comment has been minimized.
This comment has been minimized.
| // test3: array [4 x i8] | ||
| // CHECK-LABEL: test3{{:|\[}} | ||
| #[no_mangle] | ||
| pub fn test3(a: *const u8) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we delete some unneccesary tests, I think these function names are no need to be consistent with ones in llvm's tests. You can just name test2 or test_array4_i8.
Same for all functiosn below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, I'd like to r+ this after fixing nits for test function names
|
💔 Test for 63674d8 failed: CI. Failed jobs:
|
This comment has been minimized.
This comment has been minimized.
This is strange, as the KNOWN_DIRECTIVE_NAMES list shows an entry for "ignore-wasm-bare", but I changed it to "ignore-wasm32" to avoid a panic. |
|
@bors try jobs=test-various,x86_64-gnu-llvm-21-3 |
This comment has been minimized.
This comment has been minimized.
More robust stack protector testing try-job: test-various try-job: x86_64-gnu-llvm-21-3
This comment has been minimized.
This comment has been minimized.
|
💔 Test for 29e7f4d failed: CI. Failed jobs:
|
|
For safe stack problem I think you can raise a new issue about it, with a |
Done. See in PR description |
|
@bors try jobs=test-various,x86_64-gnu-llvm-21-3 |
This comment has been minimized.
This comment has been minimized.
More robust stack protector testing try-job: test-various try-job: x86_64-gnu-llvm-21-3
|
@cezarbbb Can you squash the commits? |
This comment has been minimized.
This comment has been minimized.
|
|
@bors r+ |
Rollup of 12 pull requests Successful merges: - #147115 (More robust stack protector testing) - #148048 (Stabilize `maybe_uninit_write_slice`) - #148641 (Add a diagnostic attribute for special casing const bound errors for non-const impls) - #149074 (Add Command::get_env_clear) - #149097 (num: Implement `uint_gather_scatter_bits` feature for unsigned integers) - #149131 (optimize `slice::Iter::next_chunk`) - #149190 (Forbid `CHECK: br` and `CHECK-NOT: br` in codegen tests (suggest `br {{.*}}` instead)) - #149239 (clarify float min/max behavios for NaNs and signed zeros) - #149243 (Fix typo and clarify bootstrap change tracker entry) - #149301 (Motor OS: make decode_error_kind more comprehensive) - #149306 (bootstrap: Miri now handles jemalloc like everything else) - #149325 (rustdoc: add regression test for #140968) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #147115 - cezarbbb:stable_ssp, r=SparrowLii More robust stack protector testing I've added some tests related to the stack protector. These tests were originally in the LLVM stack protector test project. These tests were written for the "Stabilize stack-protector" proposal, and therefore removed the "stack-protector=basic" test option, as this stack protector was considered ineffective in Rust. For the proposal, see: #146369 For the discussion, see zulip: https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Proposal.20for.20Adapt.20Stack.20Protector.20for.20Ru.E2.80.A6.20compiler-team.23841 I have opened an issue to discuss the 'abi_mismatch' issue I encountered while writing tests for the coexistence of 'stack-protector' and 'safe-stack': #149340 r? `@wesleywiser` (feel free to reassign) cc `@nikic,` `@rcvalle,` `@davidtwco,` `@arielb1,` `@Darksonn,` `@Noratrieb,` `@SparrowLii`
I've added some tests related to the stack protector. These tests were originally in the LLVM stack protector test project.
These tests were written for the "Stabilize stack-protector" proposal, and therefore removed the "stack-protector=basic" test option, as this stack protector was considered ineffective in Rust.
For the proposal, see: #146369
For the discussion, see zulip: https://rust-lang.zulipchat.com/#narrow/channel/233931-t-compiler.2Fmajor-changes/topic/Proposal.20for.20Adapt.20Stack.20Protector.20for.20Ru.E2.80.A6.20compiler-team.23841
I have opened an issue to discuss the 'abi_mismatch' issue I encountered while writing tests for the coexistence of 'stack-protector' and 'safe-stack': #149340
r? @wesleywiser (feel free to reassign)
cc @nikic, @rcvalle, @davidtwco, @arielb1, @Darksonn, @Noratrieb, @SparrowLii