1
- //@ revisions: all strong basic none missing
1
+ //@ revisions: all strong basic none missing rusty
2
2
//@ assembly-output: emit-asm
3
3
//@ only-windows
4
4
//@ only-msvc
5
5
//@ ignore-32bit 64-bit table based SEH has slightly different behaviors than classic SEH
6
6
//@ [all] compile-flags: -Z stack-protector=all
7
+ //@ [rusty] compile-flags: -Z stack-protector=rusty
7
8
//@ [strong] compile-flags: -Z stack-protector=strong
8
9
//@ [basic] compile-flags: -Z stack-protector=basic
9
10
//@ [none] compile-flags: -Z stack-protector=none
@@ -21,6 +22,8 @@ pub fn emptyfn() {
21
22
// basic-NOT: __security_check_cookie
22
23
// none-NOT: __security_check_cookie
23
24
// missing-NOT: __security_check_cookie
25
+
26
+ // rusty-NOT: __security_check_cookie
24
27
}
25
28
26
29
// CHECK-LABEL: array_char
@@ -39,6 +42,8 @@ pub fn array_char(f: fn(*const char)) {
39
42
// basic: __security_check_cookie
40
43
// none-NOT: __security_check_cookie
41
44
// missing-NOT: __security_check_cookie
45
+
46
+ // rusty: __security_check_cookie
42
47
}
43
48
44
49
// CHECK-LABEL: array_u8_1
@@ -55,6 +60,8 @@ pub fn array_u8_1(f: fn(*const u8)) {
55
60
// basic-NOT: __security_check_cookie
56
61
// none-NOT: __security_check_cookie
57
62
// missing-NOT: __security_check_cookie
63
+
64
+ // rusty: __security_check_cookie
58
65
}
59
66
60
67
// CHECK-LABEL: array_u8_small:
@@ -72,6 +79,8 @@ pub fn array_u8_small(f: fn(*const u8)) {
72
79
// basic-NOT: __security_check_cookie
73
80
// none-NOT: __security_check_cookie
74
81
// missing-NOT: __security_check_cookie
82
+
83
+ // rusty: __security_check_cookie
75
84
}
76
85
77
86
// CHECK-LABEL: array_u8_large:
@@ -88,6 +97,8 @@ pub fn array_u8_large(f: fn(*const u8)) {
88
97
// basic: __security_check_cookie
89
98
// none-NOT: __security_check_cookie
90
99
// missing-NOT: __security_check_cookie
100
+
101
+ // rusty: __security_check_cookie
91
102
}
92
103
93
104
#[ derive( Copy , Clone ) ]
@@ -107,6 +118,8 @@ pub fn array_bytesizednewtype_9(f: fn(*const ByteSizedNewtype)) {
107
118
// basic: __security_check_cookie
108
119
// none-NOT: __security_check_cookie
109
120
// missing-NOT: __security_check_cookie
121
+
122
+ // rusty: __security_check_cookie
110
123
}
111
124
112
125
// CHECK-LABEL: local_var_addr_used_indirectly
@@ -134,6 +147,8 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) {
134
147
// basic-NOT: __security_check_cookie
135
148
// none-NOT: __security_check_cookie
136
149
// missing-NOT: __security_check_cookie
150
+
151
+ // rusty: __security_check_cookie
137
152
}
138
153
139
154
// CHECK-LABEL: local_string_addr_taken
@@ -172,6 +187,8 @@ pub fn local_string_addr_taken(f: fn(&String)) {
172
187
// none-NOT: __security_check_cookie
173
188
// missing-NOT: __security_check_cookie
174
189
190
+ // rusty-NOT: __security_check_cookie
191
+
175
192
// CHECK-DAG: .seh_endproc
176
193
}
177
194
@@ -202,6 +219,9 @@ pub fn local_var_addr_taken_used_locally_only(factory: fn() -> i32, sink: fn(i32
202
219
// basic-NOT: __security_check_cookie
203
220
// none-NOT: __security_check_cookie
204
221
// missing-NOT: __security_check_cookie
222
+
223
+ // FIXME: rusty stack smash protection needs to support inline scenario detection
224
+ // rusty: __security_check_cookie
205
225
}
206
226
207
227
pub struct Gigastruct {
@@ -239,6 +259,9 @@ pub fn local_large_var_moved(f: fn(Gigastruct)) {
239
259
// basic: __security_check_cookie
240
260
// none-NOT: __security_check_cookie
241
261
// missing-NOT: __security_check_cookie
262
+
263
+ // TODO: How does the rust compiler handle moves of large structures?
264
+ // rusty-NOT: __security_check_cookie
242
265
}
243
266
244
267
// CHECK-LABEL: local_large_var_cloned
@@ -268,6 +291,9 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
268
291
// basic: __security_check_cookie
269
292
// none-NOT: __security_check_cookie
270
293
// missing-NOT: __security_check_cookie
294
+
295
+ // TODO: How does the rust compiler handle moves of large structures?
296
+ // rusty-NOT: __security_check_cookie
271
297
}
272
298
273
299
extern "C" {
@@ -308,6 +334,11 @@ pub fn alloca_small_compile_time_constant_arg(f: fn(*mut ())) {
308
334
// basic-NOT: __security_check_cookie
309
335
// none-NOT: __security_check_cookie
310
336
// missing-NOT: __security_check_cookie
337
+
338
+ // TODO: Rusty thinks a function that returns a mutable raw pointer may
339
+ // be a stack memory allocation function, so it performs stack smash protection.
340
+ // Is it possible to optimize the heuristics?
341
+ // rusty: __security_check_cookie
311
342
}
312
343
313
344
// CHECK-LABEL: alloca_large_compile_time_constant_arg
@@ -320,6 +351,11 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
320
351
// basic-NOT: __security_check_cookie
321
352
// none-NOT: __security_check_cookie
322
353
// missing-NOT: __security_check_cookie
354
+
355
+ // TODO: Rusty thinks a function that returns a mutable raw pointer may
356
+ // be a stack memory allocation function, so it performs stack smash protection.
357
+ // Is it possible to optimize the heuristics?
358
+ // rusty: __security_check_cookie
323
359
}
324
360
325
361
// CHECK-LABEL: alloca_dynamic_arg
@@ -332,6 +368,11 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
332
368
// basic-NOT: __security_check_cookie
333
369
// none-NOT: __security_check_cookie
334
370
// missing-NOT: __security_check_cookie
371
+
372
+ // TODO: Rusty thinks a function that returns a mutable raw pointer may
373
+ // be a stack memory allocation function, so it performs stack smash protection.
374
+ // Is it possible to optimize the heuristics?
375
+ // rusty: __security_check_cookie
335
376
}
336
377
337
378
// The question then is: in what ways can Rust code generate array-`alloca`
@@ -364,6 +405,8 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
364
405
// basic-NOT: __security_check_cookie
365
406
// none-NOT: __security_check_cookie
366
407
// missing-NOT: __security_check_cookie
408
+
409
+ // rusty-NOT: __security_check_cookie
367
410
}
368
411
369
412
// CHECK-LABEL: unsized_local
@@ -388,4 +431,6 @@ pub fn unsized_local(s: &[u8], l: bool, f: fn(&mut [u8])) {
388
431
389
432
// none-NOT: __security_check_cookie
390
433
// missing-NOT: __security_check_cookie
434
+
435
+ // rusty-NOT: __security_check_cookie
391
436
}
0 commit comments