-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
base: master
Are you sure you want to change the base?
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.
|
|
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
|
Edited. |
|
@bors r+ |
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 r? `@wesleywiser` (feel free to reassign) cc `@nikic,` `@rcvalle,` `@davidtwco,` `@arielb1,` `@Darksonn,` `@Noratrieb,` `@SparrowLii`
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
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
r? @wesleywiser (feel free to reassign)
cc @nikic, @rcvalle, @davidtwco, @arielb1, @Darksonn, @Noratrieb, @SparrowLii