Skip to content

Commit ebfddeb

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[test] Disable detect_stack_use_after_return in sanitizer leak test.
TEST=asan Bug: #62095 Change-Id: I2556dbbd9101bd83ac00c261f1659e552130b143 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465805 Reviewed-by: Brian Quinlan <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent c847a7b commit ebfddeb

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// Environment=ASAN_OPTIONS=detect_stack_use_after_return=0
6+
7+
// ASAN's detect_stack_use_after_return (default on) has cost O(stack size) per
8+
// longjmp/noreturn function.
9+
10+
@pragma("vm:never-inline")
11+
foo(n) {
12+
try {
13+
throw 'a';
14+
} catch (e) {}
15+
if (n > 0) {
16+
// Function.apply is implemented as a native, so this introduces new entry
17+
// frames, checking that DartEntryScope saves things as needed.
18+
Function.apply(() => foo(n - 1), []);
19+
Function.apply(() => bar(n - 1), []);
20+
}
21+
try {
22+
throw 'a';
23+
} catch (e) {}
24+
}
25+
26+
// Stagger stack depth.
27+
@pragma("vm:never-inline")
28+
bar(n) {
29+
foo(0);
30+
foo(n);
31+
foo(0);
32+
}
33+
34+
main() {
35+
foo(10);
36+
}

runtime/tests/vm/dart/regress47472_test.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// Environment=ASAN_OPTIONS=detect_stack_use_after_return=0
6+
7+
// ASAN's detect_stack_use_after_return (default on) has cost O(stack size) per
8+
// longjmp/noreturn function.
9+
510
main() {
611
for (int i = 0; i < 1000000; ++i) {
712
try {

0 commit comments

Comments
 (0)