Commit 6bc6dd5
Fix stack-use-after-return in TaskDispatchThread Android ctor
Summary:
Under `dev_clang_asan`, `bloks_runtimeTestsAndroid` crashes at startup with `__asan_report_load4` inside `ThreadScope::WithClassLoader`. The Android branch of the `TaskDispatchThread` constructor captures the `priorityOffset` parameter by reference into the `std::thread` lambda; the constructor returns immediately, so by the time the thread runs and reads `priorityOffset` inside `setpriority(...)` the stack slot is gone. Non-asan builds tolerate the racy read; asan catches it deterministically.
Capture `priorityOffset` (and `this`) by value on both the outer thread lambda and the inner `WithClassLoader` lambda.
Changelog:
[Internal]
Differential Revision: D1130466241 parent 0a1a06c commit 6bc6dd5
1 file changed
Lines changed: 6 additions & 3 deletions
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
0 commit comments