Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【BUG Report】__i386__场景下协程共享栈有问题 #186

Open
yulesyu opened this issue Jan 23, 2022 · 2 comments
Open

【BUG Report】__i386__场景下协程共享栈有问题 #186

yulesyu opened this issue Jan 23, 2022 · 2 comments

Comments

@yulesyu
Copy link

yulesyu commented Jan 23, 2022

2019/10/21 18:59:06时刻 提交的最新版本有问题。
SHA-1: 18ee765

  • Replace coctx_swap with Mov version

那个版本修改了coctx_swap汇编函数,以前的版本regs[0]会保留返回地址ret,regs[7]保留esp+4的地址指针;但是此版本之后regs[0]不再保存返回地址,regs[7]保存的esp地址指向返回地址存储的栈。
不保留返回地址会导致在共享栈的模式下,切换协程的coctx_swap汇编函数中,regs[7]恢复esp,但是此时共享栈上的esp指向的返回地址所在的栈可能会被上一个协程覆盖,故不能正确跳转到目标协程。

@hobby
Copy link

hobby commented Jan 23, 2022 via email

@wedvefv
Copy link

wedvefv commented Oct 9, 2023

这个库是协程是不能线程间转移的,单线程执行怎么会覆盖呢,任意时刻触发协程切换时,CPU上下文只有current和pending两个协程,不可能有两组 同时切换,应该不会覆盖吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants