collection icon indicating copy to clipboard operation
collection copied to clipboard

在vintage/context/test_swap.cpp中的raw_thread函数打印浮点数时,会segmentation fault

Open xingdl2007 opened this issue 6 years ago • 1 comments

可如下复现:

int raw_thread(voidp) { float pi = 3.14; printf("remote: hello %s\n", (char)p); ctx_swapcontext(&cc, &mc); printf("remote: back again\n"); ctx_swapcontext(&cc, &mc); printf("remote: return, %f\n", pi); return 1024; }

切换为posix ucontext系列函数不会core。 从glibc源码看,都使用的FNSTENV保存FPU的环境信息; gdb 查看,core在printf中: movaps %xmm0, 0x50(%rsp)

xingdl2007 avatar Oct 16 '19 09:10 xingdl2007

欢迎 PR

skywind3000 avatar Oct 16 '19 10:10 skywind3000