@@ -37,23 +37,9 @@ pub fn array_char(f: fn(*const char)) {
37
37
f ( & b as * const _ ) ;
38
38
f ( & c as * const _ ) ;
39
39
40
- // Any type of local array variable leads to stack protection with the
41
- // "strong" heuristic. The 'basic' heuristic only adds stack protection to
42
- // functions with local array variables of a byte-sized type, however. Since
43
- // 'char' is 4 bytes in Rust, this function is not protected by the 'basic'
44
- // heuristic
45
- //
46
- // (This test *also* takes the address of the local stack variables. We
47
- // cannot know that this isn't what triggers the `strong` heuristic.
48
- // However, the test strategy of passing the address of a stack array to an
49
- // external function is sufficient to trigger the `basic` heuristic (see
50
- // test `array_u8_large()`). Since the `basic` heuristic only checks for the
51
- // presence of stack-local array variables, we can be confident that this
52
- // test also captures this part of the `strong` heuristic specification.)
53
-
54
40
// all: __security_check_cookie
55
41
// strong: __security_check_cookie
56
- // basic-NOT : __security_check_cookie
42
+ // basic: __security_check_cookie
57
43
// none-NOT: __security_check_cookie
58
44
// missing-NOT: __security_check_cookie
59
45
}
@@ -231,8 +217,8 @@ pub fn local_large_var_moved(f: fn(Gigastruct)) {
231
217
// Even though the local variable conceptually doesn't have its address
232
218
// taken, it's so large that the "move" is implemented with a reference to a
233
219
// stack-local variable in the ABI. Consequently, this function *is*
234
- // protected by the `strong` heuristic . This is also the case for
235
- // rvalue-references in C++, regardless of struct size:
220
+ // protected. This is also the case for rvalue-references in C++,
221
+ // regardless of struct size:
236
222
// ```
237
223
// cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
238
224
// #include <cstdint>
@@ -246,7 +232,7 @@ pub fn local_large_var_moved(f: fn(Gigastruct)) {
246
232
247
233
// all: __security_check_cookie
248
234
// strong: __security_check_cookie
249
- // basic-NOT : __security_check_cookie
235
+ // basic: __security_check_cookie
250
236
// none-NOT: __security_check_cookie
251
237
// missing-NOT: __security_check_cookie
252
238
}
@@ -259,9 +245,9 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
259
245
// A new instance of `Gigastruct` is passed to `f()`, without any apparent
260
246
// connection to this stack frame. Still, since instances of `Gigastruct`
261
247
// are sufficiently large, it is allocated in the caller stack frame and
262
- // passed as a pointer. As such, this function is *also* protected by the
263
- // `strong` heuristic, just like `local_large_var_moved`. This is also the
264
- // case for pass-by-value of sufficiently large structs in C++:
248
+ // passed as a pointer. As such, this function is *also* protected, just
249
+ // like `local_large_var_moved`. This is also the case for pass-by-value
250
+ // of sufficiently large structs in C++:
265
251
// ```
266
252
// cat <<EOF | clang++ -O2 -fstack-protector-strong -S -x c++ - -o - | grep stack_chk
267
253
// #include <cstdint>
@@ -276,7 +262,7 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
276
262
277
263
// all: __security_check_cookie
278
264
// strong: __security_check_cookie
279
- // basic-NOT : __security_check_cookie
265
+ // basic: __security_check_cookie
280
266
// none-NOT: __security_check_cookie
281
267
// missing-NOT: __security_check_cookie
282
268
}
0 commit comments