1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-15 04:42:04 +00:00
srs/trunk/auto
Winlin 8f48a0e2d1
ASAN: Support coroutine context switching and stack tracing (#4153)
For coroutine, we should use `__sanitizer_start_switch_fiber` which
similar to`VALGRIND_STACK_REGISTER`, see
https://github.com/google/sanitizers/issues/189#issuecomment-1346243598
for details. If not fix this, asan will output warning:

```
==72269==WARNING: ASan is ignoring requested __asan_handle_no_return: stack type: default top: 0x00016f638000; bottom 0x000106bec000; size: 0x000068a4c000 (1755627520)
False positive error reports may follow
For details see https://github.com/google/sanitizers/issues/189
```

It will cause asan failed to get the stack, see
`research/st/asan-switch.cpp` for example:

```
==71611==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000103600733 at pc 0x0001009d3d7c bp 0x000100b4bd40 sp 0x000100b4bd38
WRITE of size 1 at 0x000103600733 thread T0
    #0 0x1009d3d78 in foo(void*) asan-switch.cpp:13
```

After fix this issue, it should provide the full stack when crashing:

```
==73437==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000103300733 at pc 0x000100693d7c bp 0x00016f76f550 sp 0x00016f76f548
WRITE of size 1 at 0x000103300733 thread T0
    #0 0x100693d78 in foo(void*) asan-switch.cpp:13
    #1 0x100693df4 in main asan-switch.cpp:23
    #2 0x195aa20dc  (<unknown module>)
```

For primordial coroutine, if not set the stack by
`st_set_primordial_stack`, then the stack is NULL and asan can't get the
stack tracing. Note that it's optional and only make it fail to display
the stack information, no other errors.

---

Co-authored-by: john <hondaxiao@tencent.com>
2024-08-22 17:12:39 +08:00
..
apps.sh For #2532: Windows: Replace ln by cp for windows. v5.0.87 (#3246) 2022-11-18 23:02:38 +08:00
auto_headers.sh API: Support new HTTP API for VALGRIND. v6.0.149 v7.0.6 (#4150) 2024-08-21 15:39:01 +08:00
codecov.sh For #2532: Windows: Replace ln by cp for windows. v5.0.87 (#3246) 2022-11-18 23:02:38 +08:00
depends.sh ASAN: Support coroutine context switching and stack tracing (#4153) 2024-08-22 17:12:39 +08:00
local_ip.sh update readme. 2014-03-23 18:03:24 +08:00
modules.sh For #2532: Windows: Replace ln by cp for windows. v5.0.87 (#3246) 2022-11-18 23:02:38 +08:00
options.sh Always use single thread by default. 2024-07-22 07:02:53 +08:00
reset_module.sh Moduels: Refine the description 2021-04-21 11:18:35 +08:00
setup_variables.sh Compile: Fix typo for 3rdparty. v5.0.166, v6.0.59 (#3615) 2023-07-10 08:16:59 +08:00
summary.sh For #2532: Windows: Replace ln by cp for windows. v5.0.87 (#3246) 2022-11-18 23:02:38 +08:00
utest.sh Compile: Fix typo for 3rdparty. v5.0.166, v6.0.59 (#3615) 2023-07-10 08:16:59 +08:00