Commit Graph

58 Commits (15fbe45a9a3aa93fc2b09d402379f698fb45c9bd)

Author SHA1 Message Date
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>
6 months ago
Winlin ff6a608099
ST: Replace macros with explicit code for better understanding. v7.0.7 (#4149)
Improvements for ST(State Threads):

1. ST: Use g++ for CXX compiler.
2. ST: Remove macros for clist.
3. ST: Remove macros for global thread and vp.
4. ST: Remove macros for vp queue operations.
5. ST: Remove macros for context switch.
6. ST: Remove macros for setjmp/longjmp.
7. ST: Remove macro for stack pad.
8. ST: Refine macro for valgrind.

---------

Co-authored-by: Jacob Su <suzp1984@gmail.com>
6 months ago
Winlin 7ab012c60f
SmartPtr: Support detect memory leak by valgrind. v6.0.132 (#4102)
1. Support detect memory leak by valgrind.
2. Free the http handler entry.
3. Free the stack of ST.

---

Co-authored-by: Jacob Su <suzp1984@gmail.com>
8 months ago
Winlin ff91757a3a
ST: Research adds examples that demos pthread and helloworld. v6.0.118 (#3989)
1. `trunk/research/st/exceptions.cpp` About exceptions with ST, works
well on linux and mac, not work on cygwin.
2. `trunk/research/st/pthreads.cpp` About pthreads with ST, works well
on all platforms.
3. `trunk/research/st/hello.cpp` Hello world, without ST, works well on
all platforms.
4. `trunk/research/st/hello-world.cpp` Hello world, with ST, works well
on all platforms.
5. `trunk/research/st/hello-st.cpp` A very simple version for hello
world with ST, works well on all platforms.
11 months ago
winlin 321f555e30 Clock: Update stat. Insert timer to execute first 4 years ago
winlin 040893efde Add research for UDP binding 4 years ago
winlin c3938ddfd2 Research: Add cost analysis 4 years ago
winlin a4d1b3e2ca Research: Add cost analysis 4 years ago
winlin e71d770a26 Update 4 years ago
winlin e830ca7d0c Research: Add huge coroutine test program 4 years ago
winlin a579f51e72 Remove ST in research 5 years ago
winlin 1ffd5fd455 rename org simple-rtmp-server to ossrs 9 years ago
winlin 115daa3cc1 migarate from winlinvip to srs org 10 years ago
winlin 0bc35e093c for bug #200, deadloop when read/write 0 and ETIME. 2.0.16. 10 years ago
winlin 77cf885d8c add comments for #161 10 years ago
winlin 8ab6b57612 research st, the timeout and coroutine scheduler. 10 years ago
winlin be46e428ad research st, for bug #193, remove the code with bug, exit when fork. 10 years ago
winlin f4dfee0e9f research st, add comments for bug #193. 10 years ago
winlin cd09fcaf55 research st, remove all events except epoll. 10 years ago
winlin 683b01a6c9 research st, add comments about the thread cycle 10 years ago
winlin 8327a57b7e never use stack variable for setjmp 10 years ago
winlin 2c01f7e943 research st, expand MD_INIT_CONTEXT macro, the thread start. 10 years ago
winlin 8da8c49f39 research st, add comments 10 years ago
winlin 2b70212649 research st, add stack struct comments. 10 years ago
winlin 6bde1e54dc research st, add stack alloc commnets. 10 years ago
winlin e49a868308 research st, rename variable thread to trd, for thread is a keyword. 10 years ago
winlin ac1a4ec0a3 research st, always alloc on stack. 10 years ago
winlin ae8b3e3c00 research st, remove the support of MD_STACK_GROWS_UP 10 years ago
winlin 340464ed56 research st, remove __ia64__ cpu support 10 years ago
winlin a27c3dca2d research st, add gdb info for setjmp. 10 years ago
winlin 4b24ee9db3 research st, only for linux and arm/mips/i386/x86_64 cpus. 10 years ago
winlin 0f41e0d26f research st: only support linux 10 years ago
winlin d67454ecc2 research st: only support linux 10 years ago
winlin 5fd308c64e update code, warning when compile dev branch. 10 years ago
winlin fa53250202 refine the macro, use int as version type. 2.0.8 10 years ago
winlin 8521762cb3 research st: refine sync. 10 years ago
winlin 3377df0bea research st: refine skt. 10 years ago
winlin 22710db911 research st: refine sched. 10 years ago
winlin f5f8e8946f research st: refine event, io and key. 10 years ago
winlin c38a545780 reserach st: refine key.c 10 years ago
winlin fd0c85b324 research st: refine io. 10 years ago
winlin f8f18fffa7 research st: update test for st. 10 years ago
winlin 0f293802c8 research st: refine the md.h 10 years ago
winlin 856ba07bd3 research st: update public and common. 10 years ago
winlin 315707d726 research st: refine public 10 years ago
winlin bba2d3dd98 research st: replace the TAB with 4spaces 10 years ago
winlin 55bd1dd95e research st: replace the TAB with 4spaces 10 years ago
winlin 0faa38dc0c research st: remove the osguess.sh 10 years ago
winlin 2dc6b7d1ea add io for st research 10 years ago
winlin 511c814ffb refs #182: rename to sync test. 10 years ago